Commit 36c43622 authored by Eric Duminil's avatar Eric Duminil
Browse files

Diameter != Perimeter

parent 98d27a80
...@@ -10,6 +10,7 @@ import pickle ...@@ -10,6 +10,7 @@ import pickle
from pathlib import Path from pathlib import Path
from collections import namedtuple, Counter from collections import namedtuple, Counter
import re import re
import math
import folium import folium
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
...@@ -31,9 +32,9 @@ from import_existing_trees import get_existing_forest ...@@ -31,9 +32,9 @@ from import_existing_trees import get_existing_forest
# TODO: Write tests? # TODO: Write tests?
# From RegionChooser, or https://transfer.hft-stuttgart.de/gitlab/circulargreensimcity/circulargreensimcity/-/wikis/Fallstudien/Gromb%C3%BChl # 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 # 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 # Replace with None if no existing tree should be imported
EXISTING_TREES = 'existing_trees/Trees_ideal_2_20240227.shp' EXISTING_TREES = 'existing_trees/Trees_ideal_2_20240227.shp'
# EXISTING_TREES = 'existing_trees/baumkataster/Baum.shp' # EXISTING_TREES = 'existing_trees/baumkataster/Baum.shp'
...@@ -49,9 +50,9 @@ GRID = 100 # [m] ...@@ -49,9 +50,9 @@ GRID = 100 # [m]
# Set to -1 if you want to disable trees along the roads # Set to -1 if you want to disable trees along the roads
DEFAULT_WIDTHS = { DEFAULT_WIDTHS = {
'unclassified': 0, 'unclassified': 0,
# 'residential': 8, # 'residential': 8,
# 'motorway': -1, # 'motorway': -1,
# 'trunk': -1, # 'trunk': -1,
} }
...@@ -185,9 +186,9 @@ def place_trees(forest: Forest, ways: list, region: str, to_local, tree_distance ...@@ -185,9 +186,9 @@ def place_trees(forest: Forest, ways: list, region: str, to_local, tree_distance
color='#DFFF00', color='#DFFF00',
type='Fake Tree', type='Fake Tree',
description='Tilia tomentosa', description='Tilia tomentosa',
diameter=6, diameter=6, # [m]
height=10, height=10, # [m]
trunk_diameter=0.5, trunk_diameter=50, # [cm]
source='add_trees.py' source='add_trees.py'
) )
...@@ -262,8 +263,7 @@ def export_shapefile(bounds: Bounds, forest: Forest, epsg_id: int) -> None: ...@@ -262,8 +263,7 @@ def export_shapefile(bounds: Bounds, forest: Forest, epsg_id: int) -> None:
'x': t.x, 'y': t.y, 'x': t.x, 'y': t.y,
'Bezeichnun': t.description, 'Baumart': t.type, 'Bezeichnun': t.description, 'Baumart': t.type,
'Baumhöhe': t.height, 'Kronenbrei': t.diameter, 'Baumhöhe': t.height, 'Kronenbrei': t.diameter,
# FIXME: Stammumfan: trunk_diameter is wrong 'Stammumfan': t.trunk_diameter * math.pi, 'Quelle': t.source
'Stammumfan': t.trunk_diameter, 'Quelle': t.source
} }
for t in forest] for t in forest]
......
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