谷歌地图地理编码API,API api(?)中缺少API的功能 [英] Google Maps Geocoding API, feature from the API missing in their JS api (?)

查看:126
本文介绍了谷歌地图地理编码API,API api(?)中缺少API的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题很简单,在Geocoding API的文档中他们说组件过滤存在。 (来源: https://developers.google.com/maps/documentation/geocoding/

但是,如果我查看JS文档( https://developers.google.com/maps/documentation/javascript/geocoding ),它似乎没有实现。不过,我记得谷歌早期曾经在其API中实现过功能但没有写入,所以我想知道是否有人知道如何使用Google Maps Geocoding API实现组件过滤功能?



谢谢!

解决方案

文档似乎已经实现了。无论哪种方式,这里是代码:

  geocoder.geocode(
{'address':address,'componentRestrictions' :{'country':'GB'}},
函数(结果,状态){
...
});




用于限制结果到特定区域。过滤器包含一个
或更多的路由,locality,administrativeArea,postalCode或
国家。只有匹配所有过滤器的结果才会被返回。
过滤器值支持与其他地理编码请求相同的拼写校正方法和
部分匹配。详细信息请参阅地理编码Web服务中的组件过滤



The problem is simple, in the documentation for the Geocoding API they say component filtering exists. (Source: https://developers.google.com/maps/documentation/geocoding/)

However, if I look at the JS documentation (https://developers.google.com/maps/documentation/javascript/geocoding), it doesn't seem to be implemented. I do however remember that google earlier used to have features implemented but not written about in their API, so I wonder if anyone knows how to achieve component filtering with the Google Maps Geocoding API?

Thanks!

解决方案

The documentation seems to of implemented it now. Either way, here is the code:

geocoder.geocode( 
      { 'address': address, 'componentRestrictions':{'country':'GB'}}, 
function(results, status){
...   
});

Used to restrict results to a specific area. A filter consists of one or more of: route, locality, administrativeArea, postalCode or country. Only the results that match all the filters will be returned. Filter values support the same methods of spelling correction and partial matching as other geocoding requests. See Component Filtering in the Geocoding web service for further details.

这篇关于谷歌地图地理编码API,API api(?)中缺少API的功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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