A vector of distances from base dataset xy to the nearest feature xy
Arguments
base
base dataset (eg gridcells)
feat
feature dataset (eg another crime generator)
bxy
vector of strings that define what the base xy fields are defined as, defaults c('x','y')
fxy
vector of strings that define what the base xy fields are defined as, defaults c('x','y')
Details
This generates a distance to nearest, based on the provided x/y coordinates (so if using polygons pass the centroid).
This uses kd-trees from RANN, so should be reasonably fast. But I do no projection checking, that is on you. You should not
use this with spherical coordinates. Useful for feature engineering for crime generators.
References
Caplan, J. M., Kennedy, L. W., & Miller, J. (2011). Risk terrain modeling: Brokering criminological theory and GIS methods for crime forecasting. Justice Quarterly, 28(2), 360-381.
Wheeler, A. P., & Steenbeek, W. (2021). Mapping the risk terrain for crime using machine learning. Journal of Quantitative Criminology, 37(2), 445-480.
See Also
count_xy() for counting points inside of base polygon
dcount_xy() for counting points within distance of base polygon
kern_xy() for estimating gaussian density of points for features at base polygon xy coords
bisq_xy() for estimate bi-square kernel of points for features at base polygon xy coords
idw_xy() for estimate inverese distance weighted of points for features at base polygon xy coords