mocnik-science / osm-python-tools

A library to access OpenStreetMap related services
GNU General Public License v3.0
441 stars 48 forks source link

building footprint #44

Closed simonmarti1992 closed 2 years ago

simonmarti1992 commented 3 years ago

Hello, thank you for his great job. My question : is it possible to access the building footprint from overpassQueryBuilder() ? somathing like overpassQueryBuilder(elementType='area', selector='"building"="yes"')

Simon

franz-benjamin commented 3 years ago

Dear Simon,

I wonder why you include elementType='area'. If I understand correctly, you want elementType='way', don't you?

Best, Franz-Benjamin

simonmarti1992 commented 3 years ago

Dear Franz-Benjamin, Thank you for your answer, I found a way to get the building footprint using something like : elementType=['way', 'relation'], selector = "building"~"^(yes|house|warehouse|apartments...)$ in the query.

One more question, is there a way to access the height of the building, using something like : overpass.query(query).elements().properties()

Best, Simon

mocnik-science commented 2 years ago

Dear Simon, You might want to run something like:

es = overpass.query(query).elements()
for e in es:
    print(e.tags())

I have not tested this code, but it should run. Best, Franz-Benjamin