Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CircularGreenSimCity
CircularGreenSimCity
Commits
72ab4f60
Commit
72ab4f60
authored
Nov 12, 2024
by
Eric Duminil
Browse files
FIXME: diameter != perimeter
parent
127eb748
Changes
1
Hide whitespace changes
Inline
Side-by-side
python_scripts/add_trees_to_open_street_map/import_existing_trees.py
View file @
72ab4f60
from
pathlib
import
Path
import
geopandas
as
gpd
from
tree
import
Tree
,
Forest
from
tree
import
Forest
def
get_existing_forest
(
shp_input
):
print
(
f
"Importing
{
shp_input
}
"
)
...
...
@@ -9,17 +10,19 @@ def get_existing_forest(shp_input):
for
tree_row
in
df
.
itertuples
():
point
=
tree_row
.
geometry
added
=
forest
.
add_tree_if_possible
(
0.1
,
point
.
x
,
point
.
y
,
description
=
tree_row
.
Bezeichnun
,
diameter
=
tree_row
.
Kronenbrei
,
type
=
tree_row
.
Baumart
,
trunk_diameter
=
tree_row
.
Stammumfan
,
height
=
tree_row
.
Baumhöhe
,
source
=
Path
(
shp_input
).
name
)
description
=
tree_row
.
Bezeichnun
,
diameter
=
tree_row
.
Kronenbrei
,
type
=
tree_row
.
Baumart
,
trunk_diameter
=
tree_row
.
Stammumfan
,
# FIXME: That cannot be correct
height
=
tree_row
.
Baumhöhe
,
source
=
Path
(
shp_input
).
name
)
if
not
added
:
print
(
f
"WARNING! tree seems to be too close to others! Is it a duplicate?
\n\t
{
tree_row
}
"
)
print
(
f
"WARNING! tree seems to be too close to others! Is it a duplicate?
\n\t
{
tree_row
}
"
)
return
forest
if
__name__
==
"__main__"
:
print
(
repr
(
get_existing_forest
(
'existing_trees/Trees_ideal_2_20240227.shp'
)))
# print(repr(get_existing_forest('output/49_80081__49_803063__9_947011__9_95511_10m/trees.shp')))
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment