Crate stac_extensions

Source
Expand description

Extensions describe how STAC can use extensions that extend the functionality of the core spec or add fields for specific domains.

Extensions can be published anywhere, although the preferred location for public extensions is in the GitHub stac-extensions organization. This crate currently supports only a few extensions, though we plan to add more as we find the time. See https://stac-extensions.github.io/ for the latest table of community extensions. This table below lists all stable extensions, as well as any other extensions that are supported by stac-rs:

ExtensionMaturitystac-rs supported version
AuthenticationProposalv1.1.0
Electro-OpticalStablev1.1.0
File InfoStablen/a
LandsatStablen/a
ProjectionStablev1.1.0
RasterCandidatev1.1.0
Scientific CitationStablen/a
View GeometryStablen/a

§Usage

Item, Collection, and Catalog all implement the Extensions trait, which provides methods to get, set, and remove extension information:

use stac::Item;
use stac_extensions::{Extensions, Projection, projection::Centroid};
let mut item: Item = stac::read("examples/extensions-collection/proj-example/proj-example.json").unwrap();
assert!(item.has_extension::<Projection>());

// Get extension information
let mut projection: Projection = item.extension().unwrap();
println!("code: {}", projection.code.as_ref().unwrap());

// Set extension information
projection.centroid = Some(Centroid { lat: 34.595302, lon: -101.344483 });
Extensions::set_extension(&mut item, projection).unwrap();

// Remove an extension
Extensions::remove_extension::<Projection>(&mut item);
assert!(!item.has_extension::<Projection>());

Re-exports§

pub use projection::Projection;
pub use raster::Raster;

Modules§

authentication
Provides a standard set of fields to describe authentication and authorization schemes, flows, and scopes required to access Assets and Links that align with the OpenAPI security spec.
electro_optical
The electro-optical extension.
projection
The Projection extension.
raster
The Raster extnesion.

Traits§

Extension
A trait implemented by extensions.
Extensions
A trait for objects that may have STAC extensions.