You are not logged in.

#1 2020-08-26 01:31:40

tagtheworld
Member
Registered: 2012-04-25
Posts: 195

how to run the BB of a whole continent !? i s this doalbe

hi dear community



i am running some requests on overpass-turbo.eu
j am interested i getting back a overview on all hospitals in

Asia
Europe
South America:
and so forth.. and so forth

the question is: how to run the BB of a whole continent !? i s this doalbe

By the way: the whole South American Continent at oncec - with one single request:


the whole South American Continent at once...:  area["ISO3166-1
with lat long in am able to generate the map out of the results...!?

[out:csv(::id,::type,"name","addr:postcode","addr:city","addr:street","addr:housenumber","website"," contact:email=*")][timeout:600];
area["ISO3166-1"="BR"]->.brazil;
area["ISO3166-1"="AR"]->.argentina;
area["ISO3166-1"="VE"]->.venezuela;
area["ISO3166-1"="PE"]->.peru;
area["ISO3166-1"="CL"]->.chile;

btw: if i also fetch the long or lat data - then i am able to establish a stick of each hospital - and with that i can create a map!?
is this possible!?


look forward to hear form you



by the way: update: we also have got a wrapper: https://github.com/mvexel/overpass-api-python-wrapper

Getting data from Overpass: get()

Most users will only ever need to use the get() method. There are some convenience query methods for common queries as well, see below.

response = api.get('node["name"="Salt Lake City"]')
response will be a dictionary representing the JSON output you would get from the Overpass API directly.

Note that the Overpass query passed to get() should not contain any out or other meta statements. See verbosity below for how to control the output.

Another example:

>>> print [(
...     feature['properties']['name'],
...     feature['id']) for feature in response["features"]]
[(u'Salt Lake City', 150935219), (u'Salt Lake City', 585370637)]

so we can try this.

import overpass    

api = overpass.API()
query = """
[out:csv(::id,::type,"name","addr:postcode","addr:city",
"addr:street","addr:housenumber","website"," contact:email=*")][timeout:30];
area[name="Madrid"]->.a;
( node(area.a)[amenity=hospital];
  way(area.a)[amenity=hospital];
  rel(area.a)[amenity=hospital];)/>/>/>/>;
out;
"""
resp = api._get_from_overpass(query)
data = [row.split('\t') for row in resp.text.split('\n')]

...or we can try this:

api = overpass.API()
query = """
area[name="Madrid"]->.a;
( node(area.a)[amenity=hospital];
  way(area.a)[amenity=hospital];
  rel(area.a)[amenity=hospital];)/>/>/>/>;
"""
fmt = 'csv(::id,::type,"name","addr:postcode","addr:city","addr:street","addr:housenumber","website"," contact:email=*")'
data = api.get(query, responseformat=fmt)

Output:

for x in data[:5]:
    print(x)

 # ['@id', '@type', 'name', 'addr:postcode', 'addr:city', 'addr:street', 'addr:housenumber', 'website', ' contact:email=*']
 # ['597375537', 'node', 'Centro de especialidades Emigrantes', '', '', '', '', '', '']
 # ['1437313175', 'node', '', '', '', '', '', '', '']
 # ['1595068136', 'node', '', '', '', '', '', '', '']
 # ['2320596216', 'node', '', '', '', '', '', '', '']

well - running with the python wrapper against the endpoint of osm-api would be cool. I want to store the data into the db - with a wrapper or so

loook forward to hear form you

all the best to you!!!!

Last edited by tagtheworld (2020-08-26 14:49:41)


https://wiki.openstreetmap.org/wiki/User:Tagtheworld - interested in all things concerning osm especially those related to the languages Perl, PHP, Python and the databases MySQL and Postgresql.

Offline

Board footer

Powered by FluxBB