perimeter function

Compute the perimeter of a longitude/latitude polygon

Compute the perimeter of a longitude/latitude polygon

Compute the perimeter of a polygon (or the length of a line) with longitude/latitude coordinates, on an ellipsoid (WGS84 by default) 1.1

## S4 method for signature 'matrix' perimeter(x, a=6378137, f=1/298.257223563, ...) ## S4 method for signature 'SpatialPolygons' perimeter(x, a=6378137, f=1/298.257223563, ...) ## S4 method for signature 'SpatialLines' perimeter(x, a=6378137, f=1/298.257223563, ...)

Arguments

  • x: Longitude/latitude of the points forming a polygon or line; Must be a matrix of 2 columns (first one is longitude, second is latitude) or a SpatialPolygons* or SpatialLines* object
  • a: major (equatorial) radius of the ellipsoid. The default value is for WGS84
  • f: ellipsoid flattening. The default value is for WGS84
  • ...: Additional arguments. None implemented

Returns

Numeric. The perimeter or length in m.

See Also

areaPolygon, centroid

Author(s)

This function calls GeographicLib code by C.F.F. Karney

References

C.F.F. Karney, 2013. Algorithms for geodesics, J. Geodesy 87: 43-55. tools:::Rd_expr_doi("10.1007/s00190-012-0578-z") . Addenda: https://geographiclib.sourceforge.io/geod-addenda.html. Also see https://geographiclib.sourceforge.io/

Examples

xy <- rbind(c(-180,-20), c(-140,55), c(10, 0), c(-140,-60), c(-180,-20)) perimeter(xy)
  • Maintainer: Robert J. Hijmans
  • License: GPL (>= 3)
  • Last published: 2024-10-04

Useful links