What's wrong with this administrative border? It seems to have all the proper tags, but doesn't appear when being plotted in an external application

The problematic boundary in question: Way: ‪Grad Zaprešić / Općina Bistra‬ (‪1067231608‬) | OpenStreetMap

It seems to have all the proper tags and that it is added to all the necessary relations. However, when I try to plot it in R, it just doesn’t appear. Here is the code from R and image that is produced.

library(osmdata)
library(sf)
library(tidyverse)
theme_set(theme_classic())

bb <- getbb("Zaprešić", featuretype = "city", format_out = "polygon")

boundaries <- getbb("Zaprešić", featuretype = "city") %>% 
  opq() %>% 
  add_osm_feature(key = "boundary", value = "administrative") %>% 
  osmdata_sf() %>% 
  trim_osmdata(bb)

ggplot(boundaries$osm_lines) +
  geom_sf()

As you can see, the top right part of the border is missing. It is likewise missing in the neigbouring municipality of Bistra:

bb <- getbb("Općina Bistra", featuretype = "city", format_out = "polygon")

boundaries <- getbb("Općina Bistra", featuretype = "city") %>% 
  opq() %>% 
  add_osm_feature(key = "boundary", value = "administrative") %>% 
  osmdata_sf() %>% 
  trim_osmdata(bb)

ggplot(boundaries$osm_lines) +
  geom_sf()

On OpenStreetMap both Zaprešić and Bistra look like their border is fully defined:

image

So I am wondering what’s wrong and what is missing here. Any help would be appreciated!

The member ways of the boundary relation were not sorted in the correct order. This may or may not mess up rendering, depending on the renderer.

Fixed in this changeset with the sort button in the JOSM relation editor: Changeset: 128050216 | OpenStreetMap

1 Like

Thank you very much for the help! I will let some time pass for the changes to take place and then see if they will be properly rendered.

I did not know that the order of the members matters, nor did I know that it can be changed. I thought they are just chronologically added there. Thank you for also providing this information!

Whilst it’s easy to sort a simple polygon, if your rendering can only cope with an ordered boundary you probably need find another one. Many boundaries are much more complicated.

Famous example - Baarle-Nassau and Baarle-Hertog.

3 Likes