-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make usage of landuse. FIRST: you need to fetch osm data whrer landus…
…e is not null!
- Loading branch information
Robert John
committed
Aug 16, 2023
1 parent
3b50f4f
commit 35b4d8a
Showing
4 changed files
with
73 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# landuse has to be fetched and stored in DB as selct * from osm data where osmdata.landuse is not null; | ||
|
||
class Landuse(Base): | ||
"""Landuse Model""" | ||
|
||
__tablename__ = "landuse" | ||
|
||
osm_id = Column(Integer, primary_key=True) | ||
landuse = Column(String(50)) | ||
natural = Column(String(50)) | ||
geometry = Column(Geometry('POLYGON')) | ||
area = Column(Float) | ||
|
||
|
||
|
||
def get_osm_landuse(geo_area, session_osm): | ||
""" load ways from db for given polygon as geo_area_wkt """ | ||
|
||
landuse = session_osm.query(Landuse).filter( | ||
func.st_intersects(func.ST_GeomFromText(geo_area, srid), Landuse.geometry)) | ||
|
||
landuse_sql_df = pd.read_sql( | ||
landuse.statement, | ||
con=session_osm.bind) | ||
# con=engine_osm both ways are working. select the easier/ more appropriate one | ||
return landuse_sql_df |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters