View source: R/fix.coastal.points.R
fix.coastal.points | R Documentation |
The function moves points to the nearest non-NA cell of a base raster within a maximum distance.
fix.coastal.points(data,xy.cols,r,ncell,clip.by.poly=FALSE,poly,occ.desaggregation=FALSE)
data |
a matrix or data.frame containing the points coordinates. |
xy.cols |
a numeric vector indicating the IDs of the x-y columns. |
r |
a |
ncell |
an integer indicating the maximum number of cells away from the points where they can be shifted. If the nearest non-NA cell fall farther than this distance from a give point, this will be dropped. |
clip.by.poly |
a logical vector indicating if the base raster must be clipped along the boundaries of a polygon. |
poly |
a |
occ.desaggregation |
a logical vector indicating if to apply the |
A matrix including the shifted points
Mirko Di Febbraro
library(raster)
raster(system.file("exdata/prediction_ground.gri", package="EcoPast"))->prediction_ground
data(lgm)
data_clupus<-subset(lgm, spec=="Canis_lupus")
coordinates(data_clupus)<-~x+y
proj4string(data_clupus)<-"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"
data_clupus<-spTransform(data_clupus, proj4string(prediction_ground))
data_clupus<-as.data.frame(data_clupus)
data_mammuth_reduced<-fix.coastal.points(data_clupus, xy.cols = 4:5,
r = prediction_ground, ncell = 1, occ.desaggregation = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.