distPolylines {pgirmess} | R Documentation |
Computes the length of each lines of an output (polylines) of 'read.shape' from maptools.
distPolylines(myshp,decdeg=FALSE)
myshp |
A list of shapes of class ShapeList. The list must be of type "polylines". |
decdeg |
TRUE if point coordinates are longitude-latitude decimal degrees, in which case distances are measured in meters |
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:
A numeric distance.
Patrick Giraudoux <pgiraudo@univ-fcomte.fr>
distNode
, distTot
, distSeg
, distTotshp
# see example of Norwegian rivers in library maptools: ?Map2lines library(maptools) try4 <- read.shape(system.file("shapes/fylk-val.shp", package="maptools")[1]) distPolylines(try4)