[GIS] OpenStreetMap Python API Bounding Box Request

openstreetmapoverpass-apipython

I am new to OSM.

When I make an API bounding box call like below:

import overpass

# bounding box coordinates
min_long = min(longs)
min_lat = min(lats)
max_long = max(longs)
max_lat = max(lats)

# query overpass within OpenStreetMap
api = overpass.API()
map_query = overpass.MapQuery(min_lat,min_long,max_lat,max_long)
response = api.Get(map_query)

The output is not wrapped. Here is a sample when I print response:

<member type="way" ref="50345468" role=""/>
<member type="way" ref="119882166" role=""/>
<member type="way" ref="7664653" role=""/>
<member type="way" ref="7661912" role=""/>
<member type="way" ref="7662660" role=""/>
<member type="way" ref="6983960" role=""/>
<member type="way" ref="6975837" role=""/>
<member type="way" ref="6982355" role=""/>
<member type="way" ref="6983849" role=""/>

Anybody have an idea of what is going on here?

Best Answer

Turns out the pip installation of the Python Overpass API is different than the current version on github. If anyone else encounters this problem, just install the github version instead.

Related Question