# Dwell Time computation from Real-Time user location

We have a collection of real time user locations from our application. Each record contains longitude, latitude and the time at which the geo location was captured. How can I compute the dwell time at an user's stationary place from this data?

We have a collection of real time user locations from our application. Each record contains longitude, latitude and the time at which the geo location was captured. How can I compute the dwell time at an user's stationary place from this data?

• Things to consider when collecting the data:

If you are using a Library such as: react-native-mauron85-background-geolocation and the Ionic Framework you would set the stationaryRadius to define an area within which the device reporting its location is considered to be stationary.

When there are obstructions and reflecting surfaces multi-path reception is likely. The signals arrive at the receiver at slightly different times and, depending on which signal the receiver chooses to believe for any given sample, the distance from the satellite also differs. Multiply this behavior by several satellites, then factor it into the overall position calculation, and the net result is that the receiver perceives abrupt shifts in position. Sometimes these can be significant - say 40 or 50 feet.

Higher level software in the receiver tries to smooth this out. Generally speaking, it does a better job of this when the tracker is moving. This is because your true change in position per unit time is much larger than the random shifts caused by multi-path reception.

You can average the reported position over a period of time to get a circle within which the device is likely to be. Using secondary information like IP address and WiFi positioning can provide additional information to narrow down the guess faster. See also: Wireless Technologies.

Here is an example that shows you where you are using Mozilla's Geolocation API, click on "Geolocation Live Example" and give permission to share your location (not with us at SE, with Mozilla).

• Once you have fairly accurate data it's simply a matter of defining a radius and minimum dwell time (which would be a moving average).

If they are moving fast then a shorter stay is a dwell, while at a slower speed a dwell wouldn't occur until a longer period of time.

Advanced mathematical modeling is necessary to analyze a better result and not get confused by meandering and backtracking.