cut_sppoly: Cuts Polygons object into 2 lines of which it returns the...

Description Usage Arguments Examples

View source: R/cut_sppoly.R

Description

Each polygon is cut between the points of the polygons that are closest to pt1 and pt2

Usage

1
cut_sppoly(sppoly, pt1, pt2)

Arguments

sppoly

A Polygon object as defined the sp package.

pt1

A single-point SpatialPoint object as defined in the sp package.

pt2

A single-point SpatialPoint object as defined in the sp package.

Examples

1
2
3
4
5
6
7
8
library(sf)

# SpatialPolygonsDataFrame
vn <- sf::as_Spatial(gadmVN::gadm(level = "province"))
# SpatialPoints
stations <- as(imhen::stations, "Spatial")
stations <- df2splist(as.data.frame(stations@coords))
cut_sppoly(vn, stations[[1]], stations[[2]])

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