[Talk-at] Nur Oberösterreichkartendaten laden

MERIGHI Marcus mcmer-openstreetmap at tor.at
Wed Feb 22 18:32:51 UTC 2012


lukas.bischof at gmail.com (Lukas Bischof), 2012.02.22 (Wed) 11:31 (CET):
> Hat jemand von euch einen Tipp, wie das am besten geht? die XAPI gibt mir
> immer eine Zeitüberschreitung.

ich hab' gelesen, dass Du eh schon eine Loesung hast; aber fuer's Archiv
noch meine: http://wiki.openstreetmap.org/wiki/Overpass_API
Lade von dort aber nur solche Bereiche wie "Totes Gebirge" (76.4MB .osm)
oder "Muehlviertel" (104MB .osm), aber noch nie 'was groesseres. Diese
Bereiche gehen aber recht flott... (keine Zahlen, sorry). 

Untenstehend noch mein script, ich verabschiede mich schon hier, 

Pfirti, Marcus

#!/bin/sh -e
# 14.0498277 48.3033928 14.6455346 48.5420446
# lon-min    lat-min    lon-max    lat-max
# top/max    left/max   bottom/min right/min
# lon=laenge, lat=breite
lonmin="${1}"
latmin="${2}"
lonmax="${3}"
latmax="${4}"
# 
# get data of larger areas from:
# 
# http://wiki.openstreetmap.org/wiki/Overpass_API
# http://overpass.osm.rambler.ru/ (production)
# http://www.overpass-api.de/ (testing)
#
# our query will be:
# 
# union means: put all query results in to one result set 
# <union>
#  we do a even more comprehensive search than recommended in 
#  http://wiki.openstreetmap.org/wiki/Overpass_API#The_map_query
#  because simplifyway does not like missing nodes/ways.
#  
#  first get all nodes for the bbox
#  <bbox-query s="51.249" n="51.251" w="7.148" e="7.152"/>
#  get all relations from nodes; keep default variable "_" populated 
#  with bbox query by putting result into "rels"
#  <recurse type="node-relation" into="rels"/> 
#  get all ways from nodes, fill default variable "_" with result
#  <recurse type="node-way"/>
#  get all relations for just discovered ways; keep result of node-way by
#  putting new results into var "waysrels"
#  <recurse type="way-relation" into="waysrels"/>
#  finally get all nodes for these ways, accessing default variable "_" which
#  was filled by way-relation above
#  <recurse type="way-node"/>
# </union>
# we want the result with all data (user, version, timestamp, ...) so we can
# open it in JOSM and others
# <print mode="meta"/>
# 
# The attributes n and s are used for the latitudes of the
# bounding box, w and e for the longitudes. 
# s the southern limit (bottom lat)
# n the northern limit (top lat)
# w the western limit (usually lower lon)
# e the eastern limit (usually higher lon)
#
# possible values of recurse: 
# relation-relation, relation-backwards, relation-way,
# relation-node, way-node, way-relation,node-relation, node-way
#
# create the url to query
url="http://overpass.osm.rambler.ru/cgi"
url="${url}/interpreter"
url="${url}?data="
url="${url}%3Cunion%3E"
url="${url}%3Cbbox-query%20s=%22${latmin}%22%20n=%22${latmax}%22%20w=%22${lonmin}%22%20e=%22${lonmax}%22/%3E"
url="${url}%3Crecurse%20type=%22node-relation%22%20into=%22rels%22/%3E"
url="${url}%3Crecurse%20type=%22node-way%22/%3E"
url="${url}%3Crecurse%20type=%22way-relation%22%20into=%22waysrels%22/%3E"
url="${url}%3Crecurse%20type=%22way-node%22/%3E"
url="${url}%3C/union%3E"
url="${url}%3Cprint%20mode=%22meta%22/%3E"
# now get the stuff and print it to stdout
lynx -dump "${url}"
#
# does not work, ways/nodes missing
# lynx -dump "http://www.overpass-api.de/api/xapi?*[bbox=${bboxstr}][@meta]" \
# print "getting osm data from http://www.overpass-api.de/api/xapi?*[bbox=${bboxstr}][@meta]"
# print "getting osm data from http://api1.osm.absolight.net/api/0.6/map?bbox=${bboxstr}"





More information about the Talk-at mailing list