Open jongotlin opened 4 years ago
It's because of the order of these two lines:
https://github.com/geocoder-php/Geocoder/blob/c2d2c3bc9dde6ee92954cb2f427e0e1c866a385d/src/Provider/GoogleMaps/GoogleMaps.php#L295-L296
Maybe postal_town
should be before locality
?
@alanpoulain That won't affect the result unfortunately.
Thanks for the notice !
We'll need to test for address all over the world to (maybe) improve the process of locality
and postal_town
.
I'll try to do that ASAP.
@jongotlin For "Pershagen" search, if "Pershagen" is the locality, what should "Södertälje" be ?
Ideally Pershagen would be a sub locality and Södertälje locality but thats not what the Google response says.
Can we have Södertälje in list of admin levels?
Can we have Södertälje in list of admin levels?
The issue is to keep a logic that works for all countries.
We only put administrative_area_level_1...5
in the admin levels list.
Aha, understand. Maybe skip Södertälje in this case. The data from Google is not really correct. I think the rule here should be "If locality is set it should not be overridden by postal_town".
The goal of this library is to create a layer on top of (reverse) geocoding API, not fix/process/mess with the data returned by the API.
I think the rule here should be "If locality is set it should not be overridden by postal_town".
I'll make some tests for other countries in the world to see if that applies. We won't make changes that will affect every country "just" to fix a locality issue in Sweden.
Yes, understand and agree with that. However, overriding a value like this doesn't seems correct.
Searching for Pershagen returns the following json https://maps.googleapis.com/maps/api/geocode/json?address=Pershagen&key=xxx
Using the google maps provider I get the following object. The phrase Pershagen is omitted.
Searching for the similar area Ronna I get a more correct object.
When looping over address components Pershagen is first set but then overridden by Södertälje.
Reversing the array on L235 in GoogleMaps.php returns a more accurate result.
Not at all sure how this will affect other results!