NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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's gravatar image

turepalsson
836101625
accept rate: 25%

edited 13 Aug '18, 11:22

"However, Mapnik happily renders such polygons," I don't think it does: https://www.openstreetmap.org/way/447865387#map=19/63.27383/18.67055

(13 Aug '18, 16:22) DaveF

@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

(13 Aug '18, 18:58) 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

permanent link

answered 13 Aug '18, 11:40

SimonPoole's gravatar image

SimonPoole ♦
44.7k13326701
accept rate: 18%

edited 13 Aug '18, 14:47

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 ♦

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×92
×18

question asked: 13 Aug '18, 11:21

question was seen: 1,468 times

last updated: 13 Aug '18, 18:58

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum