st_sd_ellipse {sfcentral}R Documentation

Standard deviation ellipse calculator

Description

Calculate the spatial deviaction ellipse from a points sf dataset.

Usage

st_sd_ellipse(.x, centre = NULL, weights = NULL, ...)

## S3 method for class 'sfg'
st_sd_ellipse(.x, centre = NULL, weights = NULL, ...)

## S3 method for class 'sf'
st_sd_ellipse(.x, centre = NULL, weights = NULL, ...)

## S3 method for class 'sfc'
st_sd_ellipse(.x, centre = NULL, weights = NULL, ...)

Arguments

.x

sf points 2D or 3D

centre

Numeric. Coordinates 2D of central point. Default NULL, performs a calculation of mean_centre() from point localities

weights

Numeric. Same length of number of points.

...

ignored

Value

simple features as "POLYGON" with atributes: centre coordinates, values for mayor and minor axis radius (sigma.x and sigma.y), rotation (theta and theta_corrected) and geometry properties (eccentricity, area and perimeter)

Author(s)

Gabriel Gaona

Examples

  requireNamespace("ggplot2", quietly = TRUE)
  library(sf, quietly = TRUE)
  library(ggplot2)
  bbx <- matrix(c(697047,9553483,
                  696158,9560476,
                  700964,9561425,
                  701745,9555358),
                byrow = TRUE,
                ncol = 2)
  bbx <- st_multipoint(bbx)
  bbx <- st_cast(bbx,"POLYGON")
  bbx <- st_sfc(bbx, crs = 31992)
  set.seed(1234)
  points <- st_sf(geometry = st_sample(bbx, 100))
  SDE <- st_sd_ellipse(points)
  ggplot() +
    geom_sf(data = SDE, fill = NA, color = "darkolivegreen") +
    geom_sf(data = points, color = "steelblue", size = 0.5)

[Package sfcentral version 0.1.0 Index]