sp_length | R Documentation |
sp_length
is a wrapper for rgeos::gLength
and calculates the
lengths of spatial lines or polygons. If sp_length
is used with
polygons, it returns the length of the perimeter of the polygons.
sp_length(sp, unit = "m", features = TRUE)
sp |
Spatial object. |
unit |
Distance unit to use. |
features |
Should the function be applied to all features in |
The trigonometric function, geosphere::perimeter
performs poorly for
length calculations. Therefore, when spatial objects are used with
sp_length
which have projection systems without metre units (such as
WGS84), the Mollweide projection system is used by default. The Mollweide
projection is applicable in any location on Earth, but the accuracy of the
returned values is dependent on location.
If the spatial objects are located in a zone which has a more appropriate
projection system, it is highly recommended that this is used. For example,
spatial data in New Zealand should be projected in the New Zealand Transverse
Mercator 2000 while data in the UK should be projected in British National
Grid; both of which have metre units (+units=m
).
Stuart K. Grange
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.