Commit 5e44ddf6 authored by Eric Duminil's avatar Eric Duminil
Browse files

doc

parent dc807658
......@@ -2,6 +2,7 @@
Script to automatically add potential trees in a given region, along roads and paths.
Road information is downloaded from OpenStreetMap.
Existing trees can be imported from shapefiles if desired
Trees are exported in a CSV table, a PNG diagram and an HTML interactive map.
"""
......@@ -27,15 +28,12 @@ from import_existing_trees import get_existing_forest
# TODO: Document
# TODO: Write issue
# TODO: Write tests?
# TODO: Export shapefile?
# From RegionChooser, or https://transfer.hft-stuttgart.de/gitlab/circulargreensimcity/circulargreensimcity/-/wikis/Fallstudien/Gromb%C3%BChl
WKT = "POLYGON((9.947021 49.803063, 9.947011 49.800917, 9.955025 49.800810, 9.955110 49.803019, 9.947021 49.803063))"
# Replace with None if no existing tree should be imported
EXISTING_TREES = 'existing_trees/Trees_ideal_2_20240227.shp'
# EXISTING_TREES = 'existing_trees/baumkataster/Baum.shp'
# Fellbach
# WKT = "POLYGON((9.271353 48.811327, 9.271911 48.809010, 9.272147 48.807187, 9.275838 48.807173, 9.275602 48.806749, 9.276138 48.806325, 9.277683 48.806424, 9.277319 48.812514, 9.275581 48.811991, 9.271353 48.811327))"
EPSG_ID = 25832
# Trees will be planted every TREE_DISTANCE along roads:
TREE_DISTANCE = 10 # [m]
......@@ -75,7 +73,7 @@ def get_osm_roads(bounds):
ways = pickle.load(cache)
else:
print("Downloading data...")
# TODO: Could add trees from OSM or Bäumekataster too.
# TODO: Could add trees from OSM too.
api = overpy.Overpass()
result = api.query(f"""
way({bounds.S},{bounds.W},{bounds.N},{bounds.E}) ["highway"];
......@@ -221,7 +219,7 @@ def export_shapefile(bounds: Bounds, forest: Forest, tree_distance: float, epsg_
'Bezeichnun': t.description, 'Baumart': t.type,
'Baumhöhe': t.height, 'Kronenbrei': t.diameter,
'Stammumfan': t.trunk_diameter, 'Quelle': t.source
}
}
for t in forest]
df = pd.DataFrame.from_dict(data)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment