OpenStreetMap logo OpenStreetMap

The invalid areas of the map

Posted by PlaneMad on 21 June 2016 in English. Last updated on 22 June 2016.

There is some interesting research on the validity of polygons/area features mapped on OSM by Jochen Topf the creator of the osmium suite of OSM processing tools. There seems to be two major problems:

  • There exists multipolygons in OSM that have the old style tagging, with the tags on the outer way, rather than the relation
  • Polygons or multipolygons with a gemotry that is invalid, the most problematic being an unclosed area

In his usual style, there exists an in-depth explanation of the problem. Bonus is a chapter on OSM polygons and how they are rendered for GIS nerds.

Of the over 220 million (multi)polygons in OSM more than 100,000 contain mapping errors of one kind or another and about 250,000 are tagged old style with tags on the outer ways instead of on the relation making multipolygon tagging and processing much more complicated and much more expensive than it needs to be. Read more

I dug into the dump of invalid polygons and inspected it in QGIS to get an idea of the breakup of issues to see if they can be prioritized to fix:

By node count of area

There are 2500 invalid areas with over 50,000 nodes, so these are some very very large issues.

By issue type

82% of issues are role mismatches. For eg. an outer area inside an outer area, or vice versa. The next biggest issues are duplicate members or self intersection. Other issues are less than 2%.

Here is a map of all the issues. Just click on any one and you should be able to open it in JOSM for a closer look: http://osmlab.github.io/fixing-polygons-in-osm/map/

Fixing them

I tried to dig a deeper into each type of issue to understand the problem and get a sense of how it could be fixed. Feel free to explore and post your findings as well.

Role should be outer or inner

Might require manual cleanup based on context

Way Intersections

Requires manual cleanup - trivial. Requires shifting the problematic node by a small distance in the right direction to clear the error. - http://osmlab.github.io/fixing-polygons-in-osm/map/#17.64/13.05598/80.21087
screenshot 2016-06-07 19 33 40

Touching ring

Requires manual cleanup - trivial. Requires ungluing the touching node and handling like a duplicated node - http://osmlab.github.io/fixing-polygons-in-osm/map/#19.25/51.51343/-0.11559
untitled2

Relation Intersection

Requires manual cleanup - Not trivial. Needs careful modification of relation geometry and roles if multiple segments are involved. Trivial if on the same segment just like way intersection.

Inner with same tags

Could be auto cleaned - trivial. If the role is inner with the same tags as the relation, it could be considered a hole and the tag discarded.

Edits: This is not always true and it could be an error on the mappers part that would require a careful decision.

Duplicate node

Could be auto cleaned - trivial. Two nodes on the way in the exact same area. JOSM validator flags and fixes automatically.

Duplicate segment ways

Requires manual cleanup - Not trivial. There seems to be many special cases here.

Duplicate segment relations

Could be auto cleaned - trivial. Drop the duplicated member from the relation - http://osmlab.github.io/fixing-polygons-in-osm/map/#18.55/51.50511/-0.18786
screenshot 2016-06-08 17 00 51

Ring not closed

Requires manual cleanup - Not trivial. Possibly invalid, incomplete or junk data. Might need retracing, removal or adding members to incomplete relation.

Way in multiple rings

Not trivial. Might need to be remapped.

Some important features

Most of the features with issues seem to be small landuse areas. I tried to find if there was anything significant on the map that was invalid. Here are a few:

Administrative Boundaries

Notable buildings

Important parks

Natural

Open questions

  • It seems like a huge majority of the issues need to be carefully revieved by hand and cleaned up. What does a realistic approach to clean the map look like?
  • The flexibility of the current map editors allows mappers to continue to create features that dont make sense like a way tagged as a forest. Is it time for stricter validity checks on uploads?
Email icon Bluesky Icon Facebook Icon LinkedIn Icon Mastodon Icon Telegram Icon X Icon

Discussion

Comment from imagico on 21 June 2016 at 21:03

The most important measure to reduce the number of broken multipolygons would probably be to have the standard map style not render broken MPs, at least not those with serious errors. Of course if the editors do not complain and refuse to upload and the map does not render this is very confusing and frustrating for mappers so editors would also need to be diligent. Since JOSM allows editing multipolygons without downloading them in full (and it needs to - otherwise you could not edit some of the larger MPs) this would be difficult.

The error map also nicely shows my favorite

http://osmlab.github.io/fixing-polygons-in-osm/map/#10/18.9464/32.2650

probably the most broken MP existing. Here (and in quite a few other cases as well) it is fairly pointless to actually fix all the errors since newly mapping the feature in question is not much more effort and will also improve the map. Lots of errors frequently go hand in hand with poor mapping.

Comment from Mateusz Konieczny on 22 June 2016 at 09:11

“Inner with same tags Could be auto cleaned” - I would dispute this. I encountered cases where tags from inner way should be removed and cases where entire inner way should be removed.

Comment from JBacc1 on 22 June 2016 at 19:44

Hello,

Didn’t know about http://osmlab.github.io/fixing-polygons-in-osm/map/. But could you provide an «Edit in JOSM» button? If the aim is that someone clean the mess, I think such a shortcut would be more than welcome.

JB

Comment from Alan Bragg on 22 June 2016 at 20:34

This blog entry is a keeper. It will take me a while to digest, thanks for the cogent presentation.

Comment from SomeoneElse on 22 June 2016 at 21:46

You’ve said “It seems like a huge majority of the issues need to be carefully revieved by hand and cleaned up” and I think that you’re absolutely right. As Mateusz Konieczny says above, even in “straightforward” cases you need to check that any resulting tagging makes any geographical sense, even if there’s only one topological interpretation.

I’d also suggest that where a problem is fixed that it’s explained to the person who added the erroneous data in the first place what the problem is - if they don’t know that there’s a problem they’ll keep doing it.

I’d also suggest that any “fixing” changeset comments explain the problem in terms that a mapper that might have created the problem in the first place, so don’t say things like “remove self intersection of area outline” or similar.

Comment from Warin61 on 23 June 2016 at 00:03

Leaving a comment in the changeset can get the wrong response… in which case I leave it a week or two for tempers to dissipate and then make further comment .. possibly in much more detail so there is no misinterpretation. I use osminspector to monitor these in ‘my’ area. http://tools.geofabrik.de/osmi/?view=multipolygon&zoom=6

Comment from PlaneMad on 23 June 2016 at 11:11

Mateusz Konieczny: Thats right, it looks like theres always going to be cases where it would be impossible to predict what was right without a deeper investigation. Have made an edit in my post.

JBacc1: If you click on any feature you will get an Open in JOSM dialog. I’ll need to make it more explicit on the map. I guess.

Comment from JBacc1 on 23 June 2016 at 19:27

@PlaneMad: Can’t get it work. Trying to click on the elements, but just nothing happens. Firefox here.

Comment from PlaneMad on 24 June 2016 at 03:32

JBacc1: Just tested on Chrome and Safari, can you open a ticket with any console errors you are seeing here: https://github.com/osmlab/fixing-polygons-in-osm/issues

Or maybe a cache issues? I updated the map yesterday to fix this.

Comment from JBacc1 on 24 June 2016 at 03:45

Cache problem. I did not guess you just added the fonction. By the way, how often is the data updated?

Comment from PlaneMad on 24 June 2016 at 05:39

Updating the map is a manual process from the dump Jochen is generating everyday. Have not thought about an update cycle, but can do once a week till there is demand to do it more often.

Log in to leave a comment