New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JOSM validation: merge duplicate geometries #7
Comments
Duplicate nodes, ways and relationsWhen trying to add a geometry the first thing to do is check if a duplicate geometry already exists.
As a result a number of potentially duplicate geometries may be found. The next step is to match the tags of all of these geometries with the tags of the geometry to be added. If the tags can be merged then a duplicate is succesfully found, if the tags of none of the potentially duplicate geometries can be merged a new geometry has to be added to the output file. To create valid osm files the tags of duplicate geometries should always be merged. Note that this logic overlaps with the translation method A branch josmvalidation has been added where the above logic is implemented. |
Multipoint, multilinestring and multipolygonBoth multilinestrings and multipolygons are already supported.
Support for multipoints has been added, they will be translated to multiple nodes. CollectionsShapefile collections contain one or more points, linestrings, relations or a mix of all those types. There are presumably little to no shapefiles containing geometry collections since they will crash ogr2osm and no issue has been reported before. Current functionalityA top-level relation is created containing the nodes, ways and relations generated from the children of the collection, each with role member. Meanwhile the problem causing the crash is addressed and the role of ways has been modified to outer for the first way and inner for consecutive ways. The JOSM validator is now slightly more positive about it but this behaviour is only correct under limited circumstances. Proposed functionalityThe points and linestrings in the collection can be added to the osm file as nodes and ways, but analog to the functionality of multipoints and multilinestrings they should not be added to a parent relation. The remaining polygons can then be regarded as a multipolygon. |
All modifications regarding merging of nodes, ways and relations including their tags are implemented and merged into master. I am in the process of integration testing, everything looks fine and performance is ok as well. If no new issues arise this will become version 1.1.0. |
Story
When converting a shapefile to osm it happens that the JOSM validator reports several warnings or errors. Some common examples:
As mentioned in JOSM issue 10761, ogr2osm is responsible to avoid these errors and warnings. Just like duplicate nodes are already merged, duplicate ways and duplicate relations should be merged as well.
There is however an issue regarding tags. Currently when two duplicate nodes are merged the tags of the first node prevail while the tags of the second node are simply omitted. It would be better to keep the tags of the second node when the first node does not contain any tags. The same logic is valid for duplicate ways and duplicate relations.
Some use-cases require nodes, ways or relations not to be merged. To avoid merging nodes there is a translation method
get_unique_node_identifier
, which can be redefined to return an integer counter or a combination of coordinates and tags. Comparable method(s) must be available to disable or limit merging ways or relations.Modifications
Test cases
The text was updated successfully, but these errors were encountered: