Learn R Programming

terra (version 1.7-55)

width: SpatVector geometric properties

Description

width returns the minimum diameter of the geometry, defined as the smallest band that contains the geometry, where a band is a strip of the plane defined by two parallel lines. This can be thought of as the smallest hole that the geometry can be moved through, with a single rotation.

clearance returns the minimum clearance of a geometry. The minimum clearance is the smallest amount by which a vertex could be moved to produce an invalid polygon, a non-simple linestring, or a multipoint with repeated points. If a geometry has a minimum clearance of 'mc', it can be said that:

No two distinct vertices in the geometry are separated by less than 'mc' No vertex is closer than 'mc' to a line segment of which it is not an endpoint. If the minimum clearance cannot be defined for a geometry (such as with a single point, or a multipoint whose points are identical, NA is returned.

Usage

# S4 method for SpatVector
width(x, as.lines=FALSE)
# S4 method for SpatVector
clearance(x, as.lines=FALSE)

Value

numeric or SpatVector

Arguments

x

SpatVector of lines or polygons

as.lines

logical. If TRUE lines are returned that define the width or clearance

See Also

minRect

Examples

Run this code
f <- system.file("ex/lux.shp", package="terra")
v <- vect(f)
width(v)
clearance(v)

Run the code above in your browser using DataLab