I need to allow travelers to use google maps to plot a route, and then query my database of points of interest (let's say, McDonald's locations) and then show all of these locations that are within a mile or two of the route they will be taking. The question is, how do I efficiently take the "driving directions" information that comes back from google (essentially an array of lat/long pairs), and turn that into an sql query to get locations that fall within a certain distance from the route?
It does not have to be super precise, and "as the bird flies" distances from the routes are just fine. I'm most concerned about it being reasonably efficient.
In the database, things are set up pretty basically with each entry having a latitude and longitude, but I can change the database schema as needed.
As an example, this site does what I want to do (if you give a starting point and ending point, it will show chevron stations that are near the highway you will be taking):
http://www.chevron.com/products/stations/stationfinder/planyourroute.aspx
(source: karmatics.com)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…