【问题标题】:Google Maps APIs Reverse geocoding - result_type?Google Maps API 反向地理编码 - result_type?
【发布时间】:2017-08-24 21:55:45
【问题描述】:

查看https://developers.google.com/maps/ 真的很累。我没有运气,或者我是盲人,我不知道如何解决我的问题。

所以我想对 address_component 中更具体的数据使用反向地理编码:

https://maps.googleapis.com/maps/api/geocode/json?latlng=49.5014564,18.8833393&result_type=administrative_area_level_1&key=api_key - 这很完美,但我不知道如何使用地理编码器 API 设置可选的 result_type

     

 

    geocoder.geocode ({
           Location: latlng,
           Result_type: "administrative_area_level_1" // ???? i just don't know
           }, 
           Function (results, status) 
           {
              // check status etc...
           } });

感谢您的建议、提示或其他。

【问题讨论】:

  • 1. javascript 区分大小写(功能!= 功能,位置!= 位置)。 2.GeocoderRequest中没有Result_type。搜索 SO 以获取有关如何解析结果以获取类型为 Administrative_area_level_1 的结果的答案。 google maps geocoder to return state 的可能重复项
  • 1.好的,我知道调试器告诉我 2. 我知道如何解析结果,但是当结果不包含我需要的数据时,这并不重要。 解决方案存在 在反向地理编码请求link 的可选参数中,但如果我是对的,Google Maps JavaScript API V3 不包含 result_type 属性的可能性。 --
  • 我唯一的选择是尝试通过地图 google api 上的一些 http get 请求再次调用请求,但不使用 GeocoderRequest。基本上我可以在 JS 代码中使用这个 url:maps.googleapis.com/maps/api/geocode/…

标签: javascript google-maps google-maps-api-3 google-geocoding-api


【解决方案1】:

功能请求已在 Google 问题跟踪器中提交:

https://issuetracker.google.com/issues/35826518

如您所见,Google 工程部门的回答是:

result_type 过滤可以通过简单地删除与所需类型不匹配的结果来实现。虽然在 JavaScript API 中使用它会很方便,但这并不是真正必要的。

您可以为功能请求加注星标以添加您的投票并订阅更多通知。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-06-08
    • 1970-01-01
    • 2014-10-23
    • 2011-09-27
    • 1970-01-01
    • 2011-07-17
    • 2013-04-05
    相关资源
    最近更新 更多