[OSM-talk] Extracting railways online: Overpass or locally e.g. Spatialite?
Stefan Keller
sfkeller at gmail.com
Mon Jan 21 14:35:47 GMT 2013
Hi,
I'd like to extract all railways (i.e. railway=rail ) within a
bounding box as polylines - meaning ways including nodes with
coordinates.
The resulting format can either be GeoJSON or any XML.
Can I do that with Overpass? Or do I need to do it locally e.g. with Spatialite?
BBox is Switzerland: 45.8/5.95, 47.83/10.51 having a center point
around 46.815/8.23 (lat/lon).
That's what I tried with Overpass without success so far (got this
from the docs here [1]):
1. This works - but result is in the browser and it start with strange
zoom/center ("&zoom=10&lat=46.815&lon=8.23" not recognized) (and
caution: needs memory!):
http://overpass-api.de/api/convert?data=way[railway="rail"](45.8,5.95,47.83,10.51);(._;node(w););out;&target=openlayers&zoom=10&lat=46.815&lon=8.23
2. This returns JSON including nodes/coordinates - but I'd like polylines:
http://overpass.osm.rambler.ru/cgi/interpreter?data=[out:json];way[railway="rail"](50.7,7.1,50.8,7.25);(._;node(w););out;
3. I also tried this with curl and a POST to
http://overpass-api.de/api/interpreter,, but get "Bad Request HTTP
ERROR 400"
<osm-script>
<query type="way">
<has-kv k="railway" v="rail"/>
<bbox-query e="5.95" n="45.8" s="47.83" w="10.51"/>
</query>
<print/>
</osm-script>
Any help?
Yours, Stefan
[1] http://wiki.openstreetmap.org/wiki/Overpass_API/Language_Guide#Streets_and_other_ways
More information about the talk
mailing list