reilly: Reilly Catchment Areas

Description Usage Arguments Value References See Also Examples

View source: R/reilly.R

Description

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

Usage

1
2
3
reilly(knownpts, unknownpts = NULL, matdist = NULL, varname,
  typefct = "exponential", span, beta, resolution = NULL, mask = NULL,
  bypassctrl = FALSE, longlat = TRUE)

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; distance matrix between known observations and unknown units for which the function computes the estimates. Row names match the row names of knownpts and column names match the row names of unknownpts. matdist can contain any distance metric (time distance or euclidean distance for example). If matdist is NULL, the distance matrix is built with CreateDistMatrix. (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 ^ beta). The alpha parameter is computed from parameters given by the user (beta and span).

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). If resolution is not set, the grid will contain around 7250 points. (optional)

mask

sp object; the spatial extent of this object is used to create the regularly spaced SpatialPointsDataFrame output. (optional)

bypassctrl

logical; bypass the distance matrix size control (see CreateDistMatrix Details).

longlat

logical; if FALSE, Euclidean distance, if TRUE Great Circle (WGS84 ellipsoid) distance.

Value

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

References

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

See Also

reilly, rasterReilly, plotReilly, CreateGrid, CreateDistMatrix.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 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)
# 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, 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, mask = spatMask)
# The function output a SpatialPointsDataFrame
class(myreilly)
# The OUTPUT field values match knownpts row names
head(unique(myreilly$OUTPUT))

SpatialPosition documentation built on Sept. 6, 2017, 5:04 p.m.