简体   繁体   English

如何获取Google Maps“Places API”以返回邮政编码信息?

[英]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.

相关问题 如何在Java代码中使用Google Maps API来获取指定位置的坐标? - How do I use Google Maps API in a Java code to fetch coordinates of specified location? 如何在Android上使用Google Maps Directions API? - How do I use Google Maps Directions API on Android? Google Maps API,检索最近的地方 - Google Maps API, retrieving nearest places Google Places API:地点类别和地点信息 - Google Places API: place category and place information 如何根据对象信息在Google地图活动中放置自定义标记 - How do I place a custom marker in a google-maps activity from an object information 使用Freebase API获取有关地点的信息 - get information about places with freebase api 如何使用 Google 地点 API 获取城市的地理编码(坐标)和人口(公民人数)? 我应该使用哪些请求? - How to get the geocode(coordinates) and population (count of civils) of the city with the Google places API? Which requests I should use? 我如何分裂成两个地方? - How do I get to split in two places? 在哪里可以找到GWT Google Maps V3 API代码示例? - Where do I find GWT Google Maps V3 API code examples? 如何使用 Google Places Autocomplete 获取位置的完整地址? - How do I get the full address of location using Google Places Autocomplete?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM