Skip to content

Commit

Permalink
Use output of rsgeo for n_segments (#552)
Browse files Browse the repository at this point in the history
See JosiahParry/rsgeo#42 which this mitigates
  • Loading branch information
Robinlovelace committed Apr 23, 2024
1 parent 42773e7 commit f2c555b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions R/linefuns.R
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ line_segment_rsgeo <- function(l, n_segments) {

# give them them CRS
res <- sf::st_set_crs(res, crs)
n_segments <- length(res)

# calculate the number of original geometries
n_lines <- length(geo)
Expand All @@ -363,13 +364,12 @@ line_segment_rsgeo <- function(l, n_segments) {
# index the original sf object
res_tbl <- sf::st_drop_geometry(l)[ids, , drop = FALSE]

# assign the geometry column
nrow(res_tbl)

res_tbl[[attr(l, "sf_column")]] <- res

# convert to sf and return
res_sf <- sf::st_as_sf(res_tbl)
res_sf <- sf::st_as_sf(
res_tbl,
geometry = res,
crs = crs
)
res_sf
}

Expand Down

0 comments on commit f2c555b

Please sign in to comment.