[email protected] Posted June 28, 2016 Posted June 28, 2016 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?
comment Posted June 28, 2016 Posted June 28, 2016 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
jbante Posted June 29, 2016 Posted June 29, 2016 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.
[email protected] Posted June 30, 2016 Author Posted June 30, 2016 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.
Recommended Posts
This topic is 3159 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now