做“沿着路线的兴趣点”在谷歌地图中
我需要允许旅行者使用谷歌地图来绘制路线,然后查询我的兴趣点数据库(比方说,麦当劳的位置),然后显示距离他们将要到达的路线一两英里以内的所有这些位置服用。问题是,如何有效地获取从 google 返回的“行车路线”信息(本质上是一组纬度/经度对),并将其转换为 SQL 查询以获取距路线一定距离内的位置?
它不必非常精确,“鸟儿飞翔”与路线的距离就可以了。我最关心的是它的效率是否合理。
在数据库中,基本上每个条目都有纬度和经度,但我可以根据需要更改数据库模式。
举个例子,这个网站做了我想做的事情(如果您给出起点和终点,它将显示您将要行驶的高速公路附近的 V 形车站): http://www.chevron.com/products/stations/stationfinder/planyourroute。 aspx
(来源:karmatics.com)
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请查看
http: //google-maps-utility-library-v3.googlecode.com/svn/tags/routeboxer/1.0/examples/routeboxer-v3.html
以下是文档:http://google-maps-utility-library-v3.googlecode.com/ svn/tags/routeboxer/1.0/docs/examples.html
您可以从 RouteBoxer 获取框坐标并将其发送到服务器端脚本进行处理
Check this out
http://google-maps-utility-library-v3.googlecode.com/svn/tags/routeboxer/1.0/examples/routeboxer-v3.html
Here's the documentation: http://google-maps-utility-library-v3.googlecode.com/svn/tags/routeboxer/1.0/docs/examples.html
You could get the box coordinates from RouteBoxer and send that to a serverside script for processing