Description Usage Arguments Examples
This function calculates the minimum distance to points raster.
| 1 2 | dist2point(grid, points, parallel = TRUE, nclus = 4,
  dist.method = "Haversine", maxram = 4)
 | 
| grid | A raster object to match. | 
| points | A two column data frame in the form (lon,lat) or (x,y) | 
| parallel | TRUE or FALSE, should this code be executed in parallel. | 
| nclus | IF parallel==TRUE then how many cores in the cluster. | 
| dist.method | Which distance should we use? Haversine for lat/long projections,or Pythagorean for flat images and/or small areas. | 
| maxram | Maximum theoretical RAM usage. Will be divided by nclus for parallel jobs. | 
| 1 2 3 4 5 6 7 8 9 10 11 12 13 | require(raster)
grid = raster::raster(nrows=81, ncols=162, xmn=-180, xmx=180, ymn=-90, ymx=90, vals=NULL)
grid = raster::setValues(grid,values=(as.vector(seq(1:raster::ncell(grid)))))
points = cbind(
      c(seq(xmin(grid), xmax(grid), length.out=1000), 
               seq(xmax(grid), xmin(grid), length.out=1000)), 
      c(seq(ymin(grid), ymax(grid), length.out=100), 
               seq(ymin(grid), ymax(grid), length.out=100))
               )
plot(grid); points(points);
di = dist2point(grid, points, parallel=TRUE, maxram = 0.5, nclus = 4, dist.method='Haversine')
plot(di)
points(points)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.