If byid==TRUE
, a vector containing the lengths of individual
spatial objects
(the points, lines, or polygons) is returned. If byid=FALSE
,
the total length of all spatial objects is returned (a single number).
If x
inherits from SpatialPoints
, returned
value is 0. If x
inherits from SpatialLines
, returned
value contains line lengths or the sum of line lengths in x
.
If x
inherits from SpatialPolygons
, returned
value contains lengths of the perimeter of all polygons, or
the sum of perimeters, in x
. When x
contains polygons with
holes, the perimeter of the holes is included (i.e., perimeter of holes
is positive, not negative).
Units of the returned value are same as units of coordinates
in x
. E.g.,
meters if coordinates in x
are UTM meters,
decimal degrees if coordinates in x
are lat-long decimal
degrees.