distTotshp: Computes the total length of the lines of an output of 'read.shape' from maptools.
Description
Computes the total length of the lines of an output of 'read.shape' from maptools.
Usage
distTotshp(lines.shp,decdeg=FALSE)
Arguments
lines.shp
A list of shapes of class ShapeList. The list must be of type "line".
decdeg
TRUE if point coordinates are longitude-latitude decimal degrees, in which case distances are measured in meters
Value
A numeric distance.
Details
Requires the library maptools.
If degdec is FALSE (default), distance computed is Euclidian. Units depends on the coordinate systems.
If decdeg = TRUE, D = 1852 * 60 * (180/pi) * acos ( sin(la1) * sin(la2) + cos(la1) * cos(la2) * cos(abs(lg1 - lg2)).
This method calculates the great circle distance, is based on spherical trigonometry, and assumes that:
# see example of Norwegian rivers in library maptools: ?Map2lines library(maptools)
try4 <- read.shape(system.file("shapes/fylk-val.shp", package="maptools")[1])
distTotshp(try4)