Given spatial partitions such as census blocks, ZIP codes or police district boundaries, we are frequently faced with the need to spatially aggregate data. Unless efficient data structures are used, this can be a daunting task. The operation point.in.polygon() from the package sp is computationally expensive. Here, we exploit kd-trees as efficient nearest neighbor search algorithm to dramatically reduce the effective number of polygons being searched. Points that are left unmapped are put through a linear search to find the associated polygon.
● Data Source:
CranContrib
● Keywords:
● Alias: RapidPolygonLookup
●
1 images
|
This package facilitates efficient polygon search using kd trees. Coordinate level spatial data can be aggregated to higher geographical identities like census blocks, ZIP codes or police district boundaries. This process requires mapping each point in the given data set to a particular identity of the desired geographical hierarchy. Unless efficient data structures are used, this can be a daunting task. The operation point.in.polygon() from the package sp is computationally expensive. Here, we exploit kd-trees as efficient nearest neighbor search algorithm to dramatically reduce the effective number of polygons being searched.
● Data Source:
CranContrib
● Keywords: package
● Alias: RapidPolygonLookup-package
●
0 images
|
This function serves three purposes: (i) changes the (complicated) data structure of a spatial polygon (from the sp package) to a format which is aligned with the (simpler) PBSmapping polygon format. (ii) clips/crops the polygons to a pre specified bounding box (iii) computes and adds the polygon centers for each polygon
● Data Source:
CranContrib
● Keywords:
● Alias: CropSpatialPolygonsDataFrame
●
0 images
|
This function searches the lat-long ranges of polygons to come up with a shorter list of candidates on which point.in.polygon() from the sp package can be applied.
● Data Source:
CranContrib
● Keywords:
● Alias: FindPolygonInRanges
●
0 images
|
DiagnoseFailure
(Package: RapidPolygonLookup) :
Visualize points that could not be mapped using RapidPolygonLookup()
This functions plots the points that could not be mapped using RapidPolygonLookup() The points are overlayed on the polygons to contextualize their geographical location and understand the reason behind their exclusion.
● Data Source:
CranContrib
● Keywords:
● Alias: DiagnoseFailure
●
0 images
|
SearchForPolygon
(Package: RapidPolygonLookup) :
Use kd-trees to search the nearest neighbour polygons for a given set of points
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.
● Data Source:
CranContrib
● Keywords:
● Alias: SearchForPolygon
●
0 images
|
This function computes the bounding box for each polygon and adds this information to the list. The bounding boxes can be used in various applications. Our main motivation is for the massive PointsInPolygon search to exclude those polygons as candidates whose bounding box does not contain the current point.
● Data Source:
CranContrib
● Keywords:
● Alias: AddRanges
●
0 images
|