Fixing OSMI self intersection
Fixing Self Intersections reported by OSM Inspector
The OSM Inspector (http://tools.geofabrik.de/osmi) reports several kind of geometric errors.
Foreword to this page
This page is written by user:TheFive and on his watchlist. If you have questions or suggestions for the page, just use the discussion page, or a private message to help improving this best practices.
Feel free to make any necessary correction (it is a wiki) and if you feel like being part of the QA Team, just watch this page, to keep informed.
Self Intersections are an error, that is partially no problem for e.g. the renderers. But not all tools based on OSM Data does have the same error tolerance. In general it is better, do have a clean error free data structure, for future tools, based on OSM Date, which have not implemented this error tolerance.
More important seems the possibility to have a wide error checking tool for accidentally damage of the OSM Data. Such damage (like movement of a lot of waypoints) often comes with self intersection as an indicator. If OSM Inspector shows less errors in this category, it is easier to find such a damage, and this damage is faster corrected.
Goals of Error Fixing
This page describes typical errors found in OSM and how to fix them (in JOSM). The solutions here have two important goals.
- keep the geometry of the mapped area as it was left by the mapper before
- keep the history of the objects
If you want to fix several error in an area, so the following procedure is recommended.
OSM Inspector does not offer an "temporary fixed" feature like KeepRight, so it is relevant, to know, what errors are fixed or not.
You can zoom to the area, you want to fix, and use the permalink (lower right corner). Then you have the possibility to reload always the same area, and can to the fixing from upper left corner down to lower right one (e.g.).
It is helpful to skip not used error categories from the left site of the inspector.
If you click now on an error symbol the following steps can be done:
- The function "open data browser" for this selection allows to look, whether the object was edited after the error was calculated by OSMI, and fixed.
- With "Zoom to this selection" OSMI now show the complete wrong way and the position of the error(s) are marked.
- with "tell JOSM to open selection" the area around the wrong way is loaded to JOSM and the wrong way is selected.
The different Error Types
The 8 Area Error
Often building areas have the form of an 8. This is easy to fix.
To fix that error, select the one point together with the wrong line (see example). Then choose "split way P".
Of course: if the building is one building and has to be represented by one way, than the 8 form is wrong and the correction has to be done with more data (like Bing)
The ABA Way Error
Often short ways will be "closed" so the way is not using the point AB but it is drawn from back to A like ABA.
To fix this first drag one of the two lines a little away, so that you can click easy on the wrong way. Select the points AB (see example), choose "split way P" and delete the unnecessary part of the way. In this case no data will be lost. To keep the history of the way, choose the part of the way for deletion, that has no history, or has the ID 0. Both cases indicate, that the way generated as a new way from JOSM, and the other way will keep the history. Where applicable the new point has to be deleted.
Of course: Check the direction of the resulting way, if one of the tag is using a direction (like oneway=yes). As the information, which direction is the right, is not obvious, one can try to get it from the history of the object, or the fix can't be done, without additional information.
The ABAC Way Error
If ABA is not the whole way an has a prolongation to a C ABAC, and the first segment (regarding the direction of the way) is doulbe, splitting will resultin 3 ways, where JOSM where the AB part will keep the ID, and the BA and AC will get new IDs. So the AB part has to be integrated in the solution, to keep the history. One Solution would be to delete the BA part, and combine the rest with the shortcut "C". JOSM will ask to turn the direction of the way.
a better solution is, to turn the direction of the way before the split, to move the error to the end of the way. The way is now CABA. Now one can split the way and remove the BA part, which has no history (or the ID 0) from the end of the way. After combining CA and AB turn the direction of the way back to the original one.
The ABCBD Way Error
Areas (but not only areas) have often the form, that there is a small "way off". This results probably in moving the map while drawing the way. Sometime you have to zoom in with josm to see this effect. The Result is a line has the form ABCBD, where C is the unnecessary point.
This unnecessary point can now simply be deleted, but this can result in a situation ABBD. To avoid this, select first the C point and than the B point in JOSM. Use "Merge Points M" to "integrate the C point in B, and the result is the correct ABD way.
The ABCBCD Way Error
Often one way is not unidirectional, but 2 points in that way appears 2 times. This can affect ways and areas.
This error you can determine in JOSM with the small arrows in the way. The way is not going only in one direction, but there is a segment of the way, that is "bidirectional".
To fix that error, select the 2 points together with the wrong line (see example). Then choose "split way P". Now there are 3 Lines of that area between the points B and C. Delete 2 of them and combine the 3rd together with the rest of the way.
Be careful, if there is more than one way between the points B and C.
Variant of that Error: obviously there can be additional points between B and C, the Fix is very similar.
Inner Area retracted without Use of Multipolygon
Some Mapper use the same way for retracting the inner of an area. This is a typical Multipolygon situation.
To fix this Error one selects the "bridge points" between inner and outer and selects "split way P". Then two bridge ways are created, that can be deleted. After deletion select inner and outer of and than choose "create multipolygon shift a" to create a multipolygon. As it is recommended to put the tags of the outer way at the multipolygon, please copy these tags. Insert tags will not work for a copy of tags from outer to a multipolygon in JOSM.
This error has 2 variants
- The bride points are not unique as in this example
In this case one has first to produce this 2 unique bridge points, to insure that the resulting inner and outer are closed in future.
- There exits other areas, with are exact the inner of the area
In this case these Areas can directly be used, and the first inner is not needed.
Crop circle (Potlach circles, that go several ways round)
A sometimes occurring error are circles (edited with the make circular function from Potlatch) that goes several times round.
A suggestion to fix this error (improvement of this suggestion please on the discussion page) is first to take the ways ending on the circle away from that circle with "unglue ways G". Put the End near the circle to merge the nodes after the operation
Choose one point of the circle an - with installed untilsplugin2 - select the neighborhood nodes with "E" so often, until the necessary numbers of unused circles is selected. Now delete the nodes, and merge the lines unglued in step 1.
You can find a discussion to this error and a link to trac here: http://forum.openstreetmap.org/viewtopic.php?id=12778