custom-components / places

Component to integrate with OpenStreetMap Reverse Geocode (places)
GNU General Public License v3.0
110 stars 22 forks source link

Postal Town regularly not populated #282

Closed jimmyfitz closed 3 months ago

jimmyfitz commented 3 months ago

There are a bunch of situations where Places doesn't create or populate Postal Town. I'd assumed that this is because the location doesn't know a suburb... but that's not the case because the formatted address includes the Postal Town. I'm guessing the root cause is when place type = unclassified, however it still seems like a bug not populating the Postal Town field. image

Snuffy2 commented 3 months ago

Can you provide a couple more example GPS coordinates where this isn't working. Ideally not in Parramatta.

This is because in OpenSteetMaps (OSM), this location has City defined as Sydney and then Town defined as Parramatta (see url below). Currently, the logic sets the places city attribute to the first one of these it finds: city, town, village, township, municipality, city_district. Then it sets the places postal_town attribute to the first one these it finds: suburb, city_district. Looking nearby in Oatlands, the Oatlands is set as Suburb and not Town (see url below).

Looking at the formatted address created by OSM and from what you're seeing, I need to refine the logic for postal_town. But, I want to ensure I don't break other locations nor do I want city and postal_town to show the same thing (unless appropriate).

Parramatta: https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=-33.80987&lon=151.00421&addressdetails=1&namedetails=1&zoom=18&limit=1

Oatlands: https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=-33.79316&lon=151.024912&addressdetails=1&namedetails=1&zoom=18&limit=1

Snuffy2 commented 3 months ago

I think in the Parramatta example, whoever set the details in OpenStreetMap, incorrectly set Parramatta as a Town instead of Suburb. #285 will catch this, but I need to do some more testing to ensure it doesn't also break other addresses.

You can also go in and edit OpenStreetMap to change Parramatta from a town to a suburb. https://wiki.openstreetmap.org/wiki/Tag:place%3Dsuburb https://wiki.openstreetmap.org/wiki/Tag:place%3Dtown

https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=-33.80987&lon=151.00421&addressdetails=1&namedetails=1&zoom=18&limit=1