distTot: Computes the total length of a polyline.

View source: R/distTot.r

distTotR Documentation

Computes the total length of a polyline.

Description

Computes the total length of a polyline.

Usage

distTot(pts,decdeg=FALSE)

Arguments

pts

A matrix or data.frame of the node coordinates column 1 = x,column 2 = y.

decdeg

TRUE if point coordinates are longitude-latitude decimal degrees, in which case distances are measured in meters

Details

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:

  • 1 minute of arc is 1 nautical mile

  • 1 nautical mile is 1.852 km

Value

A numeric distance.

See Also

, distNode, distSeg

Examples

x<-c(10,56,100)
y<-c(23,32,150)
distTot(cbind(x,y))
  

pgirmess documentation built on April 8, 2023, 1:12 a.m.

Related to distTot in pgirmess...