Python Forum
how to retrieve datas with Overpass API python wrapper
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to retrieve datas with Overpass API python wrapper
#1
hello dear community

new to this community,

currently want to dive into Python with some real world projects + connecting to the endpoint of Overpass.
with the overpass-api-python wrapper i want to do the first steps today:

well this example code here:

import overpass
api = overpass.API()
response = api.Get('node["name"="Salt Lake City"]')
should give with this command:


print [(feature['tags']['name'], feature['id']) for feature in response['elements']]
[(u'Salt Lake City', 150935219), (u'Salt Lake City', 585370637), (u'Salt Lake City', 1615721573)]
a list of comma seperated values - is this correct.... ? i want to translate the following overopass-turbo request into the overpass-api-python wrapper.


[out:csv(::id,::type,"name","addr:postcode","addr:city","addr:street","addr:housenumber","website"," contact:email=*")][timeout:600];
{{geocodeArea:Schweiz}}->.a;
( node(area.a)[amenity=hospital];
  way(area.a)[amenity=hospital];
  rel(area.a)[amenity=hospital];);
out;
my approach;

The API object takes a few parameters:

endpoint

api = overpass.API(timeout=600)

but what with the query:

[out:csv(::id,::type,"name","addr:postcode","addr:city","addr:street","addr:housenumber","website"," contact:email=*")][timeout:600];
{{geocodeArea:Schweiz}}->.a;
( node(area.a)[amenity=hospital];
  way(area.a)[amenity=hospital];
  rel(area.a)[amenity=hospital];);
out;
HOW TO translate this into the python wrapper-request.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to retrieve records in a DataFrame (Python/Pandas) that contains leading or trail mmunozjr 3 1,748 Sep-05-2022, 11:56 AM
Last Post: Pedroski55
  SystemError: <method-wrapper '__getattribute__' of EnumMeta object sciloop 4 1,500 Jul-23-2022, 07:57 PM
Last Post: sciloop
  Using C++/CLI wrapper functions by Python Ales1000 2 1,763 Jun-21-2022, 04:50 AM
Last Post: Ales1000
  Python executable Script (Wrapper) Hwang 2 1,880 Jan-12-2022, 06:53 PM
Last Post: Hwang
  time setup for realtime plotting of serial datas at high sampling rate alice93 6 3,740 Jan-07-2022, 05:41 PM
Last Post: deanhystad
  Sqla wrapper Slojure 1 1,531 Nov-01-2021, 04:36 PM
Last Post: Larz60+
  Python C++ wrapper problem JESuh 1 2,155 Mar-30-2021, 04:37 PM
Last Post: nilamo
  getting back both: the map and the data from a request via overpass-turbo.eu apollo 0 1,562 Sep-26-2020, 11:28 AM
Last Post: apollo
  iterate and print json datas enigma619 1 1,921 Apr-01-2020, 11:48 AM
Last Post: buran
  Datas are not insert into database aravinth 1 2,193 Dec-21-2019, 04:17 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020