Google Maps API不再让我回到邻里 [英] Google Maps API doesn't give me back neighborhood anymore

查看:104
本文介绍了Google Maps API不再让我回到邻里的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

今天12月14日,我查询了带有许多地址的Google Maps API( https://maps.googleapis.com/maps/api/geocode/json ),我获取所有内容,例如sublocality或locality地址组件,但不包含20个查询中的邻域位置类型。

以下是我获得第一个结果的示例查询此地址: 694 rue Saint-Vallier O,Québec(Québec)G1N1C8

 <$ c:{:address-components 
({:long-name694,:short-name694,:types(street_number)}
{:long-nameRue Saint-Vallier Ouest:简称Rue Saint-Vallier O,:类型(route)}
{:长名称LaCité-Limoilou,简称LaCité- Limoilou:类型(政治sublocalitysublocality_level_1)}
{:长名称Ville deQuébec,:简称Ville deQuébec,:类型(地点 )}
{:名为Communauté-Urbaine-de-Québec的短名称:Communauté-Urbaine-de-Québec,:类型(admini 魁北克:短名称QC,:类型(administrative_area_level_1political)}
{:长名称加拿大:短名称CA,:类型(国家政治)}
{:长名称G1N 1C8,:短名称G1N 1C8,:types(postal_code )}),
:格式化地址694 Rue Saint-Vallier O,Ville deQuébec,QC G1N 1C8,Canada,
:geometry {:location {:lat 46.8095334,:lng -71.2466119} ,
:location-typeROOFTOP,
:viewport {:northeast {:lat 46.8108823802915,:lng -71.24526291970851},
:southwest {:lat 46.8081844197085,:lng -71.24796088029152}} },
:place-idChIJyeeRiF2WuEwRSkuyr-3-zCQ,:types(street_address)}

在地址组件列表中,我通常也会得到如下内容:
{:long-nameSaint-Sauveur,:简称Saint-Sauveur, :types(politicalneighborhood)}

解决方案

确实与推出更新到Geocoding API

地址组件现在更依赖于每个地理编码结果,并且可能只包含那些这与地址格式相关。这预计是一个渐变,需要一些时间。



这仅适用于街道地址,包括建筑物和兴趣点。如果您需要额外的地址组件,则反向地理编码是获取它们的最佳方法。

例如,请使用 Geocoder Tool


  • 转发地理编码请求

    https://google-developers.appspot.com/maps/documentation/utils/geocoder/#q%3D46.809533%252C-71.246612%26nfw%3D1 =nofollow noreferrer>反向地理编码返回的位置



Today, December 14th, I query Google Maps API (https://maps.googleapis.com/maps/api/geocode/json) with many addresses, I get everything, like sublocality or locality address components, but nothing for neighborhood location type, out of 20 queries.

The following is an example of the first result I get when I query this address: 694 rue Saint-Vallier O, Québec (Québec) G1N1C8.

{:address-components 
 ({:long-name "694", :short-name "694", :types ("street_number")} 
  {:long-name "Rue Saint-Vallier Ouest", :short-name "Rue Saint-Vallier O", :types ("route")} 
  {:long-name "La Cité-Limoilou", :short-name "La Cité-Limoilou", :types ("political" "sublocality" "sublocality_level_1")} 
  {:long-name "Ville de Québec", :short-name "Ville de Québec", :types ("locality" "political")} 
  {:long-name "Communauté-Urbaine-de-Québec", :short-name "Communauté-Urbaine-de-Québec", :types ("administrative_area_level_2" "political")} 
  {:long-name "Québec", :short-name "QC", :types ("administrative_area_level_1" "political")} 
  {:long-name "Canada", :short-name "CA", :types ("country" "political")} 
  {:long-name "G1N 1C8", :short-name "G1N 1C8", :types ("postal_code")}), 
 :formatted-address "694 Rue Saint-Vallier O, Ville de Québec, QC G1N 1C8, Canada", 
 :geometry {:location {:lat 46.8095334, :lng -71.2466119}, 
            :location-type "ROOFTOP", 
            :viewport {:northeast {:lat 46.8108823802915, :lng -71.24526291970851}, 
                       :southwest {:lat 46.8081844197085, :lng -71.24796088029152}}}, 
 :place-id "ChIJyeeRiF2WuEwRSkuyr-3-zCQ", :types ("street_address")}

In the address-components list, I normally also get something like: {:long-name "Saint-Sauveur", :short-name "Saint-Sauveur", :types ("political" "neighborhood")}

解决方案

It's indeed related to the rollout of the update to the Geocoding API.

Address components are now more dependent on each geocoding result, and may include only those that are relevant for address formatting. This is expected to be a gradual change and take some time.

This applies only for street addresses, including buildings and points of interest. If you need additional address components, reverse geocoding is the best way to obtain them reliably.

For instance, check it out using the Geocoder Tool:

这篇关于Google Maps API不再让我回到邻里的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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