[英]Query Google Maps for surrounding cities to a location
I am new to using Google Maps API. 我是使用Google Maps API的新手。 I have a problem that I want to solve.
我有一个我想解决的问题。 I have a ZIP code and city name and an input and I want to get the names and ZIP codes of all the cities surrounding the input in a specific radius.
我有邮政编码和城市名称以及输入,我想获取特定半径内输入周围所有城市的名称和邮政编码。
Is there a way to do this using Google Maps API or is there any other way ? 有没有办法使用Google Maps API执行此操作,还是有其他方法吗?
No. The Google Maps API doesn't have a proximity search. 不会.Google Maps API没有邻近搜索功能。 You can make yourself one with the harvesine formula or a space filling curve, ie a spatial index.
你可以使用harvesine公式或空间填充曲线,即空间索引。
Proximity search/nearby places isn't part of the Google Maps API. 邻近搜索/附近地点不是Google Maps API的一部分。 However there are third-party providers that may meet your requirement.
但是,有第三方提供商可能符合您的要求。 The first that comes to mind is geonames , this webservice seems like it might be what you are looking for.
想到的首先是GEONAMES ,这个web服务好像它可能是你在找什么。
While it's not available, you might try with the Places API, searching for something unique (ie 1 per city) in a set radius. 虽然它不可用,但您可以尝试使用Places API,在设定半径内搜索唯一的内容(即每个城市1个)。 Maybe try with a search for "city hall" around ZIP code XXXXX, radius 30 mi.
也许试着搜索邮政编码XXXXX,半径30英里周围的“市政厅”。 See if that yields valid results.
看看是否会产生有效的结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.