SearchForPolygon: Use kd-trees to search the nearest neighbour polygons for a...

Description Usage Arguments Value Author(s) Examples

Description

This function uses the nn2() function from the RANN package to come up with a shorter list of candidates on which point.in.polygon() from the sp package can be applied.

Usage

1
2
SearchForPolygon(poly.list, XY, k, poly.id, poly.id.colname, 
    verbose = 0)

Arguments

poly.list

polygon list with 3-4 elements: poly.centers, data, polys and possibly ranges

XY

data frame containing X-Y columns to assign polygons to

k

maximum number of nearest neighbours to compute. The default value is set to 10.

poly.id

column name in 'poly.list$data' containing the polygon identifier

poly.id.colname

desired column name in the output data frame containing the polygon identifier

verbose

level of verbosity

Value

Returns data frame with identified polygon and nearest neighbour rank

Author(s)

Markus Loecher <markus.loecher@gmail.com> and Madhav Kumar <madhavkumar2005@gmail.com>

Examples

1
2
3
4
5
data(sf.crime.2012, envir = environment())
data(sf.polys, envir = environment())
XY.polys <- SearchForPolygon(poly.list= sf.polys, XY= sf.crime.2012[1:1000,], k= 10,
                             poly.id= "fips", poly.id.colname= "census.block",
                             verbose= TRUE)

RapidPolygonLookup documentation built on May 2, 2019, 7:08 a.m.