Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
landschapsmonitor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Roelofsen, Hans
landschapsmonitor
Commits
89d79e4c
Commit
89d79e4c
authored
1 year ago
by
Roelofsen, Hans
Browse files
Options
Downloads
Patches
Plain Diff
script 4 inspecting viewscape output
parent
f3e520cc
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sample/geslotenheid/inspect_viewpoint_output.py
+61
-0
61 additions, 0 deletions
sample/geslotenheid/inspect_viewpoint_output.py
with
61 additions
and
0 deletions
sample/geslotenheid/inspect_viewpoint_output.py
0 → 100644
+
61
−
0
View file @
89d79e4c
import
sys
import
os
import
geopandas
as
gp
from
shapely.geometry
import
Point
import
pandas
as
pd
# VIEWPOINTS_FILE = r'C:/apps/temp_geodata/windturbiens/azure/DataFiles/flevoland_pnts_200m_sel.shp'
# RESULTS_FILE = r'c:\apps\temp_geodata\windturbiens\testsHans\output\rawtable_results_test01_hdr.csv'
# VIEWPOINTS = [4]
# OUT_DIR = r''
def
viewscape_output_inspection
(
results
:
str
,
viewpoints
:
int
,
viewpoints_file
:
str
,
out_dir
:
str
):
"""
Select ViewScape output associated with one or more viewpoints and write to file
Parameters
----------
results
viewpoints
viewpoints_file
out_dir
Returns
-------
"""
viewpoint_string
=
"
,
"
.
join
([
str
(
i
)
for
i
in
viewpoints
])
vp_data
=
pd
.
read_csv
(
results
).
query
(
f
"
VP_ID in [
{
viewpoint_string
}
]
"
)
if
vp_data
.
empty
:
print
(
f
'
No data found for viewpoint
{
viewpoint_string
}
'
)
sys
.
exit
(
1
)
out_name
=
f
"
viewscape_inspection_vp
{
viewpoint_string
.
replace
(
'
,
'
,
'
_
'
)
}
"
gp
.
GeoDataFrame
(
data
=
vp_data
.
drop
(
columns
=
[
"
x
"
,
"
y
"
]),
geometry
=
[
Point
(
x
,
y
)
for
x
,
y
in
zip
(
vp_data
.
x
,
vp_data
.
y
)]).
set_crs
(
epsg
=
28992
).
to_file
(
os
.
path
.
join
(
out_dir
,
f
'
{
out_name
}
_windturbines.shp
'
))
gp
.
read_file
(
viewpoints_file
).
query
(
f
"
ID in [
{
viewpoint_string
}
]
"
).
to_file
(
os
.
path
.
join
(
out_dir
,
f
'
{
out_name
}
_viewpoints.shp
'
)
)
if
__name__
==
'
__main__
'
:
import
argparse
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'
results
'
,
type
=
str
,
help
=
'
Viewscape output file
'
)
parser
.
add_argument
(
'
viewpoints
'
,
type
=
int
,
nargs
=
'
+
'
,
help
=
'
One or more viewpoint ids
'
)
parser
.
add_argument
(
'
viewpoints_file
'
,
type
=
str
,
help
=
'
Shapefile with viewpoints
'
)
parser
.
add_argument
(
'
out_dir
'
,
help
=
'
output directory
'
,
type
=
str
)
args
=
parser
.
parse_args
()
viewscape_output_inspection
(
**
vars
(
args
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment