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, 15:20

Chris_Ali_del_Vari's gravatar image

Chris_Ali_de...
1112
accept rate: 0%


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).

permanent link

answered 26 May, 17:32

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
70.9k836431106
accept rate: 24%

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, 22:30) Chris_Ali_de...
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×45
×43
×6
×2
×1

question asked: 26 May, 15:20

question was seen: 296 times

last updated: 30 May, 22:30

powered by OSQA