Hey guys, I am looking for a function in python that has only latitude and longitudes as input values and gives me the landuse as output value. It is basically enough to know if the location is in a building or not. The type of building is not so important. I already checked in the osmnx library based on Open Street Map, but couldn't find anything that matches my question. But maybe osmnx already offers the solution and I did not see it. The solution should be something like: landuse = ??function??(lat, lon) And than the output might be "residential_building" or "agricultural_open_area". I am glad for any helps Greetings Chris
This question is marked "community wiki".
asked 26 May '19, 15:20 Chris_Ali_de... |
You could do it with Overpass (same as the web site does when you click somewhere with the question mark icon) though if you'd like to run this more frequently, using Overpass runs the danger of making the server unusable for others. Therefore you'll want to load the OSM data into your own PostGIS database with osm2pgsql. Then you can make queries like SELECT "natural",landuse,building FROM planet_osm_polygon WHERE ST_Contains(way, ST_MakePoint(lon,lat)) (note that for this query to work, you need to run osm2pgsql with -l option, or you might need a ST_Transform around your ST_MakePoint). answered 26 May '19, 17:32 Frederik Ramm ♦ Thank You for the fast answer. I am sure the way You described works well. Unfortunatly I don't know much about Overpass and don't know how to integrate it into Python, so I am trying a different approach with a downloaded .shp file from the city and the sjoin command of the geopanda tools. Got the approach from a Youtube Tutorial and it seems to work for me as well: https://www.youtube.com/watch?v=HzPSVwyP2Y0
(30 May '19, 22:30)
Chris_Ali_de...
|