1

I'm looking (and not finding) any reference in the google maps api (both Android and Web) to get a list of all the zip codes that a given driving path moves through.

Am I overlooking this or is this not something that the API supports?

So, to be clear, I have directions from point A to point B and I'm interested in pulling up all the unique zip codes that the path goes through (not just the zip codes of the individual points where navigation instructions are given, but ALL zip codes for the entire path).

4

2 回答 2

1

Why the zip codes? of all things? The zip code in the US only represents a very small portion of an address. Also, most people don't know zip codes, a more useful piece of information would be the city/county a car is driving through. Are you from outside the United States by any chance? Or are you making an application for postal workers?

In any case, what you're looking for is reverse geocoding. See this example of reverse geocoding on Google Maps.You give it a longitude and latitude and the server sends you back an address with the zip code included (for your purpose, you'll just need to disregard the rest of the information it gives you). This will have to be done on a point by point basis. There is nothing in the documentation I just linked to, that does this for an entire path.

If I were you, I'd go directly to the source, the census bureau. That's where Google Maps takes its address data from anyway.

于 2014-08-04T01:59:37.120 回答
1

邮政编码的大小往往不规则(从覆盖大部分城镇到办公大楼的一层)。

谷歌似乎没有提供一种工具来获取您的路线所经过的唯一邮政编码,但您当然可以尝试沿着您的路线每隔 x 米查询(对经纬度坐标进行反向地理编码)以获得(接近)完整列表.

当您请求方向时,您会得到一个包含许多 DirectionLeg 对象的 directionResult 对象,其中包含 DirectionStep 对象,这些对象的路径具有 lat-lng。如果 lat-lngs 相距太远,你可以插值,如果它们两个接近,你可以跳过一些。

于 2014-08-04T02:01:49.907 回答