Opened 4 years ago
Last modified 3 years ago
#19822 closed enhancement
Inconsistent behavior with GeoJSON multipolygons — at Version 3
Reported by: | Mashin | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 20.11 |
Component: | Core geojson | Version: | latest |
Keywords: | GeoJSON, multipolygons | Cc: |
Description (last modified by )
What steps will reproduce the problem?
Load this .osm file in JOSM:
<?xml version='1.0' encoding='UTF-8'?> <osm version='0.6' upload='false' generator='JOSM'> <node id='-2596285' lat='41.52291460368' lon='-73.46584481969' /> <node id='-2596286' lat='41.52291328204' lon='-73.46546705281' /> <node id='-2596287' lat='41.52275043969' lon='-73.46546806918' /> <node id='-2596288' lat='41.52275176133' lon='-73.46584583606' /> <node id='-2596289' lat='41.5228742736' lon='-73.46577875582' /> <node id='-2596290' lat='41.52287126667' lon='-73.46556991097' /> <node id='-2596291' lat='41.52279212833' lon='-73.46557194371' /> <node id='-2596292' lat='41.52279513526' lon='-73.46578078856' /> <way id='-132026' action='modify'> <nd ref='-2596285' /> <nd ref='-2596286' /> <nd ref='-2596287' /> <nd ref='-2596288' /> <nd ref='-2596285' /> <tag k='name' v='part_outer' /> </way> <way id='-132027' action='modify'> <nd ref='-2596289' /> <nd ref='-2596290' /> <nd ref='-2596291' /> <nd ref='-2596292' /> <nd ref='-2596289' /> <tag k='name' v='part_inner' /> </way> <relation id='-99881'> <member type='way' ref='-132026' role='outer' /> <member type='way' ref='-132027' role='inner' /> <tag k='name' v='part_multipolygon' /> <tag k='type' v='multipolygon' /> </relation> </osm>
- Save as geoJSON file
- Load the geoJSON file
What is the expected result?
I would expect that when I am loading the geoJSON file, I would get the same data representation as in case of the .osm file. That means only TWO polygons ("part_outer", "part_inner") and they both would be part of a multipolygon relation.
What happens instead?
I get FOUR objects: TWO polygons ("part_outer", "part_inner") and TWO duplicate polygons that are bound in multipolygon relation.
Please provide any additional information below. Attach a screenshot if possible.
I am no expert in this and GeoJSON definition is not very specific how the object should be represented. (What if I actually want to have duplicated polygons on top of each other? How would GeoJSON code differ from this case?) But I think that since OSM default is to reuse objects rather than having multiple copies at the same place, and JOSM validator flags such duplicated cases as warning, the default should be to merge duplicate features if possible.
Btw. GeoJSON specification allows in such simple cases (one outer ring and one or more holes) to use feature type "Polygon", while JOSM exports them all as "MultiPolygon". No big deal just wanted to mention that this duplication happens in both of these cases.
If this is indeed an erroneous behavior would it please be possible to make the fix into the earliest JOSM release? This is really complicating imports where one has to tediously fix these before upload.
Thank you!
URL:https://josm.openstreetmap.de/svn/trunk Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Last:Changed Date: 2020-09-06 16:54:59 +0200 (Sun, 06 Sep 2020) Build-Date:2020-09-07 01:30:48 Revision:17013 Relative:URL: ^/trunk Identification: JOSM/1.5 (17013 en) Mac OS X 10.15.6 OS Build number: Mac OS X 10.15.6 (19G2021) Memory Usage: 829 MB / 1820 MB (624 MB allocated, but free) Java version: 1.8.0_261-b12, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM Look and Feel: com.formdev.flatlaf.FlatDarkLaf Screen: Display 69733632 1440x900 (scaling 1.0x1.0) Maximum Screen Size: 1440x900 Best cursor sizes: 16x16 -> 16x16, 32x32 -> 32x32 VM arguments: [-Djava.security.policy=file:<java.home>/lib/security/javaws.policy, -DtrustProxy=true, -Djnlpx.home=<java.home>/bin, -Djava.security.manager, -Djnlpx.origFilenameArg=${HOME}/Library/Application Support/Oracle/Java/Deployment/cache/6.0/56/1ee8cfb8-2bc3e844, -Djnlpx.remove=false, -Dsun.awt.warmup=true, -Djava.util.Arrays.useLegacyMergeSort=true, -Djnlpx.heapsize=NULL,2048m, -Dmacosx.jnlpx.dock.name=JOSM, -Dmacosx.jnlpx.dock.icon=${HOME}/Library/Application Support/Oracle/Java/Deployment/cache/6.0/25/4c122699-4466e0ba.icns, -Djnlp.application.href=https://josm.openstreetmap.de/download/josm.jnlp , -Djnlpx.jvm="<java.home>/bin/java"] Plugins: + FastDraw (35499) + MicrosoftStreetside (35248) + PicLayer (35405) + apache-commons (35524) + apache-http (35092) + buildings_tools (35500) + changeset-viewer (22) + editgpx (35248) + ejml (35313) + flatlaf (35541) + geotools (35169) + javafx-osx (35458) + jaxb (35092) + jna (35092) + jts (35122) + log4j (35092) + merge-overlap (35248) + opendata (35513) + poly (35248) + reltoolbox (35529) + reverter (35499) + terracer (35499) + utilsplugin2 (35487) Tagging presets: + https://josm.openstreetmap.de/josmfile?page=Presets/Freemap&preset&zip=1 + https://josm.openstreetmap.de/josmfile?page=Presets/Golf_Course&zip=1 + https://josm.openstreetmap.de/josmfile?page=Presets/hiking_routes_with_trail_marking&zip=1 + https://josm.openstreetmap.de/josmfile?page=Presets/SentieriItaliani&zip=1 Map paint styles: - https://josm.openstreetmap.de/josmfile?page=Styles/LessObtrusiveNodes&style&zip=1 - https://github.com/simon04/coloured-addresses.mapcss/raw/master/dist/coloured-addresses.mapcss - https://josm.openstreetmap.de/josmfile?page=Styles/ParkingLanes&style&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/Lane_features_ryg&style&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/Lane_features&style&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/Lane_and_Road_Attributes&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/Cycleways&style&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/Sidewalks&style&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/Maxspeed&style&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/LitObjects&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/Lit&style&zip=1 + https://josm.openstreetmap.de/josmfile?page=Styles/Osmc&style&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/SlovakiaBicycleRoutes&style&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/Coloured_Streets&style&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/Maxspeed&zip=1 - https://github.com/TelenavMapping/Community_MapRoulette/blob/master/maxspeed.mapcss + ${HOME}/Documents/Results/Scripts/JOSM_style/AreaHighway.mapcss Last errors/warnings: - 00007.047 W: Not a single layer for the name 'MapBox Satellite': [] - 00007.047 W: Not a single layer for the name 'MapBox Satellite': [] - 00007.939 W: Failed to parse Mappaint styles from 'https://github.com/TelenavMapping/Community_MapRoulette/blob/master/maxspeed.mapcss'. Error was: Encountered " "<" "< "" at line 6, column 1. - 00007.941 E: org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException: Encountered " "<" "< "" at line 6, column 1. - 00009.522 W: Cannot lock cache directory. Will not use disk cache - 00013.153 W: Cannot start IPv4 remotecontrol server on port 8111: Address already in use (Bind failed) - 00013.154 W: Cannot start IPv6 remotecontrol server on port 8111: Address already in use (Bind failed)
Change History (3)
comment:1 by , 4 years ago
comment:2 by , 4 years ago
Oh thanks, that's useful to know.
Is there any chance this import of multipolygons duplication will be fixed? I would assume that the fix would be similar to (#19041).
comment:3 by , 4 years ago
Description: | modified (diff) |
---|
The result of the export depends on the expert preference
geojson.export.untagged-closed-is-polygon
. I think you get what you expect when you set it to true.See also #18902