generating coordinates at equal geographical distances
There are many pathways to this, but you could use a map projection
that provides the properties you want and sample points there, then
project that back to longitude latitude.
Here's a dummy example, I just found an equal area projection by
stumbling through spatialreference.org, you should look into this more
for your purposes. I use spsample in the sp package to generate the
points, but what you use here really depends on what kind of points
you want, I ignored land vs. sea but you could easily adapt this to
the land only.
library(maptools)
data(wrld_simpl)
w <- subset(wrld_simpl, NAME %in% c("Canada", "Mexico", "United States"))
library(rgdal)
proj <- "+proj=laea +lat_0=45 +lon_0=-100 +x_0=0 +y_0=0 +a=6370997
+b=6370997 +units=m +no_defs"
w <- spTransform(subset(wrld_simpl, NAME %in% c("Canada", "Mexico",
"United States")), CRS(proj))
## create an extent object to sample from, rather than just the land
## (just use the "w" object if you want the points to be only on land)
library(raster)
bbpoly <- as(extent(w), "SpatialPolygons")
proj4string(bbpoly) <- CRS(proj4string(w))
x <- spsample(bbpoly, n = 2000, type = "hexagonal")
pts <- spTransform(x, CRS(proj4string(wrld_simpl)))
plot(pts)
plot(as(wrld_simpl, "SpatialLines"), add = TRUE, col = "dodgerblue")
On Thu, Aug 29, 2013 at 3:27 AM, john d <dobzhanski at gmail.com> wrote:
Ok, I'll be more explicit :) If I want to generate random coordinates across North America by uniformly sampling latitudes and longitudes, the geographical distance between these coordinates would decrease towards higher latitudes. I'd like to be able to generate coordinates (e.g. a grid) such that the geographical distances between coordinates would be constant regardless of latitude. On Wed, Aug 28, 2013 at 12:04 PM, Barry Rowlingson < b.rowlingson at lancaster.ac.uk> wrote:
You will find that any two coordinates are equidistant from each other... So my suggestion is you need to expand you question a bit more! :) On Wed, Aug 28, 2013 at 3:49 PM, john d <dobzhanski at gmail.com> wrote:
Dear all,
I need to generate coordinates that are equidistant, regardless of
latitude. Any suggestions?
Thanks!
John
[[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
[[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
Michael Sumner Hobart, Australia e-mail: mdsumner at gmail.com