Skip to contents

Parses one readme.txt or readme.md written to the ABMI spatial metadata template into a named list of fields. Field labels are normalised to snake_case keys, so West Bounding Coordinate: becomes west_bounding_coordinate and sub-fields indented under a parent label are prefixed with it (extent_west_bounding_coordinate).

Usage

read_metadata(path)

Arguments

path

Character; path to a readme file.

Value

A named list of length-one character values with class sciSpatial_metadata, carrying the source path and the template sections found as attributes. Fields defined in the template but absent from the file are returned as NA.

Details

Every Label: value line is captured, including fields the template does not define, so nothing in a readme is silently dropped. Unfilled template placeholders such as [Data Title] and non-values such as "Not Specified" are returned as NA.

See also

layer_meta() to read metadata by layer name, as_metadata_row() to flatten it to a one-row data.frame, and check_metadata() to audit completeness.

Examples

if (FALSE) { # \dontrun{
md <- read_metadata(
  file.path(spatial_root(), "elevation", "fab_dem", "readme.txt")
)
md$title
md$extent_west_bounding_coordinate
} # }