Description Usage Arguments Value See Also Examples
View source: R/points2nearestcell.R
Move point occurrences falling in raster cells without data (i.e. NA) to the nearest raster cell with data.
1 2 3 4 5 6 7 8 9 10 |
locs |
A SpatialPoints or SpatialPointsDataFrame. |
ras |
|
layer |
Integer. For RasterStack and RasterBrick objects, layer to use. |
move |
Logical. Change coordinates of points to those of the nearest raster cells? |
distance |
Numeric (optional). Maximum distance to move points. Point coordinates are only changed if the distance to the nearest raster cell is below |
showchanges |
Logical. Print table with old and new coordinates. |
showmap |
Logical. Show map with original and new coordinates? |
leaflet |
Logical. If TRUE, show leaflet map instead of static map. |
A SpatialPointsDataFrame (with corrected coordinates if move is TRUE).
https://github.com/SEEG-Oxford/seegSDM/blob/master/man/nearestLand.Rd and https://stackoverflow.com/questions/27562076/if-raster-value-na-search-and-extract-the-nearest-non-na-pixel and http://stackoverflow.com/questions/26652629/extracting-a-value-from-a-raster-for-a-specific-point-based-on-the-closest-cell/26688361#26688361 and https://rdrr.io/cran/spatstat/man/nearest.raster.point.html.
1 2 3 4 5 6 7 | ## Not run:
data(acaule)
locs <- locs2sp(acaule)
ras <- getData('worldclim', var = 'tmin', res = 10)
check.coords <- points2nearestcell(locs, ras)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.