The OGC Simple Feature spec says that the rings making up the boundaries of a polygon must be closed and simple, and its definition of "simple" includes that the ring may not pass through the same point more than once (except at the ends). However, Mapnik happily renders such polygons, for example (at the time of writing this) way 447865387, which uses node 4449293245 twice. Should I fix my import pipeline to convert this into a multipolygon (or simply two polygons) before loading it into PostGIS, or should I fix the data to remove the self-intersection? asked 13 Aug '18, 11:21 turepalsson |
Self intersection is an error in the OSM data model too (insofar we actually have a notion of such), however most tools will undertake an effort to process not quite valid objects. In summary IMHO you should fix the object in question in OSM. More reading: https://wiki.openstreetmap.org/wiki/Relation:multipolygon#Valid_Multipolygon_conditions answered 13 Aug '18, 11:40 SimonPoole ♦ For multipolygon, the wiki (https://wiki.openstreetmap.org/wiki/Relation:multipolygon/validity) explicitly allows some self-intersections. Perhaps that should be changed?
(13 Aug '18, 11:47)
turepalsson
I would consider the first variant "wrong" too, the thing is, as already mentioned there is no validation on input so you can essentially construct lots of things that you shouldn't do. JOSM will complain about a self-intersecting way in any case. Note https://wiki.openstreetmap.org/wiki/Relation:multipolygon/validity has essentially had one editor that added the original content 6 years ago, we would need to discuss if ire represents current thinking.
(13 Aug '18, 14:46)
SimonPoole ♦
|
"However, Mapnik happily renders such polygons," I don't think it does: https://www.openstreetmap.org/way/447865387#map=19/63.27383/18.67055
@DaveF: Hm, no, you're right. My bad. What about this one, then? It has a "pocket" in it, but looks like it's rendering: https://www.openstreetmap.org/way/481643030