geocoder-php / geocoder-php/Geocoder
[Nominatim] Municipality not in list of 'localityFields'
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 4k
- Forks
- 525
- Avg merge
- 8m
- Merged PRs (30d)
- 1
Description
I came across some reverse geocoding results where Nominatim.php didn't return a 'locality'. In my opinion, this latlng query should have 'Purmerend' as its locality, as it's the municipal boundary:
https://nominatim.openstreetmap.org/ui/reverse.html?lat=52.50741&lon=4.93279&zoom=18
https://nominatim.openstreetmap.org/ui/details.html?osmtype=W&osmid=6593763&class=highway
Upon debugging, I noticed that inside jsonResultToLocation(), on line 209, 'municipality' was not considered a 'locality'.
$localityFields = ['city', 'town', 'village', 'hamlet'];
Is this a matter of definition?
Adding 'municipality' fixes my issue:
$localityFields = ['city', 'town', 'village', 'hamlet', 'municipality'];
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Nominatim.php at jsonResultToLocation(), around line 209, and inspect how localityFields are used for the supplied reverse-geocoding result. Confirm that the municipality value from the Purmerend example is returned as locality, and verify the existing behavior remains correct for the other listed locality fields.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100