Build a regular grid based on a SpatialPolygonsDataFrame. Provide also a table of surface intersections.
getGridLayer(spdf, cellsize, type = "regular", spdfid = NULL)
A list is returned. The list contains "spdf": a SpatialPolygonsDataFrame of a regular grid and "df": a data frame of surface intersection. df fields are id_cell: ids of the grid; id_geo: ids of the spdf and area_pct: share of the area of the polygon in the cell (a value of 55 means that 55% of the spdf unit is within the cell).
## Not run: ------------------------------------ # data(nuts2006) # # Get a grid layer # mygrid <- getGridLayer(spdf = nuts2.spdf, cellsize = 200000) # # Plot the grid # plot(mygrid$spdf) # head(mygrid$df) # ## ---------------------------------------------