defines spatial grid by offset, cell size and dimensions
GridTopology(cellcentre.offset, cellsize, cells.dim)
SpatialPixels(points, tolerance = sqrt(.Machine$double.eps),
proj4string = CRS(as.character(NA)), round = NULL, grid = NULL)
SpatialGrid(grid, proj4string = CRS(as.character(NA)))
coordinatevalues(obj)
points2grid(points, tolerance = sqrt(.Machine$double.eps), round=NULL)
getGridIndex(cc, grid, all.inside = TRUE)
getGridTopology(obj)
areaSpatialGrid(obj)
numeric; vector with the smallest centroid coordinates for each dimension; coordinates refer to the cell centre
numeric; vector with the cell size in each dimension
integer; vector with number of cells in each dimension
coordinates, object of class SpatialPoints-class
grid topology; object of class GridTopology-class;
for calls to SpatialPixels
, a value of NULL implies that this will
be derived from the point coordinates
precision, used to which extent points are exactly on a grid
default NULL, otherwise a value passed to as the digits argument to round
for setting cell size
object of class CRS-class
object of class or deriving from SpatialGrid-class
numeric matrix with coordinates
logical; if TRUE and cc
points fall outside
the grid area, an error message is generated; if FALSE, NA values
are generated for such points
GridTopology returns a value of class GridTopology-class; SpatialGrid returns an object of class SpatialGrid-class
coordinatevalues
returns a list with the unique x-coordinates,
the unique y-coordinate, etc. instead of the coordinates of all
grid cells
SpatialGrid returns an object of class SpatialGrid-class.
points2grid returns the GridTopology-class from a set of points.
getGridIndex finds the index of a set of point coordinates in a given
grid topology, and depending on all.inside
setting, generates NA
or an error message if points are outside the grid domain.
getGridTopology returns the slot of class GridTopology-class from obj.
areaSpatialGrid returns the spatial area of (the non-missing valued cells of) the grid. For objects of class SpatialGridDataFrame-class the area refers to cells where any (one or more) of the attribute columns are non-missing valued.
# NOT RUN { x = GridTopology(c(0,0), c(1,1), c(5,4)) class(x) x summary(x) coordinates(x) coordinates(GridTopology(c(0,0), c(1,1), c(5,4))) coordinatevalues(x) data(meuse.grid) coordinates(meuse.grid) <- c("x", "y") points2grid(meuse.grid) data(meuse.grid) set.seed(1) meuse.grid$x <- meuse.grid$x + rnorm(length(meuse.grid$x), 0, 0.002) meuse.grid$y <- meuse.grid$y + rnorm(length(meuse.grid$y), 0, 0.002) coordinates(meuse.grid) <- c("x", "y") #EJP # points2grid(meuse.grid, tolerance=0.76, round=1) data(meuse.grid) a <- which(meuse.grid$x == 180140) b <- which(meuse.grid$x == 180180) c <- which(meuse.grid$x == 179260) d <- which(meuse.grid$y == 332460) e <- which(meuse.grid$y == 332420) f <- which(meuse.grid$y == 330740) meuse.grid <- meuse.grid[-c(a, b, c, d, e, f),] coordinates(meuse.grid) <- c("x", "y") points2grid(meuse.grid) data(meuse.grid) set.seed(1) meuse.grid$x <- meuse.grid$x + rnorm(length(meuse.grid$x), 0, 0.002) meuse.grid$y <- meuse.grid$y + rnorm(length(meuse.grid$y), 0, 0.002) meuse.grid <- meuse.grid[-c(a, b, c, d, e, f),] coordinates(meuse.grid) <- c("x", "y") # EJP # points2grid(meuse.grid, tolerance=0.69, round=1) # }
Run the code above in your browser using DataCamp Workspace