Skip to contents

These functions manipulate segmetric objects.

  • sm_area(): Return a vector of areas, one for each polygon.

  • sm_centroid(): Return the centroids of the given polygons.

  • sm_intersection(): Return the intersection of the given simple features.

  • sm_subset_union(): Return the union of the given simple features.

  • sm_rbind(): Return the merge of unique simple features.

  • sm_summarize_groups(): Summarizes metric values by a group (either reference or segment).

  • sm_options(): Get/Set segmetric options.

Usage

sm_area(s, order = NULL)

sm_centroid(s, order = NULL)

sm_distance(s1, s2)

sm_intersection(s1, s2, touches = TRUE)

sm_subset_union(s)

sm_rbind(...)

sm_apply_group(x, groups, fn, ...)

sm_summarize_group(x, groups, fn, ...)

sm_norm_left(x, y)

sm_norm_right(x, y)

sm_options(..., digits = NULL)

Arguments

s, s1, s2

Either a ref_sf, a seg_sf, or a subset_sf object (inherited from sf).

order

A subset_sf. This argument arranges the returned values according to the object passed here.

touches

A logical. Is the border part of the intersection?

...

For sm_rbind(), a set of subset_sf objects to be merged.

x, y

A numeric values (e.g. areas, lengths) to compute metrics.

groups

A group identifier vector used to aggregate a metric for each group.

fn

A function to aggregate a metric for a group.

digits

An integer indicating how many digits used to round metric values.

Value

  • sm_area(): Return a numeric vector with polygons' area.

  • sm_centroid(): Return a subset_sf object with polygons' centroid.

  • sm_intersection(): Return a subset_sf object with intersection between polygons.

  • sm_subset_union(): Return a subset_sf object with union between intersecting polygons.

  • sm_rbind(): Return a subset_sf object with unique features.