Learn R Programming

SpatialPosition (version 2.1.2)

rasterReilly: Create a Raster from a Reilly Regular Grid

Description

This function creates a raster from a regularly spaced Reilly grid (output of the reilly function).

Usage

rasterReilly(x, mask = NULL)

Value

Raster of catchment areas values. The raster uses a RAT (ratify) that contains the correspondance between raster values and catchement areas values. Use unique(levels(rasterName)[[1]]) to see the correpondance table.

Arguments

x

sp or sf object; output of the reilly function.

mask

sp or sf object; this object is used to clip the raster. (optional)

See Also

reilly, plotReilly.

Examples

Run this code
library(raster)
data(hospital)
# Compute Reilly catchment areas from known points (hospital) on a
# grid defined by its resolution
myreilly <- reilly(knownpts = hospital, varname = "capacity",
                   typefct = "exponential", span = 1250, beta = 3,
                   resolution = 200, mask = paris, returnclass = "sf")
# Create a raster of reilly values
myreillyraster <- rasterReilly(x = myreilly, mask = paris)
plot(myreillyraster, col = rainbow(18))
# Correspondance between raster values and reilly areas
head(unique(levels(myreillyraster)[[1]]))

Run the code above in your browser using DataLab