Pure builder that appends a link to a STAC document's links list.
The document is returned unchanged if a link with the same rel and href
already exists. No disk I/O is performed.
Arguments
- doc
A STAC document (
doc_catalog,doc_collection, ordoc_item).- rel
A
characterlink relation (self,root,parent,child,item,collection, etc.).- href
A
characterlink target (path or URL). Relative paths are recommended for static catalogs.- type
A
charactermedia type. Defaults to"application/json".- title
An optional
characterhuman-readable title for the link.
Value
The updated STAC document, with the new link appended and the
appropriate doc_* class preserved.
Examples
cat <- new_catalog("cat", "Catalog", "Example")
cat <- add_link(cat, "child", "collections/col/collection.json",
title = "My Collection")
item <- new_item("i", bbox = c(0, 0, 1, 1))
item <- add_link(item, "derived_from", "source.json")
