Utility to create efficient quadtree spatial index of any set of lat,lon
Source:R/PROXIMITY_FUNCTIONS.R
indexpoints.Rd
Index a list of points (e.g., schools)
so getpointsnearby()
can find them very quickly
Usage
indexpoints(pts, indexname = "custom_index", envir = globalenv())
Value
Just returns TRUE when done. Side effect is to
put into the globalenv()
(or specified envir) that spatial index with name defined by indexname,
as created by indexpoints()
.
Details
This creates a spatial index
to be used by getpointsnearby()
to support proxistat()
,
to create a new proximity score for every block and block group in the US.
It relies on create_quaddata()
for one step, then SearchTrees::createTree()
Examples
# \donttest{
# EXAMPLES NOT TESTED YET ***
pts <- testpoints_10
tempenv <- new.env()
index10 <- indexpoints(pts, "index10", envir = tempenv)
#> cleaning/checking latitude and longitude values
#> Building index of 10 points, to be called index10 and loaded in specified environment e.g., globalenv()
#> Warning: only supports idcolname NULL, id, or blockid - ignoring the name provided and creating unique id column called pointid
#> creating quaddata format table before indexing
#> Done building index of 10 points.
x <- getpointsnearby(pts, quadtree = get(index10, envir = tempenv))
#> Error in getpointsnearby(pts, quadtree = get(index10, envir = tempenv)): must provide topoints
# y <- proxistat(pts)
# rm(custom_index)
# }