Opened 2 years ago
Last modified 2 years ago
#22372 new defect
Problem with GeoJSON Export for MultiPolygon or in boundaries.osm
Reported by: | anonymous | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core geojson | Version: | |
Keywords: | template_report | Cc: |
Description
What steps will reproduce the problem?
- Open this file in JOSM https://josm.openstreetmap.de/export/HEAD/josm/trunk/resources/data/boundaries.osm
- Save it as GeoJSON
- E.g. search for America or US and view the created MultiPolygon (or any other MultiPolygon country)
What is the expected result?
The MultiPolygon boundary should consist of several polygons which is a multidimensional array like this:
"geometry": { "type": "MultiPolygon", "coordinates": [ [[[-65.27974,17.56928], [-68.20301,17.83927], [-67.99519,18.97186], [-65.02435, 18.73231], [-65.27974, 17.56928]]], [[[143.82485,13.92273], [144.18594,21.03576], [146.67550,21.00809], [146.25931, 13.85876], [143.82485, 13.92273]]], ... ] }
What happens instead?
Instead the outer relations are merged into one Polygon:
"geometry": { "type": "MultiPolygon", "coordinates": [[ [[-65.27974,17.56928], [-68.20301,17.83927], [-67.99519,18.97186], [-65.02435, 18.73231], [-65.27974, 17.56928]], [[143.82485,13.92273], [144.18594,21.03576], [146.67550,21.00809], [146.25931, 13.85876], [143.82485, 13.92273]], ... ]] }
This basically says the first Polygon consists of a shell and many holes.
So IMO there are two problems here:
- the boundaries.osm uses 'way' for the member type but should probably use 'relation' to separate the polygons?
- merging the outer ways should lead to a Polygon without holes like this:
"geometry": { "type": "MultiPolygon", "coordinates": [[[ [-65.27974,17.56928], [-68.20301,17.83927], [-67.99519,18.97186], [-65.02435, 18.73231], [-65.27974, 17.56928], [143.82485,13.92273], [144.18594,21.03576], [146.67550,21.00809], [146.25931, 13.85876], [143.82485, 13.92273], ... ]]] }
Obviously the data behind this does not make much sense to consider this output correct, but IMO the 'outer' type should not create holes (only the 'inner' type should?). But maybe I misunderstood something.
Please provide any additional information below. Attach a screenshot if possible.
Relative:URL: ^/trunk Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Last:Changed Date: 2022-08-29 16:59:00 +0200 (Mon, 29 Aug 2022) Revision:18543 Build-Date:2022-08-30 01:30:57 URL:https://josm.openstreetmap.de/svn/trunk Dataset consistency test: No problems found
Attachments (0)
Change History (3)
comment:1 by , 2 years ago
Component: | Core → Core geojson |
---|
(comment copied from https://github.com/graphhopper/graphhopper/pull/2658):
Is it a bug in the JOSM export as GeoJson feature or in the actual boundaries.osm? Possibly, it is not even a bug in either of the two but the export as GeoJson feature simply doesn't work (as expected) for the boundaries.osm specifically because the latter does not consist of "normal" OSM data? I.e. JOSM doesn't know whether to export the closed ways that make up the boundary as a polyline or as a polygon because there is no area=yes or similar tagged on them?