Extracts reproducible geometric and urban-morphology descriptors from polygon and multipart polygon building footprints stored as sf objects. Methods include area, perimeter, compactness, shape, bounding-box, topology, convexity, and orientation measures, together with optional building-height, floor-count, gross-floor-area, floor-space-index, coverage, volume, and floor-height metrics derived from explicitly named attribute columns. The resulting sf objects preserve the source attributes and geometry for spatial analysis, visualization, and downstream statistical or machine-learning workflows, with optional future-based parallel processing for larger datasets.
A focused R package for extracting geometric and morphological features from polygon and multipolygon building footprints represented in sf objects.
The objective is to provide a clean, transparent, reproducible API to compute raw geometric and morphology descriptors that can feed further spatial or machine-learning workflows.
Install directly from GitHub with:
if (!requireNamespace("remotes", quietly = TRUE)) {
install.packages("remotes")
}
remotes::install_github("YOUR_USERNAME/geomorphR")
library(sf)
library(geomorphR)
geojson_path <- system.file("extdata", "central_gbg.geojson", package = "geomorphR")
buildings <- sf::st_read(geojson_path)
features <- extract_geometric_features(
buildings,
height_col = "height_m",
floors_col = "floor_count",
orientation_col = "orientation_degrees",
gfa_col = "gfa_m2",
plot_area_col = "plot_area_m2",
verbose = FALSE,
use_parallel = FALSE
)
Attribute-based metrics are opt-in because datasets use different field names. Pass the source columns explicitly:
features <- extract_geometric_features(
buildings,
height_col = "height_m",
floors_col = "floor_count",
gfa_col = "gfa_m2",
plot_area_col = "plot_area_m2",
verbose = FALSE
)
The function adds building volume, floor height, GFA, FSI, coverage ratio, height-to-width ratio, and orientation in degrees. If no orientation column is supplied, orientation is estimated from the minimum rotated rectangle. Use validate_morphology_columns() to inspect whether source fields exist and are numeric before extraction.