osm-without-borders / cosmogony

easy to use & easy to update geographic regions
http://cosmogony.world
Apache License 2.0
103 stars 15 forks source link

India and Bangladesh are missing when running on planet.pbf #115

Open blaenk opened 3 years ago

blaenk commented 3 years ago

I think this may be an issue in https://github.com/Qwant/osm_boundaries_utils_rs but I'm reporting here to bring it to your attention, I'm happy to close it if you think it should only exist there.

I realized that ZoneType=Country zones were missing for India and Bangladesh. In fact, it seems much more is missing, possibly because the larger country boundary is missing?

I'm reporting this not as a matter of pedantic precision but with the intention to alert you that it seems this entire area (India/Bangladesh) is missing.

image

Note however that the flanking islands are present:

image

For Bangladesh, the only part that is present is this little chunk (osm id: relation:3921211, specifically this chunk, name: রংপুর বিভাগ). Interestingly, I think it is precisely one of those enclaves (not sure)

image

I think it may be related to many enclaves being present between India and Bangladesh. See this wikipedia article, in fact there are even counter-counter enclaves, see this diagram on wikipedia:

image

The interesting thing is that southern Netherlands at the border with Belgium there are some enclaves as well but those seem to be handled fine (Yellow is the Netherlands and green is Belgium). Maybe it has to do with there being counter and counter-counter enclaves in India/Bangladesh? Wikipedia seems to claim they both create the only counter-counter enclave in the world.

image

I think this is just not supported right now?

https://github.com/Qwant/osm_boundaries_utils_rs/blob/master/src/boundaries.rs#L143-L144

I did notice that for example has a role of subarea within Bangladesh, and subarea is not in the list of roles to extract here, might it be as simple as adding it?

amatissart commented 3 years ago

Thanks for your feedback. On which date was generated the planet file you used as the input ? The most common cause for this kind of issues is that some multipolygons have been broken in OSM. By any chance, do you stll have logs from your run where we could find more details about the boundary parts that would be broken ?

There have been several suspicious edits on India relation recently. On 2021-03-05 in changeset 100473803, the admin_level value for India has been modified from 2 to 4. That alone may explain why India is no longer considered as a country by Cosmogony.

The diagram from the Wikipedia article refers to former enclaves that have been exchanged in 2015. They are now greatly simplified:

Since the exchange of territory took place, the only remaining enclave is Dahagram–Angarpota, an exclave of Bangladesh.

So the limitations of the algorithm should not be an issue with current boundaries. And this kind of "third-order enclave" should not break the whole polygon anyway.

Boundaries relations with role subarea are not used indeed. But that's actually on purpose. "osm_boudaries_utils" builds a multipolygon by iterating though member ways with role inner or outer. These are the minimum roles that are required to form a valid multipolygon in OSM.
Subareas relations can also be defined as members of the parent relation but they optional and cannot be substituted for member ways. See https://wiki.openstreetmap.org/wiki/Relation:boundary for more details.