DotNetStac helps you to work with STAC (catalog, collection, item)
In a nutshell, the library allows serialization/desrialization of STAC JSON documents (using Newtonsoft.JSON) to typed object modeling STAC objects with properties represented in enhanced objects such as geometries, time stamp/period/span, numerical values and many more via STAC extension plugins engine. Stac Item object is based on GeoJSON.Net feature.
- (De)Serialization engine fully compliant with current version of STAC specifications
- Many helpers to support STAC objects manipulation:
- Field accessors using class properties and common metadata (e.g. Title, DateTime, Geometry)
- Collection creation helper summarizing Items set
- JSON Schema validation using Json.NET Schema
- STAC extensions support with C# extension classes with direct accessors to the fields:
- Electro-Optical with
Common Band Name
enumeration - File Info with helpers to calculate multihash checksum
- Processing
- Projection with helpers to set
epsg
id andwkt2
representation from Proj.Net Coordinate Systems - Raster
- SAR with helpers for interferometric searches
- Satellite with extra orbit state vector and baseline calculation
- Scientific Citation
- View Geometry
- Electro-Optical with
$ dotnet add package DotNetStac
using Stac;
using Stac.Schemas;
using System;
using System.Net;
using Newtonsoft.Json.Schema;
var webc = new WebClient();
Uri catalogUri = new Uri("https://raw.githubusercontent.com/radiantearth/stac-spec/master/examples/catalog.json");
StacValidator stacValidator = new StacValidator(new JSchemaUrlResolver());
// StacConvert.Deserialize is the helper to start loading any STAC document
var json = webc.DownloadString(catalogUri);
bool valid = stacValidator.ValidateJson(json);
StacCatalog catalog = StacConvert.Deserialize<StacCatalog>(json);
Console.Out.WriteLine(catalog.Id + ": " + catalog.Description + (valid ? " [VALID]" : "[INVALID]"));
Console.Out.WriteLine(catalog.StacVersion);
A dedicated notebook is available to get started with all DotNetStac features. If you want to play directly with the notebook, you can
An API documentation site is available at https://terradue.github.io/DotNetStac.
To ensure development libraries are installed, restore all dependencies
> dotnet restore src
Unit tests are in the src/DotNetStac.Test
folder. To run unit tests:
> dotnet test src