From 826365a18eb97577bad3cae546375c6e6f38bb75 Mon Sep 17 00:00:00 2001 From: Andrea Gilardi Date: Wed, 8 Jun 2022 12:45:37 +0200 Subject: [PATCH 1/4] first implementation of to_spatial_dump_segments --- NAMESPACE | 6 +++ R/morphers.R | 79 +++++++++++++++++++++++++++++++++++++++ R/spatstat.R | 3 ++ man/as.linnet.Rd | 3 ++ man/sfnetworks-package.Rd | 2 +- man/spatial_morphers.Rd | 12 ++++++ 6 files changed, 104 insertions(+), 1 deletion(-) diff --git a/NAMESPACE b/NAMESPACE index e7e5f7f9..eebdf1ba 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -86,6 +86,7 @@ export(st_network_join) export(st_network_paths) export(to_spatial_contracted) export(to_spatial_directed) +export(to_spatial_dump_segments) export(to_spatial_explicit) export(to_spatial_neighborhood) export(to_spatial_shortest_paths) @@ -164,6 +165,7 @@ importFrom(sf,st_crosses) importFrom(sf,st_crs) importFrom(sf,st_disjoint) importFrom(sf,st_distance) +importFrom(sf,st_drop_geometry) importFrom(sf,st_equals) importFrom(sf,st_filter) importFrom(sf,st_geometry) @@ -178,7 +180,10 @@ importFrom(sf,st_m_range) importFrom(sf,st_nearest_feature) importFrom(sf,st_nearest_points) importFrom(sf,st_overlaps) +importFrom(sf,st_precision) importFrom(sf,st_reverse) +importFrom(sf,st_set_crs) +importFrom(sf,st_set_precision) importFrom(sf,st_sf) importFrom(sf,st_sfc) importFrom(sf,st_shift_longitude) @@ -189,6 +194,7 @@ importFrom(sf,st_within) importFrom(sf,st_wrap_dateline) importFrom(sf,st_z_range) importFrom(sf,st_zm) +importFrom(sfheaders,sf_linestring) importFrom(sfheaders,sf_to_df) importFrom(sfheaders,sfc_linestring) importFrom(sfheaders,sfc_point) diff --git a/R/morphers.R b/R/morphers.R index b3d96e65..0369d668 100644 --- a/R/morphers.R +++ b/R/morphers.R @@ -969,3 +969,82 @@ to_spatial_transformed = function(x, ...) { transformed = st_transform(x, ...) ) } + +#' @describeIn spatial_morphers Transform the edges of the input object +#' extracting all segments that compose each LINESTRING geometry. These +#' segments represent the edges of the ouput network. The nodes of the network +#' are adjusted accordingly. See also the examples in +#' \code{\link{as.linnet.sfnetwork}} to see how this morpher can be used to +#' adjust an \code{\link{sfnetwork}} object before converting it into +#' \code{\link[spatstat.linnet]{linnet}}. Returns a \code{morphed_sfnetwork} +#' format containing a single element of class \code{\link{sfnetwork}}. +#' @export +#' @importFrom sfheaders sf_to_df sf_linestring +#' @importFrom sf st_geometry st_drop_geometry st_set_crs st_crs +#' st_set_precision st_precision st_agr +to_spatial_dump_segments = function(x) { + # The following follows the same ideas as in to_spatial_subdivision so I start + # from the same point + require_spatially_explicit_edges(x) + if (will_assume_constant(x)) raise_assume_constant("to_spatial_subdivision") + edges = edges_as_sf(x) + directed = is_directed(x) + + # Now we need to extract the points that compose each LINESTRING and check + # them to determine whether they are boundary or internal points (since we + # want to split and create a new segment at each internal point). + edge_pts = sf_to_df(edges) + edge_idxs = edge_pts[["linestring_id"]] + is_startpoint = !duplicated(edge_idxs) + is_endpoint = !duplicated(edge_idxs, fromLast = TRUE) + is_internal = !is_startpoint & !is_endpoint + + # Each internal point will become the the startpoint and endpoint of a new + # segment, so I need to duplicate the internal points. Therefore, now I create + # a vector of integers that denotes the multiplicity of each point (i.e. 1 for + # boundary points and 2 for internal). + multiplicity = 1L + is_internal + idx_duplications = rep(seq_len(nrow(edge_pts)), times = multiplicity) + + # Now I have to: + # 1. extract the coordinates of each point in the "edges" object; + edge_coords = edge_pts[names(edge_pts) %in% c("x", "y", "z", "m")] + # 2. duplicate each internal/boundary point according to its multiplicity; + new_edge_pts = edge_coords[idx_duplications, ] + # 3. create an id for each segment. In fact, the output network will be + # composed by one edge for each segment included in the input network, so each + # pair of subsequent points defines a new LINESTRING geometry. + new_edge_pts[["linestring_id"]] = rep(seq_len(nrow(new_edge_pts) / 2L), each = 2L) + new_edges_geom = sf_linestring(new_edge_pts, linestring_id = "linestring_id") + + # Extract only the geometry and set CRS and precision + new_edges_geom = st_geometry(new_edges_geom) + new_edges_geom = st_set_crs(new_edges_geom, st_crs(edges)) + new_edges_geom = st_set_precision(new_edges_geom, st_precision(edges)) + + # Finally, we can rebuild the edges table (and hopefully preserve the agr + # structure). The object "idx_segments" is used to create a map between the + # fields included in the input edges and the new geometries, creating the new + # edges table. In fact, we will need to duplicate the original edges for n_i - + # 1 times (where n_i denotes the number of points composing the ith input + # LINESTRING). + idx_segments <- rep(seq_len(nrow(edges)), times = table(edge_idxs) - 1L) + new_edges = st_as_sf( + st_drop_geometry(edges)[idx_segments, -c(1, 2), drop = FALSE], + # Remove the first two columns since they just include the "from" and "to" + # vectors. I can safely apply this operation since the previous code will + # always return a "tibble" object with the correct number of rows and + # possibly 0 columns (where there is no input field). + geometry = new_edges_geom, + agr = st_agr(x, "edges") + ) + + # Rebuild the sfn + new_sfn = as_sfnetwork(new_edges, directed = directed) + + # Return in a list. + list( + dump_segments = new_sfn %preserve_graph_attrs% x + ) + +} diff --git a/R/spatstat.R b/R/spatstat.R index 74778a19..f6c0550a 100644 --- a/R/spatstat.R +++ b/R/spatstat.R @@ -53,6 +53,9 @@ check_spatstat = function(pkg) { #' \code{\link{sfnetwork}}. #' #' @name as.linnet +#' +#' @examples +#' #TODO as.linnet.sfnetwork = function(X, ...) { # Check the presence and the version of spatstat.geom and spatstat.linnet check_spatstat("spatstat.geom") diff --git a/man/as.linnet.Rd b/man/as.linnet.Rd index a4c61239..73d197c6 100644 --- a/man/as.linnet.Rd +++ b/man/as.linnet.Rd @@ -22,6 +22,9 @@ interoperability between \code{sfnetworks} and \code{spatstat}. Use this method without the .sfnetwork suffix and after loading the \code{spatstat} package. } +\examples{ +#TODO +} \seealso{ \code{\link{as_sfnetwork}} to convert objects of class \code{\link[spatstat.linnet]{linnet}} into objects of class diff --git a/man/sfnetworks-package.Rd b/man/sfnetworks-package.Rd index e48d85d7..40b2d9ec 100644 --- a/man/sfnetworks-package.Rd +++ b/man/sfnetworks-package.Rd @@ -6,7 +6,7 @@ \alias{sfnetworks-package} \title{sfnetworks: Tidy Geospatial Networks} \description{ -\if{html}{\figure{logo.png}{options: align='right' alt='logo' width='120'}} +\if{html}{\figure{logo.png}{options: style='float: right' alt='logo' width='120'}} Provides a tidy approach to spatial network analysis, in the form of classes and functions that enable a seamless interaction between the network analysis package 'tidygraph' and the spatial analysis package 'sf'. } diff --git a/man/spatial_morphers.Rd b/man/spatial_morphers.Rd index 96fdf095..e6c5822f 100644 --- a/man/spatial_morphers.Rd +++ b/man/spatial_morphers.Rd @@ -12,6 +12,7 @@ \alias{to_spatial_subdivision} \alias{to_spatial_subset} \alias{to_spatial_transformed} +\alias{to_spatial_dump_segments} \title{Spatial morphers for sfnetworks} \usage{ to_spatial_contracted( @@ -45,6 +46,8 @@ to_spatial_subdivision(x) to_spatial_subset(x, ..., subset_by = NULL) to_spatial_transformed(x, ...) + +to_spatial_dump_segments(x) } \arguments{ \item{x}{An object of class \code{\link{sfnetwork}}.} @@ -211,6 +214,15 @@ network into a different coordinate reference system. \code{...} is evaluated in the same manner as \code{\link[sf]{st_transform}}. Returns a \code{morphed_sfnetwork} containing a single element of class \code{\link{sfnetwork}}. + +\item \code{to_spatial_dump_segments}: Transform the edges of the input object +extracting all segments that compose each LINESTRING geometry. These +segments represent the edges of the ouput network. The nodes of the network +are adjusted accordingly. See also the examples in +\code{\link{as.linnet.sfnetwork}} to see how this morpher can be used to +adjust an \code{\link{sfnetwork}} object before converting it into +\code{\link[spatstat.linnet]{linnet}}. Returns a \code{morphed_sfnetwork} +format containing a single element of class \code{\link{sfnetwork}}. }} \examples{ From 66e65f6c194c251fe51db2b2c1a8b7ff1cfe3334 Mon Sep 17 00:00:00 2001 From: Andrea Gilardi Date: Sun, 4 Sep 2022 12:10:49 +0200 Subject: [PATCH 2/4] fix docs :books: --- NAMESPACE | 84 ++++++++++++++++++++++++------------------------ man/as_tibble.Rd | 2 +- man/sf.Rd | 76 +++++++++++++++++++++---------------------- 3 files changed, 81 insertions(+), 81 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index 442e2875..d649ecd8 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,8 @@ # Generated by roxygen2: do not edit by hand +S3method("st_agr<-",sfnetwork) +S3method("st_crs<-",sfnetwork) +S3method("st_geometry<-",sfnetwork) S3method(as_sfnetwork,default) S3method(as_sfnetwork,linnet) S3method(as_sfnetwork,psp) @@ -8,23 +11,57 @@ S3method(as_sfnetwork,sfNetwork) S3method(as_sfnetwork,sfc) S3method(as_sfnetwork,sfnetwork) S3method(as_sfnetwork,tbl_graph) +S3method(as_tbl_graph,sfnetwork) +S3method(as_tibble,sfnetwork) +S3method(morph,sfnetwork) S3method(plot,sfnetwork) S3method(print,morphed_sfnetwork) S3method(print,sfnetwork) +S3method(st_agr,sfnetwork) +S3method(st_area,sfnetwork) +S3method(st_as_s2,sfnetwork) +S3method(st_as_sf,sfnetwork) +S3method(st_bbox,sfnetwork) +S3method(st_coordinates,sfnetwork) +S3method(st_crop,morphed_sfnetwork) +S3method(st_crop,sfnetwork) +S3method(st_crs,sfnetwork) +S3method(st_difference,morphed_sfnetwork) +S3method(st_difference,sfnetwork) +S3method(st_drop_geometry,sfnetwork) +S3method(st_filter,morphed_sfnetwork) +S3method(st_filter,sfnetwork) +S3method(st_geometry,sfnetwork) +S3method(st_intersection,morphed_sfnetwork) +S3method(st_intersection,sfnetwork) +S3method(st_intersects,sfnetwork) +S3method(st_is,sfnetwork) +S3method(st_is_valid,sfnetwork) +S3method(st_join,morphed_sfnetwork) +S3method(st_join,sfnetwork) +S3method(st_m_range,sfnetwork) +S3method(st_nearest_points,sfnetwork) S3method(st_network_bbox,sfnetwork) S3method(st_network_blend,sfnetwork) S3method(st_network_cost,sfnetwork) S3method(st_network_join,sfnetwork) S3method(st_network_paths,sfnetwork) +S3method(st_normalize,sfnetwork) +S3method(st_precision,sfnetwork) +S3method(st_reverse,sfnetwork) +S3method(st_sample,sfnetwork) +S3method(st_set_precision,sfnetwork) +S3method(st_shift_longitude,sfnetwork) +S3method(st_simplify,sfnetwork) +S3method(st_transform,sfnetwork) +S3method(st_wrap_dateline,sfnetwork) +S3method(st_z_range,sfnetwork) +S3method(st_zm,sfnetwork) +S3method(unmorph,morphed_sfnetwork) export("%>%") -export("st_agr<-.sfnetwork") -export("st_crs<-.sfnetwork") -export("st_geometry<-.sfnetwork") export(activate) export(active) export(as_sfnetwork) -export(as_tbl_graph.sfnetwork) -export(as_tibble.sfnetwork) export(edge_azimuth) export(edge_circuity) export(edge_contains) @@ -42,7 +79,6 @@ export(edge_length) export(edge_overlaps) export(edge_touches) export(is.sfnetwork) -export(morph.sfnetwork) export(node_M) export(node_X) export(node_Y) @@ -56,46 +92,11 @@ export(node_is_within_distance) export(node_touches) export(sf_attr) export(sfnetwork) -export(st_agr.sfnetwork) -export(st_area.sfnetwork) -export(st_as_s2.sfnetwork) -export(st_as_sf.sfnetwork) -export(st_bbox.sfnetwork) -export(st_coordinates.sfnetwork) -export(st_crop.morphed_sfnetwork) -export(st_crop.sfnetwork) -export(st_crs.sfnetwork) -export(st_difference.morphed_sfnetwork) -export(st_difference.sfnetwork) -export(st_drop_geometry.sfnetwork) -export(st_filter.morphed_sfnetwork) -export(st_filter.sfnetwork) -export(st_geometry.sfnetwork) -export(st_intersection.morphed_sfnetwork) -export(st_intersection.sfnetwork) -export(st_intersects.sfnetwork) -export(st_is.sfnetwork) -export(st_is_valid.sfnetwork) -export(st_join.morphed_sfnetwork) -export(st_join.sfnetwork) -export(st_m_range.sfnetwork) -export(st_nearest_points.sfnetwork) export(st_network_bbox) export(st_network_blend) export(st_network_cost) export(st_network_join) export(st_network_paths) -export(st_normalize.sfnetwork) -export(st_precision.sfnetwork) -export(st_reverse.sfnetwork) -export(st_sample.sfnetwork) -export(st_set_precision.sfnetwork) -export(st_shift_longitude.sfnetwork) -export(st_simplify.sfnetwork) -export(st_transform.sfnetwork) -export(st_wrap_dateline.sfnetwork) -export(st_z_range.sfnetwork) -export(st_zm.sfnetwork) export(to_spatial_contracted) export(to_spatial_directed) export(to_spatial_dump_segments) @@ -107,7 +108,6 @@ export(to_spatial_smooth) export(to_spatial_subdivision) export(to_spatial_subset) export(to_spatial_transformed) -export(unmorph.morphed_sfnetwork) importFrom(crayon,silver) importFrom(dplyr,across) importFrom(dplyr,bind_rows) diff --git a/man/as_tibble.Rd b/man/as_tibble.Rd index ed0d91ad..2a319972 100644 --- a/man/as_tibble.Rd +++ b/man/as_tibble.Rd @@ -5,7 +5,7 @@ \alias{as_tibble.sfnetwork} \title{Extract the active element of a sfnetwork as spatial tibble} \usage{ -as_tibble.sfnetwork(x, active = NULL, spatial = TRUE, ...) +\method{as_tibble}{sfnetwork}(x, active = NULL, spatial = TRUE, ...) } \arguments{ \item{x}{An object of class \code{\link{sfnetwork}}.} diff --git a/man/sf.Rd b/man/sf.Rd index 3b8aff4e..8f70a2f8 100644 --- a/man/sf.Rd +++ b/man/sf.Rd @@ -42,81 +42,81 @@ \alias{st_area.sfnetwork} \title{sf methods for sfnetworks} \usage{ -st_as_sf.sfnetwork(x, active = NULL, ...) +\method{st_as_sf}{sfnetwork}(x, active = NULL, ...) -st_as_s2.sfnetwork(x, active = NULL, ...) +\method{st_as_s2}{sfnetwork}(x, active = NULL, ...) -st_geometry.sfnetwork(x, active = NULL, ...) +\method{st_geometry}{sfnetwork}(x, active = NULL, ...) -st_geometry.sfnetwork(x) <- value +\method{st_geometry}{sfnetwork}(x) <- value -st_drop_geometry.sfnetwork(x, ...) +\method{st_drop_geometry}{sfnetwork}(x, ...) -st_bbox.sfnetwork(x, active = NULL, ...) +\method{st_bbox}{sfnetwork}(x, active = NULL, ...) -st_coordinates.sfnetwork(x, active = NULL, ...) +\method{st_coordinates}{sfnetwork}(x, active = NULL, ...) -st_is.sfnetwork(x, ...) +\method{st_is}{sfnetwork}(x, ...) -st_is_valid.sfnetwork(x, ...) +\method{st_is_valid}{sfnetwork}(x, ...) -st_crs.sfnetwork(x, active = NULL, ...) +\method{st_crs}{sfnetwork}(x, active = NULL, ...) -st_crs.sfnetwork(x) <- value +\method{st_crs}{sfnetwork}(x) <- value -st_precision.sfnetwork(x, active = NULL, ...) +\method{st_precision}{sfnetwork}(x, active = NULL, ...) -st_set_precision.sfnetwork(x, value) +\method{st_set_precision}{sfnetwork}(x, value) -st_shift_longitude.sfnetwork(x, ...) +\method{st_shift_longitude}{sfnetwork}(x, ...) -st_transform.sfnetwork(x, ...) +\method{st_transform}{sfnetwork}(x, ...) -st_wrap_dateline.sfnetwork(x, ...) +\method{st_wrap_dateline}{sfnetwork}(x, ...) -st_normalize.sfnetwork(x, ...) +\method{st_normalize}{sfnetwork}(x, ...) -st_zm.sfnetwork(x, ...) +\method{st_zm}{sfnetwork}(x, ...) -st_m_range.sfnetwork(x, active = NULL, ...) +\method{st_m_range}{sfnetwork}(x, active = NULL, ...) -st_z_range.sfnetwork(x, active = NULL, ...) +\method{st_z_range}{sfnetwork}(x, active = NULL, ...) -st_agr.sfnetwork(x, active = NULL, ...) +\method{st_agr}{sfnetwork}(x, active = NULL, ...) -st_agr.sfnetwork(x) <- value +\method{st_agr}{sfnetwork}(x) <- value -st_reverse.sfnetwork(x, ...) +\method{st_reverse}{sfnetwork}(x, ...) -st_simplify.sfnetwork(x, ...) +\method{st_simplify}{sfnetwork}(x, ...) -st_join.sfnetwork(x, y, ...) +\method{st_join}{sfnetwork}(x, y, ...) -st_join.morphed_sfnetwork(x, y, ...) +\method{st_join}{morphed_sfnetwork}(x, y, ...) -st_filter.sfnetwork(x, y, ...) +\method{st_filter}{sfnetwork}(x, y, ...) -st_filter.morphed_sfnetwork(x, y, ...) +\method{st_filter}{morphed_sfnetwork}(x, y, ...) -st_crop.sfnetwork(x, y, ...) +\method{st_crop}{sfnetwork}(x, y, ...) -st_crop.morphed_sfnetwork(x, y, ...) +\method{st_crop}{morphed_sfnetwork}(x, y, ...) -st_difference.sfnetwork(x, y, ...) +\method{st_difference}{sfnetwork}(x, y, ...) -st_difference.morphed_sfnetwork(x, y, ...) +\method{st_difference}{morphed_sfnetwork}(x, y, ...) -st_intersection.sfnetwork(x, y, ...) +\method{st_intersection}{sfnetwork}(x, y, ...) -st_intersection.morphed_sfnetwork(x, y, ...) +\method{st_intersection}{morphed_sfnetwork}(x, y, ...) -st_intersects.sfnetwork(x, y, ...) +\method{st_intersects}{sfnetwork}(x, y, ...) -st_sample.sfnetwork(x, ...) +\method{st_sample}{sfnetwork}(x, ...) -st_nearest_points.sfnetwork(x, y, ...) +\method{st_nearest_points}{sfnetwork}(x, y, ...) -st_area.sfnetwork(x, ...) +\method{st_area}{sfnetwork}(x, ...) } \arguments{ \item{x}{An object of class \code{\link{sfnetwork}}.} From 66be9d90afc43e93734d3f3239afddd9d1e83796 Mon Sep 17 00:00:00 2001 From: Andrea Gilardi Date: Sun, 4 Sep 2022 13:56:39 +0200 Subject: [PATCH 3/4] style: change name of the morpher + update function names :art: --- NAMESPACE | 2 +- R/morphers.R | 8 ++++---- man/spatial_morphers.Rd | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/NAMESPACE b/NAMESPACE index d649ecd8..c1580205 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -99,9 +99,9 @@ export(st_network_join) export(st_network_paths) export(to_spatial_contracted) export(to_spatial_directed) -export(to_spatial_dump_segments) export(to_spatial_explicit) export(to_spatial_neighborhood) +export(to_spatial_segmentation) export(to_spatial_shortest_paths) export(to_spatial_simple) export(to_spatial_smooth) diff --git a/R/morphers.R b/R/morphers.R index ac79977e..c87f1e1a 100644 --- a/R/morphers.R +++ b/R/morphers.R @@ -1167,7 +1167,7 @@ to_spatial_transformed = function(x, ...) { #' @describeIn spatial_morphers Transform the edges of the input object #' extracting all segments that compose each LINESTRING geometry. These -#' segments represent the edges of the ouput network. The nodes of the network +#' segments represent the edges of the output network. The nodes of the network #' are adjusted accordingly. See also the examples in #' \code{\link{as.linnet.sfnetwork}} to see how this morpher can be used to #' adjust an \code{\link{sfnetwork}} object before converting it into @@ -1177,10 +1177,10 @@ to_spatial_transformed = function(x, ...) { #' @importFrom sfheaders sf_to_df sf_linestring #' @importFrom sf st_geometry st_drop_geometry st_set_crs st_crs #' st_set_precision st_precision st_agr -to_spatial_dump_segments = function(x) { +to_spatial_segmentation = function(x) { # The following follows the same ideas as in to_spatial_subdivision so I start # from the same point - require_spatially_explicit_edges(x) + require_explicit_edges(x, hard = TRUE) if (will_assume_constant(x)) raise_assume_constant("to_spatial_subdivision") edges = edges_as_sf(x) directed = is_directed(x) @@ -1239,7 +1239,7 @@ to_spatial_dump_segments = function(x) { # Return in a list. list( - dump_segments = new_sfn %preserve_graph_attrs% x + dump_segments = new_sfn %preserve_network_attrs% x ) } diff --git a/man/spatial_morphers.Rd b/man/spatial_morphers.Rd index 1492a335..5815a31f 100644 --- a/man/spatial_morphers.Rd +++ b/man/spatial_morphers.Rd @@ -12,7 +12,7 @@ \alias{to_spatial_subdivision} \alias{to_spatial_subset} \alias{to_spatial_transformed} -\alias{to_spatial_dump_segments} +\alias{to_spatial_segmentation} \title{Spatial morphers for sfnetworks} \usage{ to_spatial_contracted( @@ -53,7 +53,7 @@ to_spatial_subset(x, ..., subset_by = NULL) to_spatial_transformed(x, ...) -to_spatial_dump_segments(x) +to_spatial_segmentation(x) } \arguments{ \item{x}{An object of class \code{\link{sfnetwork}}.} @@ -239,9 +239,9 @@ evaluated in the same manner as \code{\link[sf]{st_transform}}. Returns a \code{morphed_sfnetwork} containing a single element of class \code{\link{sfnetwork}}. -\item \code{to_spatial_dump_segments()}: Transform the edges of the input object +\item \code{to_spatial_segmentation()}: Transform the edges of the input object extracting all segments that compose each LINESTRING geometry. These -segments represent the edges of the ouput network. The nodes of the network +segments represent the edges of the output network. The nodes of the network are adjusted accordingly. See also the examples in \code{\link{as.linnet.sfnetwork}} to see how this morpher can be used to adjust an \code{\link{sfnetwork}} object before converting it into From f1c78d12fca7d2ce1825d6e22f2e46ee4f8801c9 Mon Sep 17 00:00:00 2001 From: Andrea Gilardi Date: Wed, 9 Aug 2023 18:43:45 +0200 Subject: [PATCH 4/4] fix typo --- R/morphers.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/morphers.R b/R/morphers.R index 1ea329c9..27351d00 100644 --- a/R/morphers.R +++ b/R/morphers.R @@ -1206,7 +1206,7 @@ to_spatial_segmentation = function(x) { # The following follows the same ideas as in to_spatial_subdivision so I start # from the same point require_explicit_edges(x, hard = TRUE) - if (will_assume_constant(x)) raise_assume_constant("to_spatial_subdivision") + if (will_assume_constant(x)) raise_assume_constant("to_spatial_segmentation") edges = edges_as_sf(x) directed = is_directed(x)