I am working on importing a number of ways obtained as a result of vectorizing of a raster map. Because of the nature of the source data and as a result of chosen curve smoothing algorithm there are many cases when a single way intersects itself. In general, self-intersection has no automatic resolution in e.g. JOSM and requires human intervention, which in my case would be many hundreds of edits. However, in my case it is always a very specific type of self-intersection that should rather be described as a "self-touching way". Let me illustrate it. On the image above pay attention that there is a node an the intersection point, at direction of individual segments make it so that the right part of the "eight"-like figure touches the left part of it in that point. So it is not two duplicate notes (different IDs but same coordinates) but rather a single node (the same ID) that is present two times in a same way. Inspecting the OSM XML confirms this observation. An algorithmic solution that is possible in this case is to remove one occurrence of that repeating node from the way. The result of such transformation for my example is below: This transformation reaches the goal of preserving a "waistline" in the eight-shaped polygon, only making it slightly "thicker". This is an acceptable approximation given the resolution of the original raster data and noise already present in it. The same effect can be achieved manually: a) duplicate the node, b) delete one of the copied nodes. Such a solution is fine for my application and is guaranteed to create no new self-intersections because of the way the polygon is oriented (orientation of the top circle and the bottom circle always match). I can come up with a solution that involves scripted editing of the underlying OSM-XML (see my own answer below). But I wonder if there are solutions to do it automatically without the need to export to OSM format, e.g. directly in the JOSM editor. P.S. An alternative solution is to create two independent ways touching each other at the central node (upper circle and a lower circle). It is a bit harder to do when editing an XML in a sense that new ways have to be allocated, but is also acceptable for me if there are ready tools to do that. asked 04 Apr '19, 09:40 Atakua |
My own solution so far is to export the JOSM layer into an OSM XML file. Then to use a scripted language capable of processing XML (Python or any other really) to open the file and do the following.
As I mentioned already, applying such script requires exporting data from JOSM, processing it and then reopening it in JOSM for further processing and uploading to the database. answered 04 Apr '19, 09:46 Atakua 1
Has your import actually gone through this process https://wiki.openstreetmap.org/wiki/Import/Guidelines ?
(04 Apr '19, 10:50)
SimonPoole ♦
@SimonPoole Steps 1 to 3 of that processes are done, now at step 4 "Documentation". Tracked by me and others here: https://wiki.openstreetmap.org/wiki/WikiProject_Sweden/naturvardsverket_import . Resolution of technical issues to understand if it is at all doable, which this question is actually about, is being done in parallel.
(04 Apr '19, 11:16)
Atakua
|