【问题标题】:Google Geocoding API returning wrong address, but Google maps showing correct locationGoogle Geocoding API 返回错误的地址,但 Google 地图显示正确的位置
【发布时间】:2013-07-24 21:08:27
【问题描述】:

我一直在使用 Google 地理编码 API 来通过 URL 返回一个地点的坐标: http://maps.googleapis.com/maps/api/geocode/json?address=Saints%20Peter%20&%20Paul%20Parish%204070%20Central%20Parkway%20East,%20Mississauga,%20L4Z%201T6,+CA&sensor=false

地点地址是:

Saints Peter & Paul Parish, 4070, Central Parkway East, Mississauga, L4Z 1T6。

在 Google 地图中搜索时,它会返回正确的位置,但是当使用上述 URL 获取 JSON 格式的坐标时,它会返回美国迈阿密的一些坐标,而我的地址是加拿大密西沙加。

这是在 Google 地图中搜索相同地址时的实际位置: https://www.google.co.in/maps/preview#!q=Saints+Peter+%24+Paul+Parish%2C+204070%2C+Central+Parkway+East%2C+Mississauga%2C+L4Z+1T6&data=!4m10!1m9!4m8!1m3!1d126887!2d76.3082933!3d9.9822827!3m2!1i1600!2i775!4f13.1

但是返回的坐标是25.7598220,-80.2133820,在麦米里

【问题讨论】:

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


    【解决方案1】:

    返回结果等于http://maps.googleapis.com/maps/api/geocode/json?address=Saints%20Peter%20&sensor=false

    您也需要对 & 符号进行编码(使用 %26),否则 & 符号后面的所有内容都将被视为新参数,而不是地址的一部分

    正确结果:http://maps.googleapis.com/maps/api/geocode/json?address=Saints%20Peter%20%26%20Paul%20Parish%204070%20Central%20Parkway%20East,%20Mississauga,%20L4Z%201T6,%20CA&sensor=false

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-11-05
      • 2015-08-27
      • 1970-01-01
      • 1970-01-01
      • 2018-02-23
      • 2014-11-19
      • 2018-06-27
      • 1970-01-01
      相关资源
      最近更新 更多