Re: [R-sig-eco] How to calculate geographical coordinates of sampling points following (by bearing and distance) a georeferenced one?

2012-04-09 Thread Ivailo
On Fri, Apr 6, 2012 at 10:26 PM, Tammy Wilson t...@aggiemail.usu.edu wrote:
 Trigonometry will work for projected coordinate systems like UTM:

 Try this:
 # number of points
 n = 30

 # reference location
 ref.pt = cbind(1,2)

 # generate some random directions
 # This can be your list of your bearings converted to radians
 dir - runif(n,0,2*pi )

 # generate some random distances
 # This can be your list of distances in map units (e.g. m)
 dist - runif(n,0.5,10)

 #empty matrix for coordinates
 coords.mat = cbind(rep(0,n),rep(0,n))

 #using trigonometry to calculate object location
 for (i in 1:n){
              coords.mat[i,1] = ref.pt[1]+(sin(dir[i])*dist[i])
              coords.mat[i,2] = ref.pt[2]+(cos(dir[i])*dist[i])
        }
 plot (coords.mat)
 points(ref.pt,col=2)

 Best,
 Tammy

Thank you for the code, Tammy! Meanwhile Michael Summer pointed my
attention the the geosphere package and the destPoint() function seems
to do exactly what I was
searching for.

Cheers,
Ivailo
-- 
UBUNTU: a person is a person through other persons.

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] How to calculate geographical coordinates of sampling points following (by bearing and distance) a georeferenced one?

2012-04-06 Thread Tammy Wilson
Trigonometry will work for projected coordinate systems like UTM:

Try this:
# number of points
n = 30

# reference location
ref.pt = cbind(1,2)

# generate some random directions
# This can be your list of your bearings converted to radians
dir - runif(n,0,2*pi )

# generate some random distances
# This can be your list of distances in map units (e.g. m)
dist - runif(n,0.5,10)

#empty matrix for coordinates
coords.mat = cbind(rep(0,n),rep(0,n))

#using trigonometry to calculate object location
for (i in 1:n){
  coords.mat[i,1] = ref.pt[1]+(sin(dir[i])*dist[i])
  coords.mat[i,2] = ref.pt[2]+(cos(dir[i])*dist[i])
}
plot (coords.mat)
points(ref.pt,col=2)

Best,
Tammy


On Wed, Apr 4, 2012 at 11:02 PM, Ivailo ubuntero.9...@gmail.com wrote:
 Der fellow R-users,

 I have several sampling sites and in each site the starting plot
 (i.e. the first one that have been sampled) is georeferenced with a
 GPS but the following ones are just described by their distance and
 bearing in relation to the previous one.

 Is there a quick way to calculate (by using some of the spatial
 R-packages) the geographic coordinates of the sapling plots at each
 location that have not been explicitly georeferenced?

 Cheers,
 Ivailo
 --
 UBUNTU: a person is a person through other persons.

 ___
 R-sig-ecology mailing list
 R-sig-ecology@r-project.org
 https://stat.ethz.ch/mailman/listinfo/r-sig-ecology



-- 

Tammy L. Wilson
Ecologist
(\(\
(`.’)
(,,)(‘’)(‘’)

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[R-sig-eco] How to calculate geographical coordinates of sampling points following (by bearing and distance) a georeferenced one?

2012-04-05 Thread Ivailo
Der fellow R-users,

I have several sampling sites and in each site the starting plot
(i.e. the first one that have been sampled) is georeferenced with a
GPS but the following ones are just described by their distance and
bearing in relation to the previous one.

Is there a quick way to calculate (by using some of the spatial
R-packages) the geographic coordinates of the sapling plots at each
location that have not been explicitly georeferenced?

Cheers,
Ivailo
-- 
UBUNTU: a person is a person through other persons.

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] How to calculate geographical coordinates of sampling points following (by bearing and distance) a georeferenced one?

2012-04-05 Thread Michael Sumner
I cannot remember the names, but there would be support for this in the
maptools or geosphere package I am sure


On Thursday, April 5, 2012, Ivailo wrote:

 Der fellow R-users,

 I have several sampling sites and in each site the starting plot
 (i.e. the first one that have been sampled) is georeferenced with a
 GPS but the following ones are just described by their distance and
 bearing in relation to the previous one.

 Is there a quick way to calculate (by using some of the spatial
 R-packages) the geographic coordinates of the sapling plots at each
 location that have not been explicitly georeferenced?

 Cheers,
 Ivailo
 --
 UBUNTU: a person is a person through other persons.

 ___
 R-sig-ecology mailing list
 R-sig-ecology@r-project.org javascript:;
 https://stat.ethz.ch/mailman/listinfo/r-sig-ecology



-- 
Michael Sumner
Institute for Marine and Antarctic Studies, University of Tasmania
Hobart, Australia
e-mail: mdsum...@gmail.com

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology