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:
- Python: PySTAC
- Go: go-stac
- .NET: DotNetStac
- PHP: resto
§Data structures
STAC has three core data structures:
- Item is a GeoJSON Feature augmented with foreign members
- Catalog represents a logical group of other Catalogs, Collections, and Items
- Collection shares all fields with the
Catalog
(with different allowed values fortype
andstac_extensions
) and adds fields to describe the whole dataset and the included set ofItems
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
geo
: add some geo-enabled methods, see geogeoarrow
: read and write geoarrow, see geoarrowgeoparquet
: read and write geoparquet, see geoparquet
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;
pub use link::Link;
pub use link::Links;
Modules§
- datetime
- Datetime utilities.
- geo
geo
- Geometry utilities, enabled by the
geo
feature. - geoarrow
geoarrow
- Convert between ItemCollection and Table.
- geoparquet
geoparquet
- 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
- Item
Asset - An item asset is an object that contains details about the datafiles that will be included in member items.
- Item
Collection - A GeoJSON FeatureCollection of items.
- Provider
- This object provides information about a provider.
- Spatial
Extent - The object describes the spatial extents of the Collection.
- Statistics
- Statistics of all pixels in the band.
- Temporal
Extent - The object describes the temporal extents of the Collection.
Enums§
- Bbox
- A bounding box.
- Data
Type - 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.
- From
Json - Create a STAC object from JSON.
- From
Ndjson - 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.