[英]How do I get Google Maps “Places API” to return ZIP code information?
How do I get Google Maps "Places API" to return ZIP code information? 如何获取Google Maps“Places API”以返回邮政编码信息? In all the examples I find on the internet, none of them show results returning that contain a ZIP code. 在我在互联网上找到的所有示例中,没有一个显示包含邮政编码的返回结果。 Is there a trick to this or is it not possible? 有这个诀窍还是不可能?
This seems like it's returning a "postal code" (4 digits for some reason) in the address_component
section: 这似乎是在address_component
部分中返回“邮政编码”(由于某种原因4位数):
https://developers.google.com/places/documentation/#PlaceDetailsRequests https://developers.google.com/places/documentation/#PlaceDetailsRequests
However, I think what you're looking for is the Google Geocoding API: 但是,我认为您正在寻找的是Google地理编码API:
Geocoding is the process of converting addresses (like "1600 Amphitheatre Parkway, Mountain View, CA") into geographic coordinates (like latitude 37.423021 and longitude -122.083739), which you can use to place markers or position the map. 地理编码是将地址(如“1600 Amphitheatre Parkway,Mountain View,CA”)转换为地理坐标(如纬度37.423021和经度-122.083739)的过程,您可以使用它来放置标记或定位地图。 The Google Geocoding API provides a direct way to access a geocoder via an HTTP request. Google Geocoding API提供了通过HTTP请求访问地理编码器的直接方式。 Additionally, the service allows you to perform the converse operation (turning coordinates into addresses); 此外,该服务允许您执行逆向操作(将坐标转换为地址); this process is known as "reverse geocoding." 这个过程被称为“反向地理编码”。
You can see in the JSON and XML responses a 5-digit postal code: 您可以在JSON和XML响应中看到一个5位数的邮政编码:
https://developers.google.com/maps/documentation/geocoding/#JSON https://developers.google.com/maps/documentation/geocoding/#JSON
check with:place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.PostalCode.PostalCodeNumber
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.