CropSpatialPolygonsDataFrame {RapidPolygonLookup} | R Documentation |
Crop polygons to bounding box and adds polygon centers
Description
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
Usage
CropSpatialPolygonsDataFrame(x, bb = NULL, verbose = 0)
Arguments
x |
object of class SpatialPolygonsDataFrame |
bb |
bounding box to crop the polygons |
verbose |
level of verbosity |
Value
New list with separate entries for data, polys, and poly centers
Author(s)
Markus Loecher <markus.loecher@gmail.com> and Madhav Kumar <madhavkumar2005@gmail.com>
Examples
# San Francisco:
data(california.tract10, envir = environment())
sf.polys <- CropSpatialPolygonsDataFrame(x= california.tract10,
bb= data.frame(X=c(-122.5132, -122.37),
Y= c(37.70760, 37.81849)))
[Package RapidPolygonLookup version 0.1.1 Index]