[R-sig-Geo] Randomly moving a locality (within set limits)

MacQueen, Don macqueen1 at llnl.gov
Fri Aug 22 17:58:14 CEST 2014


My first thought would be to use spTransform() to convert to a (local)
cartesian coordinate system, do the shift [perhaps using
maptools::elide()], and then convert back.

Identifying appropriate (local) coordinate systems for each locality could
be a chore, but other than that it looks to me like a conceptually simple
process.

elide() will, I believe, remove the proj4string from the elided object so
you¹d have to put it back in afterwards. Maybe calculating on the
coordinates would be easier, but that would depend on what kind of Spatial
objects your localities are.

-Don

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 8/22/14, 4:12 AM, "Alastair Potts" <potts.a at gmail.com> wrote:

>Hi all,
>
>I was wondering if someone could help point me in the right direction here
>- I can't seem to find a function or post that focuses on this.
>
>I have localities around the world. I want to be able to randomly move a
>given locality within a set radius (defined by km). So, I have a point at
>xy and want it to be shifted to some other locality within, say, 15 km of
>of its current locality.
>
>This is simple enough using something like runif(1,-15,15), but it's the
>lat-long conversion that is confusing me (how to work out how many decimal
>degrees this might be around the point at different global localities).
>
>Any help or pointers would be greatly appreciated.
>
>Thanks in advance,
>
>Cheers,
>Alastair
>
>	[[alternative HTML version deleted]]
>
>_______________________________________________
>R-sig-Geo mailing list
>R-sig-Geo at r-project.org
>https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list