A method of determining a location of a portable handheld device in an indoor space: identifying a map of an indoor space, the map being based on a plurality of constraints; generating, by one or more processors, a first set of particles, each particle of the first set of particles representing a location on the map and being associated with a likelihood value; receiving data from an orientation device including a gyroscope; determining a direction and speed of movement based on the received data; applying the direction and speed of movement to each one of the first set of particles; adjusting, by the one or more processors the likelihood value of each particular particle of the first set of particles, based on whether the particular particle violated one or more of the plurality of constraints; resampling the first set of particles to generate a new generation of particles based on the likelihood values associated with the first set of particles, wherein each particle of the new generation of particles includes a likelihood value; adjusting the likelihood values of the new generation of particles based on received data from the orientation device and continuing to generate new generations of particles by resampling previous generations of particles until all of the particles of a current generation of particles are located within an area that meets a threshold radius; selecting, by the one or more processors a particular particle of the current generation of particles closest to an average representative location of the current generation of particles when all of the particles of the current generation of particles are located within the area that meets the threshold radius; and identifying, by the one or more processors an actual location of the portable handheld device in the indoor space based on a representative location of the selected particle. identifying a map of an indoor space, the map being based on a plurality of constraints; generating, by one or more processors, a first set of particles, each particle of the first set of particles representing a location on the map and being associated with a likelihood value; receiving data from an orientation device including a gyroscope; determining a direction and speed of movement based on the received data; applying the direction and speed of movement to each one of the first set of particles; adjusting, by the one or more processors the likelihood value of each particular particle of the first set of particles, based on whether the particular particle violated one or more of the plurality of constraints; resampling the first set of particles to generate a new generation of particles based on the likelihood values associated with the first set of particles, wherein each particle of the new generation of particles includes a likelihood value; adjusting the likelihood values of the new generation of particles based on received data from the orientation device and continuing to generate new generations of particles by resampling previous generations of particles until all of the particles of a current generation of particles are located within an area that meets a threshold radius; selecting, by the one or more processors a particular particle of the current generation of particles closest to an average representative location of the current generation of particles when all of the particles of the current generation of particles are located within the area that meets the threshold radius; and identifying, by the one or more processors an actual location of the portable handheld device in the indoor space based on a representative location of the selected particle.