Calculates the centroid and radius of a WKT geometry.

calculate_centroid(wkt)

Arguments

wkt

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

Value

Data frame with centroid coordinates and radius in meter.

Details

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

Examples

calculate_centroid("POLYGON ((-1 -1, -1 1, 1 1, 1 -1, -1 -1))")
#> decimalLongitude decimalLatitude coordinateUncertaintyInMeters #> 1 0 0 156899.6
calculate_centroid("MULTIPOLYGON (((-1 -1, -1 1, 1 1, 1 -1, -1 -1)))")
#> decimalLongitude decimalLatitude coordinateUncertaintyInMeters #> 1 0 0 156899.6
calculate_centroid("LINESTRING (-1 -1, 0 -1, 0 1, 1 1)")
#> decimalLongitude decimalLatitude coordinateUncertaintyInMeters #> 1 0 0 156899.6
calculate_centroid("MULTILINESTRING ((-1 -1, 0 -1, 0 1, 1 1), (-3 -3, 3 3))")
#> decimalLongitude decimalLatitude coordinateUncertaintyInMeters #> 1 0 0 470605
calculate_centroid("POINT (0 0)")
#> decimalLongitude decimalLatitude coordinateUncertaintyInMeters #> 1 0 0 0
calculate_centroid("MULTIPOINT ((0 1), (0 -1))")
#> decimalLongitude decimalLatitude coordinateUncertaintyInMeters #> 1 0 0 110574.4