Modify

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?

  1. Open this file in JOSM https://josm.openstreetmap.de/export/HEAD/josm/trunk/resources/data/boundaries.osm
  2. Save it as GeoJSON
  3. 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:

  1. the boundaries.osm uses 'way' for the member type but should probably use 'relation' to separate the polygons?
  2. 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 skyper, 2 years ago

Component: CoreCore geojson

comment:2 by westnordost, 2 years ago

(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?

comment:3 by karussell, 2 years ago

Ah, ok. Yes, this is then probably the case.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain team.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from team to the specified user.
Next status will be 'needinfo'. The owner will be changed from team to anonymous.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from team to anonymous. Next status will be 'assigned'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.