This function divides a shapefile into pixels so it can be used to create a pixel map with build_pmap.

pixelate(geoData = NULL, file = NULL, layer = NULL, pixelSize = 40, id = "id")

Arguments

geoData

An object of class "SpatialPolygons" or "SpatialPolygonsDataFrame".

file

A shapefile pathway.

layer

Name of geoData layer (see documentation for read_sf for more information).

pixelSize

An integer. Larger values result in smaller pixels.

id

The ID column shared by the geoData object and the dataset with estimates and errors.

Details

This function can take several minutes to run depending on the size of the shapefile. Within this function, the projection of the spatial object is removed and then returned to the original projection.

Examples

data(us_geo)
ca_geo <- subset(us_geo, us_geo@data$STATE == "06")
pix <- pixelate(ca_geo, pixelSize = 60, id = "GEO_ID")