Google Places API搜索不一致

时间:2018-05-22 15:50:32

标签: google-places-api

Google Places API会针对特定类型的搜索意外行为。

我认为当'键入'时,API会返回与查询相关的所有地方的列表。未指定,但似乎并非如此。我得到以下请求的不同(非重叠)结果,使用相同的查询" bergamo8":

https://maps.googleapis.com/maps/api/place/textsearch/xml?query=bergamo8&key=API_KEY

<PlaceSearchResponse>
  <status>OK</status>
  <result>
    <name>Bergamo</name>
    <type>locality</type>
    <type>political</type>
    <formatted_address>Bergamo, Province of Bergamo, Italy</formatted_address>
    <geometry>
      <location>
        <lat>45.6982642</lat>
        <lng>9.6772698</lng>
      </location>
      <viewport>
        <southwest>
          <lat>45.6625158</lat>
          <lng>9.6205463</lng>
        </southwest>
        <northeast>
          <lat>45.7238489</lat>
          <lng>9.7136328</lng>
        </northeast>
      </viewport>
    </geometry>
    <icon>
      https://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png
    </icon>
    <reference>
      CmRbAAAA8T_6nvUrkTUF85gJtkVtFdbUccfYlcxVOziiUZ_HAsWHdySDg8cdPKvQD2wMjMx2oPc17nn4R3YaQDXbKViVyxHHf1qgWVwJ3yUHGygud4hUnY9aADoHSH-8U1l3xdaNEhD_SrAbwT9WGEQIedHS67AQGhTowbrLa_4LvWMfYSekJlYzOVyj5w
    </reference>
    <id>89666d6c7fc59efec1788477617d124d59a254f9</id>
    <photo>
      <photo_reference>
        CmRaAAAAAFWrmgCoXKoske2yxr9a6EkTDMlL59VTQ2bJ_SWzLxGT5itDjXLegV1Geliqilz70Ve3fekX9LUa46NcdVWPCKFGw8P1XniuDx8ZSyoNhObzrFTkgOI6TajtzqaOyG8fEhCnQYNCt4A19laWACC_c4OnGhQxg1rTA9mRBcgZlN_iMt4dViX6HQ
      </photo_reference>
      <width>2560</width>
      <height>1536</height>
      <html_attribution>
        <a href="https://maps.google.com/maps/contrib/106100271090014989776/photos">Barbara Grassi</a>
      </html_attribution>
    </photo>
    <place_id>ChIJc65ivBFRgUcR0aTlC4_LL9M</place_id>
  </result>
</PlaceSearchResponse>

https://maps.googleapis.com/maps/api/place/textsearch/xml?query=bergamo8&type=lodging&key=API_KEY

<PlaceSearchResponse>
  <status>OK</status>
  <result>
    <name>Bergamo8</name>
    <type>lodging</type>
    <type>point_of_interest</type>
    <type>establishment</type>
    <formatted_address>
      Piazza della Repubblica, 3, 24122 Bergamo BG, Italy
    </formatted_address>
    <geometry>
      <location>
        <lat>45.6979060</lat>
        <lng>9.6674570</lng>
      </location>
      <viewport>
        <southwest>
          <lat>45.6965483</lat>
          <lng>9.6660933</lng>
        </southwest>
        <northeast>
          <lat>45.6992480</lat>
          <lng>9.6687930</lng>
        </northeast>
      </viewport>
    </geometry>
    <rating>4.0</rating>
    <icon>
      https://maps.gstatic.com/mapfiles/place_api/icons/lodging-71.png
    </icon>
    <reference>
      CmRbAAAAciLhIMD6BUcnZrkiI3og5zkv8iufp0MXe1UJ48ZnBZgc37dyohrPK8SuBVIl9vtnMaeuqiS1rRUq1IcfoK9Y-DKQj17jsK0QttB-2Q5PICXtL23ZOFABZwPKFMCHvoGSEhC2tTX2oEUtdtvJJElkvA24GhRxoVbZjb2mIzhlLwzZYZKfvcTN3A
    </reference>
    <id>443bfff8822b1f589bffc27a4e4f9e3201e99200</id>
    <opening_hours>
      <open_now>true</open_now>
    </opening_hours>
    <photo>
      <photo_reference>
        CmRaAAAAW37hcFzSRR3TQWPggrDHh7g5nizXfCmtKuif8y-nX4_q6oQdt7GHNWe5YPOrrqcSfs_1a0opZHnFzV1QBBbh1RYNN4D41yTzM03VpGtIpamTNWY9Gyyv7oAi3p4r460SEhAAqvPQOxucRXoKwmmsTmE4GhQ3wybwAY9EmBKDd6uprFgHq_QiEA
      </photo_reference>
      <width>2048</width>
      <height>1335</height>
      <html_attribution>
        <a href="https://maps.google.com/maps/contrib/101851276576772600409/photos">Bergamo8</a>
      </html_attribution>
    </photo>
    <place_id>ChIJhfjVaxFRgUcRolpKS-72w8M</place_id>
  </result>
</PlaceSearchResponse>

有谁知道这是一个错误还是有办法检索与查询相关的所有类型的地方?

谢谢!

0 个答案:

没有答案