nh_group | R Documentation |
Input features are allocated into new groups depending on whether they lie within the separation distance of another input feature.
nh_group(spf, sep.dist = 0, union = FALSE)
spf |
input spatial features (sp or sf spatial object) |
sep.dist |
separation distance with which to define groups (see description) |
union |
whether to union output groups into multi-features |
The grouping is done by input ID, so multi-features are considered one input feature (they will not be be ungrouped).
The separation distance sep.dist
is numeric and in the
units of spf
's coordinate system, unless the
coordinate system uses latitude/longitude as the unit (e.g. WGS 84). In
these cases, geodesic distances will be used and sep.dist
should be specified in meters.
A column 'group' will be added to the output features.
Specifying union = TRUE
will output one (multi)feature per group,
meaning original attributes will be discarded - only 'group' and 'count'
(the number of original features in the group) will be returned. This feature
requires the package dplyr
to be installed.
sp or sf object (same as input)
David Bucklin
## Not run:
spf <- rgdal::readOGR("ambymabe/polygon_data", "ambymabe")
spg <- nh_group(spf, 1000)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.