Hi, I have a list of corrdinates (latitude, longitude), I need to calculate the distance between each coordinate, and generate a matrix, How could I try to do it? Thanks. -- View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Matrix-of-distances-km-between-Coordinates-tp6382641p6382641.html Sent from the R-sig-geo mailing list archive at Nabble.com.
Matrix of distances (km) between Coordinates
4 messages · Angelo Moreno, Marcelino de la Cruz, Barry Rowlingson +1 more
as.matrix(dist(corrdinates))
On 19/05/2011 18:08, Angelo Moreno wrote:
Hi, I have a list of corrdinates (latitude, longitude), I need to calculate the distance between each coordinate, and generate a matrix, How could I try to do it? Thanks. -- View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Matrix-of-distances-km-between-Coordinates-tp6382641p6382641.html Sent from the R-sig-geo mailing list archive at Nabble.com.
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
_________________________________ Marcelino de la Cruz Rot Departamento de Biologia Vegetal E.U.T.I. Agricola Universidad Politecnica de Madrid 28040 Madrid Tel: 34913365654 _________________________________
2011/5/19 Marcelino de la Cruz <marcelino.delacruz at upm.es>:
as.matrix(dist(corrdinates))
For small distances near the equator yes! Don't try this if you are studying polar bears! Try rdist.earth in the 'fields' package, or try transforming to a euclidean coordinate system using spTransform before using dist. Barry
?spDists in package sp, with argument longlat = TRUE.
On 05/19/2011 06:46 PM, Barry Rowlingson wrote:
2011/5/19 Marcelino de la Cruz <marcelino.delacruz at upm.es>:
as.matrix(dist(corrdinates))
For small distances near the equator yes! Don't try this if you are studying polar bears! Try rdist.earth in the 'fields' package, or try transforming to a euclidean coordinate system using spTransform before using dist. Barry
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Edzer Pebesma Institute for Geoinformatics (ifgi), University of M?nster Weseler Stra?e 253, 48151 M?nster, Germany. Phone: +49 251 8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de http://www.52north.org/geostatistics e.pebesma at wwu.de