Closed (fixed)
Project:
Geocoder
Version:
8.x-4.26
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Mar 2025 at 15:59 UTC
Updated:
18 Mar 2025 at 17:49 UTC
Jump to comment: Most recent
Since the fix of the parent bug report, Geocoder uses the 'code' field for administrative_area. This field can be empty, as seen in the screenshot (coordinates in Europe, Nominatim provider), even though the 'name' field might contain data.

Use Nominatim provider. Set a breakpoint at line 79 of DumperPluginManager.php, and see that the 'code' field is empty.
Change the code: use the 'code' field if it's not empty, otherwise use the 'name' field if it's not empty.
if (!empty($geojson_array['properties']['adminLevels'])) {
$administrative_area_array = array_shift($geojson_array['properties']['adminLevels']);
if(!empty($administrative_area_array['code'])) {
$administrative_area = $administrative_area_array['code'];
} elseif(!empty($administrative_area_array['name'])) {
$administrative_area = $administrative_area_array['name'];
}
| Comment | File | Size | Author |
|---|---|---|---|
| geocoder_dumperpluginmanager.png | 158.9 KB | ovquiaf |
Comments
Comment #3
itamair commentedthanks @ovquiaf ... Qa and Tested what you say and it makes sense to me.
Committed into dev (with some better ternary operator implementation) is going to be part of the news (incoming) Geocoder release.
Comment #4
ovquiaf commentedThanks for implementing it, I wasn't sure how to contribute a patch, or how verbose the code should be. Looking forward to the release!