Open osmuser63783 opened 6 months ago
It looks like MapRoulette doesn't want one Feature
per line, but rather one FeatureCollection
per line (A challenge has one task per line, and each task consists of a FeatureCollection
with related features that are problematic).
With this in mind, you can't use Features.geojsonl
directly (since it outputs one Feature
per line), but you can simply wrap the GeoJSON output of the Feature
class like this:
suspects = world("na[amenity=waste_basket,toilets,bench][name]")
with open('challenge.geojsonl', 'w', encoding='utf-8') as file:
for feature in suspects:
file.write('\x1E{"type":"FeatureCollection","features":[')
file.write(str(feature.geojson(id=lambda f: f"{f.osm_type}/{f.id}")))
file.write(']}\n')
(Hex 1E is a Record Separator char which MapRoulette wants at the start of each line).
The fixes and enhancements (including functions for ID customization) are now in main
, shipping in v0.1.5 this week.
I think Geodesk has great potential for creating Maproulette challenges. You can use an Overpass query to create a challenge, but there are many things that you can't do in Overpass, or that people who are comfortable in Python but not with Overpass will find much easier to do with Geodesk.
So it would be nice to have the option of getting the GeoJSON output in the format Maproulette expects it, or having an option to get it output in that format. This would require only a few changes to the GeoJSON formatter
way/123
, notW123
MultiPolygons must have four levels of [. Alternatively, just export all OSM ways as LineString, even when they are closed, and all OSM multipolygons as MultiPolygon, even when they could be represented as a simple polygonIf I find any other differences between the format Geodesk outputs and the format Maproulette expects I'll add them here.
(I'm working with regular expressions at the moment to change e.g. the ID format and this is fine, but it did mean having to research what exactly is "wrong" with the GeoJSON output from Geodesk for the purpose of importing into Maproulette, etc. so it would be more convenient if future users don't have to do this.)