Learn R Programming

SpatialPosition (version 1.0)

reilly: Reilly Catchment Areas

Description

This function computes the catchment areas as defined by W.J. Reilly (1931).

Usage

reilly(knownpts, unknownpts = NULL, matdist = NULL, varname,
  typefct = "exponential", span, beta, resolution = 2000, longlat = FALSE,
  mask = NULL)

Arguments

knownpts
sp object (SpatialPointsDataFrame or SpatialPolygonsDataFrame); this is the set of known observations to estimate the catchment areas from.
unknownpts
sp object (SpatialPointsDataFrame or SpatialPolygonsDataFrame); this is the set of unknown units for which the function computes the estimates. Not used when resolution is set up. (optional)
matdist
matrix; a distance matrix. Row names match the first column of the knownpts object dataframe. Column names match the first column of the unknownpts object dataframe. (optional)
varname
character; name of the variable in the knownpts dataframe from which values are computed. Quantitative variable with no negative values.
typefct
character; spatial interaction function. Options are "pareto" (means power law) or "exponential". If "pareto" the interaction is defined as: (1 + alpha * mDistance) ^ (-beta). If "exponential" the interaction is defined as: exp(- alpha * mDistance ^ bet
span
numeric; distance where the density of probability of the spatial interaction function equals 0.5.
beta
numeric; impedance factor for the spatial interaction function.
resolution
numeric; resolution of the output SpatialPointsDataFrame (in map units).
longlat
logical; euclidean distance (FALSE, default) or Great Circle distance (TRUE). If TRUE inputs are expected in the WGS84 reference system.
mask
sp object; the spatial extent of this object is used to create the regularly spaced SpatialPointsDataFrame output. (optional)

Value

  • SpatialPointsDataFrame with the computed catchment areas in a new field nammed OUTPUT. Values match the row names of knownpts

Details

If unknownpts is NULL then resolution must be used.

References

REILLY, W. J. (1931) The law of retail gravitation, W. J. Reilly, New York.

See Also

reilly, rasterReilly, plotReilly, CreateGrid, CreateDistMatrix.

Examples

Run this code
# Create a SpatialPointsDataFrame grid of spatMask extent and 200 meters 
# resolution
data(spatData)
mygrid <- CreateGrid(w = spatMask, resolution = 200)
# Create a distance matrix between known points (spatPts) and mygrid
mymat <- CreateDistMatrix(knownpts = spatPts, unknownpts = mygrid, 
                          longlat = FALSE)
# Compute Reilly catchment areas from known points (spatPts) on a given 
# grid (mygrid) using a given distance matrix (mymat)
myreilly2 <- reilly(knownpts = spatPts, unknownpts = mygrid, 
               matdist = mymat, varname = "Capacite", 
               typefct = "exponential", span = 1250, 
               beta = 3, longlat = FALSE, mask = spatMask)
row.names(spatPts) <- spatPts$CodHop
# Compute Reilly catchment areas from known points (spatPts) on a 
# grid defined by its resolution
myreilly <- reilly(knownpts = spatPts, varname = "Capacite", 
                typefct = "exponential", span = 1250, beta = 3, 
                resolution = 200, longlat = FALSE, mask = spatMask)
# The function output a SpatialPointsDataFrame
class(myreilly)
# The OUTPUT field values match knownpts row names
head(unique(myreilly$OUTPUT))

Run the code above in your browser using DataLab