小编Kar*_*oft的帖子

谷歌地理编码 XML 响应删除公寓/套房号码

使用 Geocode API 时,原始地址中的任何嵌入式公寓或套房编号似乎都在 XML 响应中被删除。这使得无法使用返回的地址作为“更正”或“标准化”格式进行保存。

  1. 有没有办法保存地址信息?

  2. 其次,在这种情况下,“apt B”代表与“A、C、D、E等”不同的建筑物。因此不同的屋顶地理编码。

任何帮助表示赞赏

发送以下地址:1135 Thomas Ln。Apt B, Hixson, TN 37343 到以下 URL(已删除密钥)"https://maps.googleapis.com/maps/api/geocode/xml?address=[ADDRESS]&key=[KEY]"

导致以下响应:

<?xml version="1.0" encoding="UTF-8"?>
<GeocodeResponse>
 <status>OK</status>
 <result>
  <type>street_address</type>
  <formatted_address>1135 Thomas Lane, Hixson, TN 37343, USA</formatted_address>
  <address_component>
   <long_name>1135</long_name>
   <short_name>1135</short_name>
   <type>street_number</type>
  </address_component>
  <address_component>
   <long_name>Thomas Lane</long_name>
   <short_name>Thomas Ln</short_name>
   <type>route</type>
  </address_component>
  <address_component>
   <long_name>Hixson</long_name>
   <short_name>Hixson</short_name>
   <type>neighborhood</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>Chattanooga</long_name>
   <short_name>Chattanooga</short_name>
   <type>locality</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>Hamilton County</long_name>
   <short_name>Hamilton County</short_name>
   <type>administrative_area_level_2</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>Tennessee</long_name>
   <short_name>TN</short_name>
   <type>administrative_area_level_1</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>United States</long_name>
   <short_name>US</short_name>
   <type>country</type>
   <type>political</type> …
Run Code Online (Sandbox Code Playgroud)

google-maps geocoding google-geocoding-api

2
推荐指数
1
解决办法
3802
查看次数