我如何获取Google地图“Places API”返回邮政编码信息? [英] How do I get Google Maps "Places API" to return ZIP code information?

查看:244
本文介绍了我如何获取Google地图“Places API”返回邮政编码信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何获得Google地图Places API以返回邮政编码信息?在互联网上找到的所有例子中,没有一个显示包含邮政编码的结果。有没有一个技巧,或者它是不可能的?

解决方案

这似乎是它返回一个邮政编码 )在 address_component 部分中:

com / places / documentation /#PlaceDetailsRequestsrel =noreferrer> https://developers.google.com/places/documentation/#PlaceDetailsRequests



不过,我认为您要寻找的是Google Geocoding API: b
$ b


地理编码是将地址转换的过程(如1600
Amphitheatre Parkway,Mountain View,CA)转换为地理坐标
(如纬度37.423021和经度-122.083739),您可以使用
放置标记或放置地图。 Google Geocoding API
提供了通过HTTP请求访问地理编码器的直接方式。此外,服务
允许您执行逆向操作(将坐标转换为
地址);这个过程被称为反向地理编码。

您可以在JSON和XML响应中看到一个5位邮政编码:



https://开发人员。 google.com/maps/documentation/geocoding/#JSON


How do I get Google Maps "Places API" to return ZIP code information? 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:

https://developers.google.com/places/documentation/#PlaceDetailsRequests

However, I think what you're looking for is the Google Geocoding 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. The Google Geocoding API provides a direct way to access a geocoder via an HTTP request. 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:

https://developers.google.com/maps/documentation/geocoding/#JSON

这篇关于我如何获取Google地图“Places API”返回邮政编码信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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