[R] from points in Lon/Lat to physical distance in dist class

David L Carlson dcarlson at tamu.edu
Tue Nov 8 15:35:21 CET 2011


Look at distm() in package geosphere.

----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Mao Jianfeng
Sent: Tuesday, November 08, 2011 8:22 AM
To: r-help at r-project.org
Cc: bossa.package at gmail.com
Subject: [R] from points in Lon/Lat to physical distance in dist class

Dear R-listers,

Here, I would like to hearing helps from you.

I have GPS data (multiple points in the geographic scale) in
longitude/latitude. I intend to calculate
distance (in kilometer) among such points and output the distance matrix in
dist class.

I have gotten some progress, but I still can not get final goal. Could
please give me any directions/advice?

This email cc. to Mr. Pierre, the author of BoSSA package.

Thanks a lot in advance.

Best wishes,

Jian-Feng, Mao

#########################################
What I have gotten are
(1) distance among GPS points could be calculated by distGPS() function in
BoSSA package. But, it can
not output the distance in dist class. And, I do not know how to convert
such distance matrix to dist class.

(2) dist() function in base R can calculate distance among units and export
it in dist class. But, it could not
be used to work on points in lon/lat.

(3) some dummy codes
# (3.1) generate dummy points in lon/lat (in degree)
points <- data.frame(lon=seq(95, 105),lat=seq(35, 45))

# (3.2) calculate distance between points using distGPS()

library(BoSSA)

Geodist<-distGPS(points)

str(Geodist)
class(Geodist)

	[[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list