[Raster-commits] r347 - pkg/raster/man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Mar 13 05:58:09 CET 2009
Author: jacobvanetten
Date: 2009-03-13 05:58:09 +0100 (Fri, 13 Mar 2009)
New Revision: 347
Modified:
pkg/raster/man/pointdistance.Rd
Log:
doc about matrices, and example added
Modified: pkg/raster/man/pointdistance.Rd
===================================================================
--- pkg/raster/man/pointdistance.Rd 2009-03-13 03:51:15 UTC (rev 346)
+++ pkg/raster/man/pointdistance.Rd 2009-03-13 04:58:09 UTC (rev 347)
@@ -15,27 +15,38 @@
}
\arguments{
- \item{point1}{x and y coordinate(s) of first (set of) point(s), either as c(x, y) or as matrix(ncol=2) in degrees for greatcircle, in meters (or similar) for euclidean }
- \item{point2}{x and y coordinate(s) of second (set of) second point(s). Like point1 }
- \item{r}{radius of the world (modeled as a sphere), in meters }
+ \item{point1}{ x and y coordinate of first (set of) point(s), either as c(x, y) or as matrix(ncol=2) in degrees for great-circle distance, in meters (or similar) for Euclidean }
+ \item{point2}{ x and y coordinate of second (set of) second point(s). Like point1. If point1 and point2 are both matrices they should have the same number of rows }
+ \item{r}{ radius of the world (modeled as a sphere), in meters }
+
}
\details{
A sphere is an approximation for the earth (a spheroid) and distanceGreatcircle can thus be used with geographic
- coordinates (latitude & longitude). There are probably more refined functions in other packages.
- You can use distanceEuclidean for coordinates of a map projection such as UTM (but note
- that in some projections distance is distorted).
+
+ coordinates (latitude & longitude). There are probably better functions available in other packages that use a datum.
+ You can use distanceEuclidean for coordinates of a map projection such as UTM (but note that in some projections distance is distorted).
+
}
\value{
- Distance in meters (great circle distance) or map-units (typically meters)
+ A single value or a vector of values giving the distance in meters (great circle distance) or map-units (for instance, meters in the case of UTM)
}
-\author{Robert J. Hijmans }
+\author{Robert J. Hijmans and Jacob van Etten }
+\examples{
+ a <- cbind(c(1,5,55,31),c(3,7,20))
+ b <- cbind(c(4,2,8,65),c(50,-90,20))
-\examples{
distanceEuclidean(c(0, 0), c(1, 1))
distanceGreatcircle(c(0, 0), c(1, 1))
+ distanceGreatcircle(c(0, 0), a)
+ distanceGreatcircle(a, b)
+
+ #Make a distance matrix (dist object)
+ dst <- matrix(nrow=4,ncol=4)
+ for (i in 1:4){dst[,i] <- distanceGreatcircle(a[i,],b)}
+ dst <- as.dist(dst)
}
\keyword{ spatial }
More information about the Raster-commits
mailing list