calculate_spatial_coverage {GeoThinneR}R Documentation

Calculate Spatial Coverage (Convex Hull Area)

Description

Computes the area of the convex hull formed by the points. Uses geodetic area (km2) if coordinates are lon/lat and distance = "haversine", otherwise computes area in squared map units.

Usage

calculate_spatial_coverage(coordinates, distance = "haversine")

Arguments

coordinates

A matrix of coordinates (longitude and latitude or planar x/y).

distance

A character string: "haversine" (default) or "euclidean".

Value

A numeric value representing the convex hull area (km2 or unit2).

Examples

# Geographic coordinates (lon/lat)
set.seed(456)
coords_geo <- matrix(cbind(runif(10, -10, 10), runif(10, 40, 50)), ncol = 2)
area_haversine <- calculate_spatial_coverage(coords_geo, distance = "haversine")
print(round(area_haversine, 2))  # in km2

# Projected coordinates (Euclidean/map units)
coords_proj <- matrix(runif(20), ncol = 2) * 100  # e.g., map units
area_euclidean <- calculate_spatial_coverage(coords_proj, distance = "euclidean")
print(round(area_euclidean, 2))  # in unit2


[Package GeoThinneR version 2.0.0 Index]