Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Mayer
CircularGreenSimCity
Commits
50f76a62
Commit
50f76a62
authored
Mar 26, 2024
by
Eric Duminil
Browse files
Add height information
parent
a1cb6c53
Changes
3
Show whitespace changes
Inline
Side-by-side
python_scripts/add_trees_to_open_street_map/add_trees.py
View file @
50f76a62
...
@@ -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!"
)
...
...
python_scripts/add_trees_to_open_street_map/import_existing_trees.py
View file @
50f76a62
...
@@ -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
)
...
...
python_scripts/add_trees_to_open_street_map/tree.py
View file @
50f76a62
...
@@ -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
:
.
1
f
}
, Y=
{
self
.
y
:
.
1
f
}
)"
return
f
"
{
self
.
type
}
(
{
self
.
description
}
),
{
self
.
radius
}
m
radius,
{
self
.
height
}
m height,
(X=
{
self
.
x
:
.
1
f
}
, Y=
{
self
.
y
:
.
1
f
}
)"
class
Forest
(
UserList
):
class
Forest
(
UserList
):
...
...
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