Skip to contents

Turn a single parsed GeoJSON feature (a list with geometry and optional properties) into an annot_roi. Useful for consuming interactive drawing output.

Usage

at_roi_from_geojson(
  feature,
  label = NULL,
  level = 0L,
  source = "manual",
  call = rlang::caller_env()
)

Arguments

feature

A parsed GeoJSON feature: a list with a geometry element (type and coordinates) and optional properties.

label

Single string class label; taken from properties$label when NULL.

level

Integer pyramid level. Default 0.

source

Provenance source string. Default "manual".

call

The calling environment, for error reporting.

Value

An annot_roi.

Examples

feat <- list(geometry = list(type = "Polygon",
  coordinates = list(list(c(0, 0), c(4, 0), c(4, 4), c(0, 4), c(0, 0)))))
at_roi_from_geojson(feat, label = "region")
#> <annot_roi> region (POLYGON)
#> id: "roi_000000060"  |  level: 0  |  source: manual
#> bbox: [0, 0] - [4, 4]