## Calculating Distance Between two GPS points

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

### Calculating Distance Between two GPS points

I have a simple GPS tracking application that I'm writing that uploads the GPS data to a server so we can track where our employee's go. However, when the application is running it hammers our server tremendously, and we'd like to limit that.

What I'm looking for is two-fold:

One, a way to determine if the new location is within x meters of the previous location.

Two, a way to determine velocity (speed) and to limit the update if the velocity is under x mph.

wedtm
Freshman

Posts: 2
Joined: Fri Nov 21, 2008 6:52 am

requestLocationUpdates(String provider, long minTime, float minDistance, LocationListener listener)
minDistance should do the trick. For speed, I don't know, you probably have to calculate it yourself.

MrSnowflake
Moderator

Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Someone else on this forum had a similar question(distance computation).
See my reply to him here : http://www.anddev.org/distance_between_ ... t4195.html

Computing the speed is straightforward: you know your sampling frequency, and you now know the distance between the most recent two points, so, employee speed = distance / sampling interval

dmt
Junior Developer

Posts: 15
Joined: Mon Jan 05, 2009 6:06 am