Clips an area from a larger shape file (SpatialPolygons).
clip_shapefile(
x,
limits = NULL,
proj.limits = "+init=epsg:4326",
simplify = FALSE,
tol = 60,
return.boundary = FALSE
)Original shape file to be clipped. Required. Must contain proj4string information.
The constraining area used to clip x. Required. Either a numeric vector of length 4 or a SpatialPolygons object. The first element of the numeric vector defines the minimum longitude, second element the maximum longitude, third element the minimum latitude and fourth element the maximum latitude of the bounding box. The SpatialPolygons object must contain proj4string information. See details.
The proj4string projection attributes for limits. Defaults to decimal degrees (see **Usage**).
Should the x geometry be simplified before clipping? Useful to make the function faster for large shape files. Uses rgeos::gSimplify function.
Numerical tolerance value to be used for simplification. See ?rgeos::gSimplify.
logical. If TRUE returns the clip boundary together with the shapefile
Clipped SpatialPolygons object. If return.boundary = TRUE, a list containing the shapefile together with the clip boundary.
The function uses the rgeos::gIntersection function to clip smaller SpatialPolygons from larger ones. The clip area is constrained by either a numeric vector or SpatialPolygons object in the limits argument. One of these arguments must be given. Defining limits by a SpatialPolygons object gives greater freedom for the clip area as the area does not have to be rectangular.
Other create shapefiles:
raster_bathymetry(),
vector_bathymetry()