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

Tammy Wilson t.w at aggiemail.usu.edu
Fri Apr 6 21:26:50 CEST 2012


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.9161 at 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 at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology



-- 

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



More information about the R-sig-ecology mailing list