Crate stac

Source
Expand description

Rust implementation of the SpatioTemporal Asset Catalog (STAC) specification.

The SpatioTemporal Asset Catalog (STAC) specification provides a common language to describe a range of geospatial information, so it can more easily be indexed and discovered. A ‘spatiotemporal asset’ is any file that represents information about the earth captured in a certain space and time.

This is a Rust implementation of the specification. Similar projects in other languages include:

§Data structures

STAC has three core data structures:

All three are provided as serde (de)serializable structures with public attributes. Each structure provides a new method that fills most of the object’s attributes with sensible defaults:

use stac::{Item, Catalog, Collection};
let item = Item::new("id");
let catalog = Catalog::new("id", "description");
let collection = Catalog::new("id", "description");

All attributes of STAC objects are accessible as public members:

use stac::{Item, Link};
let mut item = Item::new("id");
assert_eq!(item.id, "id");
assert!(item.geometry.is_none());
assert!(item.links.is_empty());
item.links.push(Link::new("an/href", "a-rel-type"));

§Value

A Value can represent any of the three core data structures or an ItemCollection. It’s the serde_json::Value for rustac:

use stac::{Value, Item};

let value = Value::Item(Item::new("an-id"));

Value implements most traits that are shared between the data structures, so users of this library can do work (e.g. migration) without needing to know what type of object the value represents:

use stac::{Value, Migrate, Version};

let value: Value = stac::read("examples/simple-item.json").unwrap();
let value = value.migrate(&Version::v1_1_0).unwrap();

§Features

Re-exports§

pub use geoparquet::FromGeoparquet;geoparquet
pub use geoparquet::IntoGeoparquet;geoparquet
pub use href::SelfHref;
pub use item::FlatItem;
pub use item::Item;
pub use item::Properties;

Modules§

datetime
Datetime utilities.
geogeo
Geometry utilities, enabled by the geo feature.
geoarrowgeoarrow
Convert between ItemCollection and Table.
geoparquetgeoparquet
Read data from and write data in stac-geoparquet.
href
Utilities and structures for working with hrefs.
item
STAC Items.
link
Links.
mime
Media Types are a key element that enables STAC to be a rich source of information for clients.

Structs§

Asset
An Asset is an object that contains a URI to data associated with the Item that can be downloaded or streamed.
Band
Bands are used to describe the available bands in a STAC entity or Asset.
Catalog
A STAC Catalog object represents a logical group of other Catalog, Collection, and Item objects.
Collection
The STAC Collection Specification defines a set of common fields to describe a group of Items that share properties and metadata.
Extent
The object describes the spatio-temporal extents of the Collection.
Geometry
Geometry Objects
ItemAsset
An item asset is an object that contains details about the datafiles that will be included in member items.
ItemCollection
A GeoJSON FeatureCollection of items.
Provider
This object provides information about a provider.
SpatialExtent
The object describes the spatial extents of the Collection.
Statistics
Statistics of all pixels in the band.
TemporalExtent
The object describes the temporal extents of the Collection.

Enums§

Bbox
A bounding box.
DataType
The data type gives information about the values in the file.
Error
Error enum for crate-specific errors.
Type
Enum for the four “types” of STAC values.
Value
An enum that can hold any STAC object type.
Version
A version of the STAC specification.

Constants§

STAC_VERSION
The default STAC version of this library.

Traits§

Assets
Trait implemented by anything that has assets.
Fields
Trait for structures that have gettable and settable fields.
FromJson
Create a STAC object from JSON.
FromNdjson
Create a STAC object from newline-delimited JSON.
Migrate
Migrates a STAC object from one version to another.
ToJson
Writes a STAC object to JSON bytes.
ToNdjson
Write a STAC object to newline-delimited JSON.

Functions§

read
A simple function to read a STAC value from a JSON file local filesystem.
version
Return this crate’s version.

Type Aliases§

Result
Custom Result type for this crate.