Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GeoJSON export #20

Open
1ec5 opened this issue Aug 6, 2020 · 2 comments
Open

GeoJSON export #20

1ec5 opened this issue Aug 6, 2020 · 2 comments

Comments

@1ec5
Copy link
Member

1ec5 commented Aug 6, 2020

The Download menu offers JSON as an export format, but that format represents geodata as WKT strings, whereas many OSM-related tools consume GeoJSON. It would be handy to be able to export GeoJSON directly from Sophox. Like the Map view, the features could come from the first WKT-formatted column, and all the other columns could become properties of those features.

@1ec5
Copy link
Member Author

1ec5 commented Aug 6, 2020

A workaround is to transform the JSON into GeoJSON on the command line using a tool like jq. For instance, this command creates GeoJSON (with formatting compatible with the simplestyle specification) from a query that was formatted to work with the Map view:

jq '{type: "FeatureCollection", features: map({type: "Feature", properties: {name: .name, type: .layer, "marker-size": "small", "marker-color": ("#" + .rgb)}, geometry: {type: "Point", coordinates: (.coordinates | match("Point\\(([-.\\d]+) ([-.\\d]+)\\)").captures | map(.string | tonumber))}})}' query.json > query.geojson

@1ec5
Copy link
Member Author

1ec5 commented Sep 16, 2020

@nonoumasy pointed out that csv2geojson is another command-line tool that can transform Sophox’s CSV output into GeoJSON.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant