cell.arealw {AIGIS} | R Documentation |
Given the bounds of a rectangular region, and the zones of interest, find areal weights for that region as though it was a target polygon. Basically just a sequential wrapper of gc2gpc
and arealw
.
cell.arealw(bounds, trimout = TRUE, zones = cabggpc, zbbmat = cabgbbmat, zoneareas = rbgarea, twokcensus = TRUE, digits = 6)
bounds |
A vector of length four, who's entries are (in order): Minimum longitude, maximum longitude, minimum latitude, maximum latitude. |
trimout |
Logical indicating output format. See Value for details. |
zones |
List of zonal polygons for which fractional overlap is to be determined. |
zbbmat |
“Zonal bounding box matrix.” Either a matrix of dimension length(zones) by 4, or character “none”. If “none,” an appropriate matrix is automatically computed by a call to bbox.mat . See ‘Details.’ |
zoneareas |
A vector giving the area of each zone, or character “none”, indicating they must be calculated inside the function. |
twokcensus |
Logical indicating whether the data in question is block group level data for California from the 2000 US Census. If ‘TRUE’, the function automatically handles certain ideosyncracies associated with that data. |
digits |
Digits argument passed to round internally. Used in setting the tolerance for considering fractional overlap to be 100 percent. Due to numerical issues, overlap will not always be identically 1 even when a zone is contained entirely within the target. There should be little reason to modify this away from the default value of six. |
If not “none”, ‘zbbmat’ must take the form of a length(zones)
by 4 matrix, where each row corresponds to the bounding latitude and longitude values for polygons in ‘zones’, the same format returned by the function bbox.mat
. The columns correspond to low longitude, high longitude, low latitude and high latitude respectively.
If trimout equals 'FALSE', the function returns a vector with length equal to the number of zones, and each entry corresponding to the fractional overlap for that zone. Since a large number of entries are likely to be zero, this is a wasteful storage method, but may be valuable as a convenient format with which to perform certain manual operations on the data.
Setting trimout equal to 'TRUE' returns an ‘n’ by 2 matrix, where ‘n’ is the number of zones with nonzero overlap. The first column contains the indices fo those zones, and the second column contains the actual overlap weights.
The US Census 2000 data for California contains a mismatch between the number of block groups and the number of block group polygons. The code handles this provided twokcensus
is set to 'TRUE', but for all other datasets it as assumed that the number of datarecords is equal to the number of zones, and that the indexes match as well. If not, one or the other needs to be sorted appropriately.
Benjamin P. Bryant, bryant@prgs.edu
For general overview of areal interpolation and terminology, see Sadahiro, Y. Accuracy of areal interpolation: A comparison of alternative methods. Journal of Geographical Systems 1(4): 323-346 (1999).
data(cabgbbmat) data(cabggpc) data(rbgarea) data(polytobg) #An eight degree cell near the Orange/San Diego county border: moh <- cell.arealw(bounds=c(-117.625,-117.5,33.375,33.5),trimout=TRUE)