Awesome
<h1 align="center"> DotNetStac</h1> <h2 align="center"> .Net library for working with Spatio Temporal Asset Catalogs (<a href="https://stacspec.org">STAC</a>) </h2> <h3 align="center"> </h3> <h3 align="center"> <a href="#Features">Features</a> <span> · </span> <a href="#Getting-Started">Getting started</a> <span> · </span> <a href="#Documentation">Documentation</a> <span> · </span> <a href="#Developing">Developing</a> </h3>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.
Features
- (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
Getting Started
Install package
$ dotnet add package DotNetStac
Deserialize and validate your first catalog
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);
Learn more
A dedicated notebook is available to get started with all DotNetStac features. If you want to play directly with the notebook, you can
Documentation
An API documentation site is available at https://terradue.github.io/DotNetStac.
Developing
To ensure development libraries are installed, restore all dependencies
> dotnet restore src
Unit Tests
Unit tests are in the src/DotNetStac.Test
folder. To run unit tests:
> dotnet test src