diff --git a/python_scripts/add_trees_to_open_street_map/add_trees.py b/python_scripts/add_trees_to_open_street_map/add_trees.py index 070b449ee2d856381f27f05f995680231926074a..00a45e8129bc9ce43b231ef7419e10b1aa4526a1 100644 --- a/python_scripts/add_trees_to_open_street_map/add_trees.py +++ b/python_scripts/add_trees_to_open_street_map/add_trees.py @@ -10,6 +10,7 @@ import pickle from pathlib import Path from collections import namedtuple, Counter import re +import math import folium import matplotlib.pyplot as plt @@ -31,9 +32,9 @@ from import_existing_trees import get_existing_forest # TODO: Write tests? # 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))" +WKT = "POLYGON((9.947021 49.803063, 9.947011 49.800917, 9.955025 49.800810, 9.955110 49.803019, 9.947021 49.803063))" # Grafenbühl -WKT = "POLYGON((9.147551 48.908059, 9.148635 48.907953, 9.149525 48.907819, 9.151177 48.907819, 9.151413 48.907840, 9.153226 48.908087, 9.153387 48.906705, 9.149160 48.906634, 9.148999 48.906620, 9.147551 48.908059))" +# WKT = "POLYGON((9.147551 48.908059, 9.148635 48.907953, 9.149525 48.907819, 9.151177 48.907819, 9.151413 48.907840, 9.153226 48.908087, 9.153387 48.906705, 9.149160 48.906634, 9.148999 48.906620, 9.147551 48.908059))" # 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' @@ -49,9 +50,9 @@ GRID = 100 # [m] # Set to -1 if you want to disable trees along the roads DEFAULT_WIDTHS = { 'unclassified': 0, -# 'residential': 8, -# 'motorway': -1, -# 'trunk': -1, + # 'residential': 8, + # 'motorway': -1, + # 'trunk': -1, } @@ -185,9 +186,9 @@ def place_trees(forest: Forest, ways: list, region: str, to_local, tree_distance color='#DFFF00', type='Fake Tree', description='Tilia tomentosa', - diameter=6, - height=10, - trunk_diameter=0.5, + diameter=6, # [m] + height=10, # [m] + trunk_diameter=50, # [cm] source='add_trees.py' ) @@ -262,8 +263,7 @@ def export_shapefile(bounds: Bounds, forest: Forest, epsg_id: int) -> None: 'x': t.x, 'y': t.y, 'Bezeichnun': t.description, 'Baumart': t.type, 'Baumhöhe': t.height, 'Kronenbrei': t.diameter, - # FIXME: Stammumfan: trunk_diameter is wrong - 'Stammumfan': t.trunk_diameter, 'Quelle': t.source + 'Stammumfan': t.trunk_diameter * math.pi, 'Quelle': t.source } for t in forest]