pixelate: Pixelate polygons

View source: R/pixelate.R

pixelateR Documentation

Pixelate polygons

Description

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

Usage

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")


pkuhnert/VizU documentation built on March 19, 2024, 10:51 p.m.