Commit 50f76a62 authored by Eric Duminil's avatar Eric Duminil
Browse files

Add height information

parent a1cb6c53
...@@ -145,6 +145,7 @@ def place_trees(forest, ways, region, to_local, tree_distance, min_distance_2) - ...@@ -145,6 +145,7 @@ def place_trees(forest, ways, region, to_local, tree_distance, min_distance_2) -
type='Fake Tree', type='Fake Tree',
description='Tilia tomentosa', description='Tilia tomentosa',
diameter=6, diameter=6,
height=10,
source='add_trees.py' source='add_trees.py'
) )
...@@ -234,7 +235,7 @@ def export_shapefile(bounds: Bounds, forest: Forest, tree_distance: float, epsg_ ...@@ -234,7 +235,7 @@ def export_shapefile(bounds: Bounds, forest: Forest, tree_distance: float, epsg_
basename = get_basename(bounds) basename = get_basename(bounds)
shp_dir = OUTPUT_DIR / basename shp_dir = OUTPUT_DIR / basename
shp_dir.mkdir(exist_ok=True) shp_dir.mkdir(exist_ok=True)
gdf.to_file(shp_dir / f"trees.shp") gdf.to_file(shp_dir / f"trees.shp", encoding='UTF-8')
print(" DONE!") print(" DONE!")
......
...@@ -13,6 +13,7 @@ def get_existing_forest(shp_input): ...@@ -13,6 +13,7 @@ def get_existing_forest(shp_input):
diameter=tree_row.Kronenbrei, diameter=tree_row.Kronenbrei,
type=tree_row.Baumart, type=tree_row.Baumart,
trunk_diameter=tree_row.Stammumfan, trunk_diameter=tree_row.Stammumfan,
height=tree_row.Baumhöhe,
source=Path(shp_input).name source=Path(shp_input).name
)) ))
return Forest(trees) return Forest(trees)
......
...@@ -8,8 +8,8 @@ class Tree: ...@@ -8,8 +8,8 @@ class Tree:
x: float x: float
y: float y: float
diameter: float diameter: float
height: float
z: float = 0 z: float = 0
height: float = None
trunk_diameter: float = None trunk_diameter: float = None
type: str = None type: str = None
description: str = '?' description: str = '?'
...@@ -27,7 +27,7 @@ class Tree: ...@@ -27,7 +27,7 @@ class Tree:
return self.diameter / 2 return self.diameter / 2
def __str__(self): def __str__(self):
return f"{self.type} ({self.description}), {self.radius} m (X={self.x:.1f}, Y={self.y:.1f})" return f"{self.type} ({self.description}), {self.radius} m radius, {self.height} m height, (X={self.x:.1f}, Y={self.y:.1f})"
class Forest(UserList): class Forest(UserList):
......
Markdown is supported
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