POLYGON LOOKUP USING KD TREES
Add xlim and ylim for each polygon
Crop polygons to bounding box and adds polygon centers
Visualize points that could not be mapped using RapidPolygonLookup()
Use range-search to map points to polygon.
Polygon lookup using kd trees
Efficient spatial polygon search using kd-trees.
Use kd-trees to search the nearest neighbour polygons for a given set ...
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.