Google地图-查找靠近我的路线的城市 [英] Google maps - find cities close to my route

查看:55
本文介绍了Google地图-查找靠近我的路线的城市的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获得我可能在A点和B点之间经过的所有城市的清单.

输入-
点A为原点
将B点作为目的地

I would like to get a list of all cities I might pass on my way between point A and point B

Input -
point A as origin
point B as destination

输出:
在A点和B点之间的路线(很明显)
AND
比我的路线近X英里的城市/城镇/地方列表.

Output:
Route between point A and point B (that's obvious)
AND
list of cities / towns / places that are closer than X miles to my route.

我想向用户提供一个可能要考虑的航点的列表(景点,历史遗址,公园等)

I would like to present the user a list of possible waypoints to consider (points of interest, historic sites, parks, etc)

有什么想法怎么做?

Any ideas how to do that?

推荐答案

我相信您需要分两个阶段执行此操作:

I believe you'd need to do this in a two-stage process:

第一步是计算一条代表A和B之间路线的折线(如您所说,这很明显).您可以使用Bing Maps REST(http://msdn.microsoft.com/en-us/library/ff701717.aspx)或SOAP(http://msdn.microsoft.com/en-us/library/cc966826)来完成此操作.aspx)路由服务.

The first step would be to calculate a polyline representing the route between A and B (as you say, that's obvious). You can do this using the Bing Maps REST (http://msdn.microsoft.com/en-us/library/ff701717.aspx) or SOAP (http://msdn.microsoft.com/en-us/library/cc966826.aspx) routing services, for example.

当您从这些服务中的任何一个请求路由时,请确保指定要在结果中包含完整的路由路径(REST的rpo参数或SOAP的RoutePathType.Points参数).这将为您提供用于构造路径路径的所有点的数组-否则,您将仅获得行程点的摘要(即,仅需要执行操作的路线上的那些点-改变道路等).

When you request the route from either of these services, make sure you specify that you want the full route path to be included in the results (rpo paramter for REST or RoutePathType.Points parameter for SOAP). This will give you an array of all the points that are used to construct the routepath - otherwise you'll just get a summary of itinerary points (i.e. only those points on the route at which you need to do something - change roads etc.)

一旦有了点数组,第二步就是确定所有位于这些点之间绘制的路径的距离x内的位置.尽管有许多网络服务可让您查询单个点x距离之内的地点(例如,包括Bing Maps搜索服务和geonames findNearby服务),但我不知道任何提供此功能的Web服务,因此您必须自己提供.

Once you've got the array of points, step two is to determine all those locations that lie within distance x of the path drawn between these points. While there are many webservices that allow you to query for places lying within x distance of an individual point (including the Bing Maps search service and the geonames findNearby service, for example), I'm not aware of any webservices that provide this functionality, so you'll have to provide it yourself.

一种方法是使用SQL Server 2008或SQL Server Azure,并从 http://download.geonames.org/export/dump/.然后,您可以从路径路径中的点构造LineString几何体,并使用以下查询来查询数据库中的位置列表:

One way of doing so would be to use SQL Server 2008 or SQL Server Azure, loaded up with the geonames allCountries data dump from http://download.geonames.org/export/dump/. You could then construct a LineString geometry from the points in your routepath, and query the list of places in the database with a query such as:

选择*从所有国家/地区Location.STDistance(@RoutePath)< = 1000;

SELECT * FROM allCountries WHERE Location.STDistance(@RoutePath) <= 1000;

Johannes Kebeck发布了一个基于Bing SOAP Route服务和SQL Azure的使用此方法的示例,您可以在此处找到:

Johannes Kebeck posted an example using this approach based on the Bing SOAP Route service and SQL Azure, which you can find here: http://jkebeck.wordpress.com/2010/06/26/find-near-route-for-bing-maps-powered-by-sql-azure-spatial/

这篇关于Google地图-查找靠近我的路线的城市的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆