Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
reference-hydrofabric
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Water Mission Area
nhgf
reference-hydrofabric
Commits
2511baaa
Commit
2511baaa
authored
11 months ago
by
Bock, Andy
Browse files
Options
Downloads
Patches
Plain Diff
Moved POI collapse out of navigate to a sourced function
parent
b8d9b398
No related branches found
No related tags found
1 merge request
!182
Bock
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
workspace/R/poi_move.R
+117
-0
117 additions, 0 deletions
workspace/R/poi_move.R
with
117 additions
and
0 deletions
workspace/R/poi_move.R
0 → 100644
+
117
−
0
View file @
2511baaa
# Load data
if
(
collapse
){
# Move HUC12 to other POIs
moved_pois
<-
poi_move
(
final_POIs_prec
,
"Type_HUC12"
,
poi_dar_move
,
poi_distance_move
)
if
(
!
is.data.frame
(
moved_pois
)){
final_POIs
<-
moved_pois
$
final_pois
moved_pois_table
<-
moved_pois
$
moved_points
%>%
mutate
(
move_type
=
"huc12 to other"
)
}
else
{
final_POIs
<-
moved_POIs
}
# Gages to confluences, terminals
moved_pois
<-
poi_move
(
final_POIs
,
"Type_Gages"
,
poi_dar_move
,
poi_distance_move
,
c
(
"Type_Conf"
,
"Type_Term"
))
if
(
!
is.data.frame
(
moved_pois
)){
final_POIs
<-
moved_pois
$
final_pois
moved_pois_table
<-
moved_pois_table
%>%
rbind
(
moved_pois
$
moved_points
%>%
mutate
(
move_type
=
"gages to conf"
))
}
else
{
final_POIs
<-
moved_POIs
}
# Gages to waterbody inlets
moved_pois
<-
poi_move
(
final_POIs
,
"Type_Gages"
,
poi_dar_move
,
poi_distance_move
,
c
(
"Type_WBIn"
,
"Type_WBOut"
))
if
(
!
is.data.frame
(
moved_pois
)){
final_POIs
<-
moved_pois
$
final_pois
moved_pois_table
<-
moved_pois_table
%>%
rbind
(
moved_pois
$
moved_points
%>%
mutate
(
move_type
=
"gages to wbin"
))
}
else
{
final_POIs
<-
moved_pois
}
# Waterbody inlet to confluence
moved_pois
<-
poi_move
(
final_POIs
,
"Type_WBIn"
,
poi_dar_move
/
2
,
poi_distance_move
*
0.4
,
"Type_Conf"
)
if
(
!
is.data.frame
(
moved_pois
)){
final_POIs
<-
moved_pois
$
final_pois
moved_pois_table
<-
moved_pois_table
%>%
rbind
(
moved_pois
$
moved_points
%>%
mutate
(
move_type
=
"gages to term"
))
}
else
{
final_POIs
<-
moved_pois
}
# # Waterbody inlet to confluence
# moved_pois <- poi_move(final_POIs, "Type_WBOut", poi_dar_move/2,
# poi_distance_move*0.4, "Type_WBIn")
# if(!is.data.frame(moved_pois)){
# final_POIs <- moved_pois$final_pois
# moved_pois_table <- moved_pois_table %>%
# rbind(moved_pois$moved_points %>%
# mutate(move_type = "gages to term"))
# } else {
# final_POIs <- moved_pois
# }
# Waterbody inlet to confluence
moved_pois
<-
poi_move
(
final_POIs
,
c
(
"Type_WBIn"
,
"Type_HUC12"
),
poi_dar_move
/
2
,
poi_distance_move
*
0.4
,
"Type_Conf"
)
if
(
!
is.data.frame
(
moved_pois
)){
final_POIs
<-
moved_pois
$
final_pois
moved_pois_table
<-
moved_pois_table
%>%
rbind
(
moved_pois
$
moved_points
%>%
mutate
(
move_type
=
"gages to term"
))
}
else
{
final_POIs
<-
moved_pois
}
# NID to waterbody outlet
moved_pois
<-
poi_move
(
final_POIs
,
"Type_hilarri"
,
poi_dar_move
/
2
,
poi_distance_move
*
0.4
,
c
(
"Type_WBOut"
,
"Type_TE"
))
if
(
!
is.data.frame
(
moved_pois
)){
final_POIs
<-
moved_pois
$
final_pois
moved_pois_table
<-
moved_pois_table
%>%
rbind
(
moved_pois
$
moved_points
%>%
mutate
(
move_type
=
"nid to wb_out"
))
}
else
{
final_POIs
<-
moved_pois
}
# NID to waterbody outlet
moved_pois
<-
poi_move
(
final_POIs
,
"Type_DA"
,
poi_dar_move
,
poi_distance_move
)
if
(
!
is.data.frame
(
moved_pois
)){
final_POIs
<-
moved_pois
$
final_pois
moved_pois_table
<-
moved_pois_table
%>%
rbind
(
moved_pois
$
moved_points
%>%
mutate
(
move_type
=
"nid to wb_out"
))
}
else
{
final_POIs
<-
moved_pois
}
if
(
"Type_elev"
%in%
names
(
final_POIs
)){
# NID to waterbody outlet
moved_pois
<-
poi_move
(
final_POIs
,
"Type_elev"
,
poi_dar_move
,
poi_distance_move
)
if
(
!
is.data.frame
(
moved_pois
)){
final_POIs
<-
moved_pois
$
final_pois
moved_pois_table
<-
moved_pois_table
%>%
rbind
(
moved_pois
$
moved_points
%>%
mutate
(
move_type
=
"nid to wb_out"
))
}
else
{
final_POIs
<-
moved_pois
}
}
write_sf
(
final_POIs
,
nav_gpkg
,
pois_all_layer
)
write_sf
(
moved_pois_table
,
temp_gpkg
,
"pois_collapsed"
)
}
\ No newline at end of file
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