crop_on_poly: Crops a raster file according to a polygon

Description Usage Arguments Examples

View source: R/crop_on_poly.R

Description

Crops a raster file according to a polygon

Usage

1
crop_on_poly(rstr, plgn)

Arguments

rstr

raster

plgn

spatial polygon sp

Examples

1
2
3
4
5
6
7
8
library(sf)
# download vietnam admin1 administrative map in the internal library and in
# the working direction
vn <- sptools::gadm("vietnam", "sf", 1, intlib = TRUE, save = TRUE)

provinces <- as(vn["VARNAME_1"], "Spatial")
srtm <- srtmVN::getsrtm()
hanoi <- crop_on_poly(srtm, subset(provinces, VARNAME_1 == "Ha Noi"))

choisy/sptools documentation built on Aug. 22, 2019, 12:57 p.m.