# Time between two GPS Co-ords

## Recommended Posts

A client of mine is a courier. they want an estimate of the travel time between a client location and a courier (using a mobile phone that regularly uploads gps co-ords to a filemaker table). Courier may be on a bicycle or in a car. The desire is to prioritize dispatching to people who are in a time-based vicinity of the client.

So, you can assume there's a "Trip" table, with client_gps field, and courier table with "current_location_gps" field. and a time_between calculation.

Any thoughts?

##### Share on other sites

When you say "gps co-ords" do you mean latitude and longitude? If so, look for the Haversine formula to calculate the distance between two locations. I am not sure how you translate that to time.

See also http://fmforums.com/topic/71942-limiting-number-of-portal-results/ where a technique for finding records within a given distance to a known point is discussed

##### Share on other sites

I wrote a blog post that includes finding transit distance and time using a web service. That post demonstrates using the Google APIs, but I now recommend the MapQuest Open API first due to more permissive terms of use. The free Google API license terms specifically prohibit using it for the kind of solution you're working on.

Depending on how many couriers you have and how quickly you need to make dispatch decisions, using a web service to estimate transit times for all your couriers may not be practical. As Comment is hinting at, searching within a bounded location box is much faster. I wrote another blog post on the same idea. Since you're prioritizing, this is perfectly reasonable for most places. The peculiar relation between straight-line distance and transit distance in certain very dense cities aside, it's still a strongly monotonic relationship — ranking/sorting based on either usually gives you more-or-less the same order.

Comparing the transit times of cars and bikes is another matter. We expect a car to be faster than a bike to cover the same distance (unless the distance is small and traffic is bad), but how much closer does a bike have to be to be faster? Perhaps you could do a proximity find for the closest car, and the closest bike, and then you only have 2 web service requests to make to compare their estimated transit times.

##### Share on other sites

Yep. I mean long and lat. And thanks for the blog links jbante. The haversine formula might be sufficient, and involves no map requests. On the other hand, in some towns (like vancouver, with stupid things like oceans and rivers and mountains in the way), linear distance might not be enough.

I"m thinking maybe using the haversine to shortlist to a few candidate couriers within a specific distance, then using web service to get transit times on the short list for a final result set.

Thanks for the feedback folks.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×

×
×
• Create New...