Skip to contents

This function reads a KML file and processes the specified columns to extract feature identifiers and descriptive attributes, returning an sf object that retains the geometry and parsed attribute data.

Usage

load_kml_sf(kml_path, ..., id_col = "Name", details_col = "Description")

Arguments

kml_path

A character string specifying the path to the KML file. The path can be a local file or a URL, and zipped files are supported.

...

Additional arguments passed to sf::read_sf() for reading the KML file.

id_col

A character string indicating the column in the KML file that contains feature identifiers (default is "Name").

details_col

A character string specifying the column that contains descriptive data to be parsed (default is "Description").

Value

An sf object containing the geometry and parsed attributes extracted from the KML file.

Details

The function parses the details_col to extract key-value pairs in the format "label: value", ensuring that all features have a consistent structure. Any missing values are handled appropriately.

Examples

if (FALSE) { # \dontrun{
# Example usage:
# kml_file <- "path/to/your/file.kml"
# result_sf <- load_kml_sf(kml_file)
} # }