Closed osmuser63783 closed 7 months ago
I should add that the above is my current theory of why it didn't work.
What I was actually trying to do was upload a GeoJSON created with Geodesk into Maproulette. When I uploaded a GeoJSON containing a number of features, Maproulette was able to turn some into tasks but not others. I noticed that all of my relations had imported correctly, but none of my ways (which were all areas). When I changed "Polygon" to "LineString" in the GeoJSON and tried again, it worked but some multipolygons (which were actually just simple polygons) did not import correctly.
I had a look at the Wikipedia page for GeoJSON and noticed the mismatch in the number of square brackets for the "coordinates" in the geometry between what is valid GeoJSON according to Wikipedia and what Geodesk outputs.
I don't think it's an issue with Maproulette because when you add an extra set of brackets it works with "Polygon".
Hope this makes sense.
Sorry, have amended the first post. Multipolygons are handled fine. Single-member MPs get turned into "Polygon" with three levels of brackets ("array of arrays of positions"). Multi-member MPs get turned into "MultiPolygon" with four. The issue I was having with multipolygons was related to my own code.
Ways that are areas get turned into Polygon with two levels only ("array of positions"). This is against the GeoJSON spec.
Haven't tested ways that aren't areas.
Nodes seem to be fine.
Thanks!
There is indeed a bug that causes incorrect GeoJSON for ways that are areas (The same bug affects WKT, but in reverse: polygons are fine, linestrings are wrong).
This is now fixed in main
and will be released in 0.1.5.
It looks like Geodesk exports OSM ways that are areas with a
geometry
of"type": "Polygon"
but gives the"coordinates"
like you would give the coordinates for aLineString
, with two levels of square brackets instead of three.Similarly, multipolygons that are areas (single-member multipolygons) get exported with ageometry
of"type": "Polygon"
but the"coordinates"
are given as if they were of typeMultiPolygon
, with four levels of square brackets instead of three.This causes MapRoulette, and possibly other tools that consume GeoJSON, to fail.