Skip to content

Commit

Permalink
- Added fwa_snap_stream_measure_to_point().
Browse files Browse the repository at this point in the history
  • Loading branch information
joethorley committed Jan 31, 2024
1 parent ab21e69 commit 7ded4d0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions R/snap-stream-measure-to-point.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ nearest_stream <- function(x, streams) {
sf::st_cast("POINT") |>
sf::st_buffer(1e-07)

split <- list()
splits <- list()
for(i in 1:nrow(x)) {
split[i] <- lwgeom::st_split(streams[i,], point[i]) |> st_geometry()
splits[i] <- lwgeom::st_split(streams[i,], point[i]) |> sf::st_geometry()
}
length <- split |> purrr::map(1L) |> purrr::map(sf::st_length) |> purrr::map(as.numeric) |>

length <- splits |>
purrr::map(1L) |>
purrr::map(sf::st_length) |>
purrr::map_dbl(as.numeric) |>
unlist() |>
round(6)

Expand Down

0 comments on commit 7ded4d0

Please sign in to comment.