Geolocation sensing

Most modern browsers support geolocation sensing. Essentially, when a user vists a webpage, the browser can sense the geolocation of that user. The user is prompted to share his location and only on approval. is the location shared. Typically, the location is determined using some of the following parameters (in order of accuracy)
- Using the GPS of the device. Typically works only in smart end phones which have inbuilt GPS chip.
- From the GSM/CDMA cell tower location.
- From user’s IP. This would be the most common for desktops on a landline broadband connection.

The geolocation can then be used to plot the user’s position on a map or for other bits. An example can be viewed here. In the example, click on the icon which appears on the right, above the map, to plot your location.

The geolocation is sensed using the navigator.geolocation object. The getCurrentPosition method gives the current position. One key argument for this function is enableHighAccuracy. Essentially, a higher accuracy would make the browser return back the GPS coordinates if they are available rather the position from IP. The returned values contain the latitude, longitude and altitude. But besides these, the function also returns a coords.accuracy. This shows the accuracy of the point in metres.

The watchPosition method is identical to the above except that it keeps giving the coordinates as the position changes. This is very handy to track the position in case the device is moving.

A combination of the above functions can be used to track a device movement over a period of time assuming the device has the page open and internet access is available to the device during that period. For such an application, one could discard points which fall below a certain accuracy level so that the path is smooth and is not zig zagged due to the some freak points which are inaccurate. Typical usage could be for tracking users with a mobile device or cargo tracking via a mobile device.

Leave a Reply

Your email address will not be published. Required fields are marked *

*


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>