Skip to content
Prev 19175 / 29559 Next

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: