问题
Today, December 14th, I query Google Maps API (https://maps.googleapis.com/maps/api/geocode/json) with many addresses, I get everything, like sublocality or locality address components, but nothing for neighborhood location type, out of 20 queries.
The following is an example of the first result I get when I query this address: 694 rue Saint-Vallier O, Québec (Québec) G1N1C8.
{:address-components
({:long-name "694", :short-name "694", :types ("street_number")}
{:long-name "Rue Saint-Vallier Ouest", :short-name "Rue Saint-Vallier O", :types ("route")}
{:long-name "La Cité-Limoilou", :short-name "La Cité-Limoilou", :types ("political" "sublocality" "sublocality_level_1")}
{:long-name "Ville de Québec", :short-name "Ville de Québec", :types ("locality" "political")}
{:long-name "Communauté-Urbaine-de-Québec", :short-name "Communauté-Urbaine-de-Québec", :types ("administrative_area_level_2" "political")}
{:long-name "Québec", :short-name "QC", :types ("administrative_area_level_1" "political")}
{:long-name "Canada", :short-name "CA", :types ("country" "political")}
{:long-name "G1N 1C8", :short-name "G1N 1C8", :types ("postal_code")}),
:formatted-address "694 Rue Saint-Vallier O, Ville de Québec, QC G1N 1C8, Canada",
:geometry {:location {:lat 46.8095334, :lng -71.2466119},
:location-type "ROOFTOP",
:viewport {:northeast {:lat 46.8108823802915, :lng -71.24526291970851},
:southwest {:lat 46.8081844197085, :lng -71.24796088029152}}},
:place-id "ChIJyeeRiF2WuEwRSkuyr-3-zCQ", :types ("street_address")}
In the address-components list, I normally also get something like:
{:long-name "Saint-Sauveur", :short-name "Saint-Sauveur", :types ("political" "neighborhood")}
回答1:
It's indeed related to the rollout of the update to the Geocoding API.
Address components are now more dependent on each geocoding result, and may include only those that are relevant for address formatting. This is expected to be a gradual change and take some time.
This applies only for street addresses, including buildings and points of interest. If you need additional address components, reverse geocoding is the best way to obtain them reliably.
For instance, check it out using the Geocoder Tool:
Forward Geocoding request
Reverse Geocode the returned location
回答2:
Google is rolling out an update to the geocoder per this blog post
From the post:
Future Changes to Geocoding API
We plan to roll out an update to the Geocoding API at the end of November 2016 that will increase the difference between Geocoding and Places performance for ambiguous and unambiguous queries. This change will improve the quality of Geocoding results for unambiguous queries, but will be more likely to return ZERO_RESULTS for ambiguous or incomplete queries where the Geocoding API was unable to find a high quality result.
If you are already using the above best practices, you should see an improvement in your Geocoding API results. If you are currently using the Geocoding API for incomplete or ambiguous queries, or for queries that may contain non-address information such as business names or apartment numbers, we recommend that you switch to the Places API instead, as it is likely to give better quality results for your use case.
(emphasis mine)
来源:https://stackoverflow.com/questions/41148207/google-maps-api-doesnt-give-me-back-neighborhood-anymore