python-overpy
python-overpy copied to clipboard
querying data from local osm file
Hi, I am trying to query the data of a specific osm file from my hard disk. Is it possible to do so directly using overpy without uploading the osm file it to a localhost? Thank you in advance.
`import overpy
with open('test.osm')) as fh: osm_data = api.parse_xml(data=fh.read(), encoding='utf-8', parser=None) `
I assume the idea of @johnbryant1 is to load a local OSM file and run queries against that (correct me if I am wrong).
I tried
with open('example.osm') as file_handle:
osm_data = api.parse_xml(data=file_handle.read(), encoding='utf-8', parser=None)
api = osm_data.api
but
api.query(query_str)
seems still to query overpass-api.de instead of running in-memory.
Hi, I'm also interested in getting overpy to work while using a local .osm file instead of the online databases. After trying the approaches of @PolyglotOpenstreetmap and @amenk, I couldn't get the query to use my local database.
Does anyone have a solution for this?
Thanks in advance.
Hello, is there any news about this issue? I'm sure it is my fault but I also tried with @PolyglotOpenstreetmap proposal and unfortunately it runs the query against the global server.
Can somebody please shed some light on this? Thank you!