https://github.com/terradue/dotnetstac
.Net library for working with any SpatioTemporal Asset Catalog (STAC)
https://github.com/terradue/dotnetstac
catalog json stac
Last synced: over 1 year ago
JSON representation
.Net library for working with any SpatioTemporal Asset Catalog (STAC)
- Host: GitHub
- URL: https://github.com/terradue/dotnetstac
- Owner: Terradue
- License: agpl-3.0
- Created: 2020-06-10T20:26:25.000Z (about 6 years ago)
- Default Branch: develop
- Last Pushed: 2023-11-02T08:02:05.000Z (over 2 years ago)
- Last Synced: 2024-04-16T11:14:31.853Z (about 2 years ago)
- Topics: catalog, json, stac
- Language: C#
- Homepage: https://terradue.github.io/DotNetStac/
- Size: 1.53 MB
- Stars: 8
- Watchers: 13
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
DotNetStac
.Net library for working with Spatio Temporal Asset Catalogs (STAC)


[](https://www.nuget.org/packages/DotNetStac/)
[](https://codecov.io/gh/Terradue/DotNetStac)
[](https://gitter.im/SpatioTemporal-Asset-Catalog/Lobby)
[](LICENSE)
[](https://mybinder.org/v2/gh/Terradue/DotNetStac/master?filepath=example.ipynb)
Features
·
Getting started
·
Documentation
·
Developing
**DotNetStac** helps you to work with [STAC](https://stacspec.org) ([catalog](https://github.com/radiantearth/stac-spec/tree/master/catalog-spec), [collection](https://github.com/radiantearth/stac-spec/tree/master/collection-spec), [item](https://github.com/radiantearth/stac-spec/tree/master/catalog-spec))
In a nutshell, the library allows serialization/desrialization of STAC JSON documents (using [Newtonsoft.JSON](https://www.newtonsoft.com/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](https://github.com/GeoJSON-Net/GeoJSON.Net) feature.
## Features
* (De)Serialization engine fully compliant with current version of [STAC specifications](https://stacspec.org)
* 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](https://github.com/JamesNK/Newtonsoft.Json.Schema)
* STAC extensions support with C# extension classes with direct accessors to the fields:
* [Electro-Optical](https://github.com/stac-extensions/eo) with `Common Band Name` enumeration
* [File Info](https://github.com/stac-extensions/file) with helpers to calculate [multihash](https://github.com/multiformats/cs-multihash) checksum
* [Processing](https://github.com/stac-extensions/processing)
* [Projection](https://github.com/stac-extensions/projection) with helpers to set `epsg` id and `wkt2` representation from [Proj.Net Coordinate Systems](https://github.com/NetTopologySuite/ProjNet4GeoAPI)
* [Raster](https://github.com/stac-extensions/raster)
* [SAR](https://github.com/stac-extensions/sar) with helpers for interferometric searches
* [Satellite](https://github.com/stac-extensions/sat) with extra orbit state vector and baseline calculation
* [Scientific Citation](https://github.com/stac-extensions/scientific)
* [View Geometry](https://github.com/stac-extensions/view)
## Getting Started
### Install package
```console
$ dotnet add package DotNetStac
```
### Deserialize and validate your first catalog
```csharp
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(json);
Console.Out.WriteLine(catalog.Id + ": " + catalog.Description + (valid ? " [VALID]" : "[INVALID]"));
Console.Out.WriteLine(catalog.StacVersion);
```
### Learn more
A [dedicated notebook](notebooks/example.ipynb) is available to get started with all DotNetStac features. If you want to play directly with the notebook, you can [](https://mybinder.org/v2/gh/Terradue/DotNetStac/develop?filepath=example.ipynb)
## 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
```