tyrasd / osmtogeojson

convert osm to geojson
http://tyrasd.github.io/osmtogeojson/
MIT License
694 stars 113 forks source link

How to convert overpass json #47

Closed dcdieci closed 8 years ago

dcdieci commented 8 years ago

Hi, I am kind of confused since the cli tool and the browser script are supposed to convert overpass json to geojson right. I just don't get any results when running this query: http://overpass-api.de/api/interpreter?data=[out:json];way[%22piste:type%22](46.983414,10.198059,47.094289,10.38414);out;

and then converting to geojson via cli returns an empty feature set osmtogeojson lopes.json > slopes.geojson How is this supposed to work?

tyrasd commented 8 years ago

you're only querying and returning ways which don't include any geometry information by themselves. You have to either use a recursion operator to fetch also the ways' nodes (e.g. by adding a >;out skel; at the end of your query), or use the out geom; output mode to fetch ways with full inline geometry:

wget -O- "http://overpass-api.de/api/interpreter?data=[out:json];way[%22piste:type%22](46.983414,10.198059,47.094289,10.38414);out%20geom;" | osmtogeojson