Learn R Programming

SpatialPosition (version 2.1.2)

rasterHuff: Create a Raster from a Huff SpatialPointsDataFrame

Description

This function creates a raster from a regularly spaced Huff grid (output of the huff function).

Usage

rasterHuff(x, mask = NULL)

Value

Raster of catchment areas values.

Arguments

x

sp or sf object; output of the huff function.

mask

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

See Also

huff, plotHuff.

Examples

Run this code
library(raster)
data(hospital)
# Compute Huff catchment areas from known points (hospital) on a
# grid defined by its resolution
myhuff <- huff(knownpts = hospital, varname = "capacity",
               typefct = "exponential", span = 750, beta = 2,
               resolution = 100, mask = paris, returnclass = "sf")
# Create a raster of huff values
myhuffraster <- rasterHuff(x = myhuff, mask = paris)
plot(myhuffraster)

Run the code above in your browser using DataLab