Commit 4216856f authored by Eric Duminil's avatar Eric Duminil
Browse files

Allow to import existing trees, or not

parent 59b7689f
......@@ -29,8 +29,8 @@ from import_existing_trees import get_existing_trees
# 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 = 'Trees_ideal_2_20240227/Trees_ideal_2_20240227.shp'
EXISTING_TREES = None
# WKT = "POLYGON((9.170419 48.782366, 9.170032 48.780825, 9.169904 48.780401, 9.170440 48.778733, 9.176877 48.780118, 9.177006 48.781193, 9.177049 48.782564, 9.176298 48.782593, 9.175440 48.782409, 9.174646 48.783399, 9.170419 48.782366))"
# 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))"
......@@ -103,7 +103,7 @@ def set_plot(bounds, to_local_coordinates):
def place_trees(existing_trees_coords, ways, region, to_local, tree_distance, min_distance_2):
local_region = transform(to_local.transform, region)
existing_trees = kdtree.create(existing_trees_coords)
existing_trees = kdtree.create(existing_trees_coords or [(0, 0)], dimensions=2)
tree_xs = []
tree_ys = []
......
import geopandas as gpd
def get_existing_trees(shp_input):
print(f"Importing {shp_input}")
df = gpd.read_file(shp_input)
coords = [(p.x, p.y) for p in df.geometry]
return coords
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