Skip to content

Terradue/DotNetStac

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ee12ff3 · Sep 17, 2021
Apr 29, 2021
Jun 7, 2021
Apr 1, 2021
May 26, 2021
May 26, 2021
Sep 17, 2021
May 31, 2021
Sep 17, 2021
Jun 10, 2020
Sep 17, 2021
May 25, 2021
Jun 3, 2021
Jul 6, 2021

Repository files navigation

DotNetStac

.Net library for working with Spatio Temporal Asset Catalogs (STAC)

Build Status NuGet codecov Gitter License Binder

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

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 Binder

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