[openstreetmap/openstreetmap-website] admin_level in search results sometimes off by one (Issue #6870)
emvee-osm
notifications at github.com
Sat Mar 7 17:47:07 UTC 2026
emvee-osm created an issue (openstreetmap/openstreetmap-website#6870)
### URL
https://www.openstreetmap.org/search?query=Sluis
### How to reproduce the issue?
In the [search results for Sluis](https://www.openstreetmap.org/search?query=Sluis) you see:
<img width="312" height="130" alt="Image" src="https://github.com/user-attachments/assets/c515d067-0789-44a1-af11-f4af0856a1a4" />
But the tags for [the object](https://www.openstreetmap.org/relation/295460) has `admin_level=8`.
Issue found by [IIVQ on the OSM forum](https://community.openstreetmap.org/t/korte-vragen-met-hopelijk-een-kort-antwoord/127479/337).
Sometimes because the [search for Abriès-Ristolas](https://www.openstreetmap.org/search?query=Abri%C3%A8s-Ristolas) gives `(Level 8)` what is in line with the tagging of [the object](https://www.openstreetmap.org/relation/8845466): `admin_level=8`.
I [did some investigation](https://community.openstreetmap.org/t/korte-vragen-met-hopelijk-een-kort-antwoord/127479/354) on the differences between these objects:
<img width="399" height="116" alt="Image" src="https://github.com/user-attachments/assets/3a090146-54cb-4abd-b124-742db35e5946" />
As far as I can see the difference in `admin_type:FR` and `authoritative` can not explain the difference what there are differences in the Nomination results, [Sluis](https://nominatim.openstreetmap.org/ui/details.html?osmtype=R&osmid=295460) en [Abriès-Ristolas](https://nominatim.openstreetmap.org/ui/details.html?osmtype=R&osmid=8845466). No difference in Admin Level but the Search Rank and Address section is different.
I did have a look at the code, [app/assets/javascripts/index/query.js](https://github.com/openstreetmap/openstreetmap-website/blob/bfa93794a6be5d02b3a9b024de8b88efd212e024/app/assets/javascripts/index/query.js#L87):
```javascript
function featurePrefix(feature) {
const tags = feature.tags;
let prefix = "";
if (tags.boundary === "administrative" && (tags.border_type || tags.admin_level)) {
prefix = OSM.i18n.t("geocoder.search_osm_nominatim.border_types." + tags.border_type, {
defaultValue: OSM.i18n.t("geocoder.search_osm_nominatim.admin_levels.level" + tags.admin_level, {
defaultValue: OSM.i18n.t("geocoder.search_osm_nominatim.prefix.boundary.administrative")
})
});
```
But that can not explain the difference.
What is also remarkable is the [the language files](https://github.com/openstreetmap/openstreetmap-website/blob/master/config/locales/) have:
```
admin_levels:
level2: "International Boundary"
level3: "Administrative Boundary (Level 3)"
level4: "Administrative Boundary (Level 4)"
level5: "Administrative Boundary (Level 5)"
level6: "Administrative Boundary (Level 6)"
level7: "Administrative Boundary (Level 7)"
level8: "Administrative Boundary (Level 8)"
level9: "Administrative Boundary (Level 9)"
level10: "Administrative Boundary (Level 10)"
level11: "Administrative Boundary (Level 11)"
```
i.e. the labels do not start at level1 but this again can not explain the difference and this would result in the level being one to high instead of one to low...
### Screenshot(s) or anything else?
_No response_
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/6870
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/issues/6870 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260307/3522e0a0/attachment.htm>
More information about the rails-dev
mailing list