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
14a13f4b
Commit
14a13f4b
authored
Nov 20, 2024
by
Eric Duminil
Browse files
Export to CSV automatically
parent
d37cd341
Changes
2
Hide whitespace changes
Inline
Side-by-side
python_scripts/add_trees_to_open_street_map/add_trees.py
View file @
14a13f4b
...
...
@@ -25,6 +25,7 @@ import geopandas as gpd
from
tree
import
Forest
from
import_existing_trees
import
get_existing_forest
from
export_OSM_roads_to_csv
import
write_roads_to_csv
################################################################################
# USER PARAMETERS #
...
...
@@ -133,6 +134,7 @@ def get_osm_roads(bounds: Bounds):
print
(
"Caching data..."
)
with
open
(
cache_file
,
'wb'
)
as
cache
:
pickle
.
dump
(
ways
,
cache
)
write_roads_to_csv
(
cache_file
)
return
ways
...
...
python_scripts/add_trees_to_open_street_map/export_OSM_roads_to_csv.py
View file @
14a13f4b
...
...
@@ -39,7 +39,7 @@ def create_table(ways):
return
df
for
cache_path
in
Path
(
'cache'
).
glob
(
'*.pickle'
):
def
write_roads_to_csv
(
cache_path
):
print
(
f
"Parsing
{
cache_path
}
"
)
df
=
create_table
(
load_cache
(
cache_path
))
csv_output
=
Path
(
'output'
)
/
f
'OSM_infos_
{
cache_path
.
stem
}
.csv'
...
...
@@ -49,3 +49,12 @@ for cache_path in Path('cache').glob('*.pickle'):
decimal
=
','
,
encoding
=
'utf-8-sig'
)
def
main
():
for
cache_path
in
Path
(
'cache'
).
glob
(
'*.pickle'
):
write_roads_to_csv
(
cache_path
)
if
__name__
==
"__main__"
:
main
()
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