calculate_centroid: Calculates the centroid and radius of a WKT geometry.

View source: R/calculate_centroid.R

calculate_centroidR Documentation

Calculates the centroid and radius of a WKT geometry.

Description

Calculates the centroid and radius of a WKT geometry.

Usage

calculate_centroid(wkt)

Arguments

wkt

character vector One or more WKT strings with longitude/latitude coordinates (EPSG=4326)

Details

The centroid is defined as the centroid of the convex hull of the provided geometry.

Value

Data frame with centroid coordinates and radius in meter.

Examples

calculate_centroid("POLYGON ((-1 -1, -1 1, 1 1, 1 -1, -1 -1))")
calculate_centroid("MULTIPOLYGON (((-1 -1, -1 1, 1 1, 1 -1, -1 -1)))")
calculate_centroid("LINESTRING (-1 -1, 0 -1, 0 1, 1 1)")
calculate_centroid("MULTILINESTRING ((-1 -1, 0 -1, 0 1, 1 1), (-3 -3, 3 3))")
calculate_centroid("POINT (0 0)")
calculate_centroid("MULTIPOINT ((0 1), (0 -1))")

iobis/obistools documentation built on March 19, 2024, 6:27 a.m.