Learn R Programming

tmap (version 0.6)

crop_shape: Crop shape file

Description

Crops a shape object, to a rectangle which is by default its bounding box.

Usage

crop_shape(shp, bbox = shp@bbox)

Arguments

shp
shape object.
bbox
rectangle to crop the shp with. It is represented by a 2x2 matrix in which the x and y coordiantes are respectively row 1 and 2, and the minimum and maximum values are respectively column 1 and 2. By default the bounding box of shp

Value

  • a cropped shape object. Its bounding box is set to bb. Data is retained in case shp has data. A vector of matched ID's is stored as a attribute matchID. This vector contains for each polygon in the returned shape object the number of its orignal polygon in shp.