Skip to content

Commit

Permalink
Merge branch 'release/1.7.2'
Browse files Browse the repository at this point in the history
emmanuelmathot committed Oct 31, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 68f9d9a + 6dc704f commit 1ef9b20
Showing 10 changed files with 115 additions and 15 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -7,7 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

## [1.7.1](https://github.com/Terradue/DotNetStac/compare/1.7.0...1.7.1)
## [1.7.2](https://github.com/Terradue/DotNetStac/compare/1.7.1...1.7.2)

### Commits

- StacLink clone [`aaace21`](https://github.com/Terradue/DotNetStac/commit/aaace214f6bf7bd8398a4ddfeb73057b9f8ea9f7)

## [1.7.1](https://github.com/Terradue/DotNetStac/compare/1.7.0...1.7.1) - 2023-02-22

### Merged

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -12,9 +12,9 @@

<h3 align="center">

![Build Status](https://github.com/Terradue/DotNetStac/actions/workflows/build.yaml/badge.svg?branch=release/1.7.1)
![Build Status](https://github.com/Terradue/DotNetStac/actions/workflows/build.yaml/badge.svg?branch=release/1.7.2)
[![NuGet](https://img.shields.io/nuget/vpre/DotNetStac)](https://www.nuget.org/packages/DotNetStac/)
[![codecov](https://codecov.io/gh/Terradue/DotNetStac/branch/release/1.7.1/graph/badge.svg)](https://codecov.io/gh/Terradue/DotNetStac)
[![codecov](https://codecov.io/gh/Terradue/DotNetStac/branch/release/1.7.2/graph/badge.svg)](https://codecov.io/gh/Terradue/DotNetStac)
[![Gitter](https://img.shields.io/gitter/room/SpatioTemporal-Asset-Catalog/Lobby?color=yellow)](https://gitter.im/SpatioTemporal-Asset-Catalog/Lobby)
[![License](https://img.shields.io/badge/license-AGPL3-blue.svg)](LICENSE)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/Terradue/DotNetStac/master?filepath=example.ipynb)
8 changes: 4 additions & 4 deletions docs/docfx.json
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
"src": ".."
}
],
"dest": "api",
"dest": "lib",
"disableGitFeatures": false,
"disableDefaultFilter": false
}
@@ -21,8 +21,8 @@
"content": [
{
"files": [
"api/**.yml",
"api/index.md"
"lib/**.yml",
"lib/index.md"
]
},
{
@@ -44,7 +44,7 @@
"overwrite": [
{
"files": [
"apidoc/**.md"
"libdoc/**.md"
],
"exclude": [
"obj/**",
8 changes: 4 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ In a nutshell, the library allows serialization/desrialization of STAC JSON docu

## Reference API

Looking for the reference API docs, go directly to [https://terradue.github.io/DotNetStac/api/].
Looking for the reference API docs, go directly to [https://terradue.github.io/DotNetStac/lib/].

## Getting Started

@@ -33,7 +33,7 @@ dotnet add package DotNetStac

### Deserialization of STAC documents

The (de)serialiation methods are wrapped in methods in [class `StacConvert`](https://terradue.github.io/DotNetStac/api/Stac.StacConvert.html) that is the main entry point from/to JSON/.Net.
The (de)serialiation methods are wrapped in methods in [class `StacConvert`](https://terradue.github.io/DotNetStac/lib/Stac.StacConvert.html) that is the main entry point from/to JSON/.Net.

Let's start reading a STAC catalog online. Please note that DotNetStac does not provide with data access middleware. You can integrate own data access or you can test the [`Stars` SDK](https://github.com/Terradue/Stars) that provides with integrated functions to manipulate STAC objects and their storage.

@@ -63,7 +63,7 @@ Please note the following:

* `GetChildrenLinks` and `GetItemLinks` are the recommanded ways to get the links for navigating through the tree.
* The previous functions as the rest of the library does not alter the `Uri`s. It is then up to the developer to resolve the relative ones. As in the code, Uri class provides with all the necessary methods to easily join a base Url with a relative one.
* The `StacConvert.Deserialize<>` methods allows to specify the interfaces to ease the deserialization when the STAC type is unknown: [`IStacObject`](https://terradue.github.io/DotNetStac/api/Stac.IStacObject.html) and [`IStacCatalog`](https://terradue.github.io/DotNetStac/api/Stac.IStacCatalog.html).
* The `StacConvert.Deserialize<>` methods allows to specify the interfaces to ease the deserialization when the STAC type is unknown: [`IStacObject`](https://terradue.github.io/DotNetStac/lib/Stac.IStacObject.html) and [`IStacCatalog`](https://terradue.github.io/DotNetStac/lib/Stac.IStacCatalog.html).

```csharp
using System.Linq;
@@ -281,7 +281,7 @@ using System.Collections.Generic;

#### Collection generation from a set of Items

[`StacCollection` class](https://terradue.github.io/DotNetStac/api/Stac.StacCollection.html) has static methods allowing the automatic generation of a collection from a set of `StacItem`. The following code loads the items of [the examples folder from STAC repository](https://github.com/radiantearth/stac-spec/tree/master/examples) and generates the corresponding collection with
[`StacCollection` class](https://terradue.github.io/DotNetStac/lib/Stac.StacCollection.html) has static methods allowing the automatic generation of a collection from a set of `StacItem`. The following code loads the items of [the examples folder from STAC repository](https://github.com/radiantearth/stac-spec/tree/master/examples) and generates the corresponding collection with
- **Spatial and temporal extent** from geometry and time merge of the items
- **Fields summaries** with stats objects or value sets of the items' fields values

File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions docs/toc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- name: Articles
href: articles/
- name: Api Documentation
href: api/
homepage: api/index.md
- name: Library Documentation
href: lib/
homepage: lib/index.md
93 changes: 93 additions & 0 deletions src/DotNetStac.Test/Common/StacAccessorsHelpersTests.cs
Original file line number Diff line number Diff line change
@@ -3,7 +3,10 @@
// File Name: StacAccessorsHelpersTests.cs

using System.Collections.Generic;
using System.Runtime.Serialization;
using GeoJSON.Net.Geometry;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Stac.Collection;
using Stac.Common;
using Xunit;
@@ -88,5 +91,95 @@ public void LazyEnumParseTests()

Assert.Equal(test3, StacAccessorsHelpers.LazyEnumParse(typeof(Enum3), "Cql2Json"));
}

[Fact]
public void EnumSerializationTest()
{
var coordinates = new[]
{
new List<IPosition>
{
new Position(37.488035566,-122.308150179),
new Position(37.538869539,-122.597502109),
new Position(37.613537207,-122.576687533),
new Position(37.562818007,-122.288048600),
new Position(37.488035566,-122.308150179)
}
};

var geometry = new Polygon(new LineString[] { new LineString(coordinates[0]) });

var properties = new Dictionary<string, object>();

properties.Add("collection", "CS3");

StacItem item = new StacItem("CS3-20160503_132130_04", geometry, properties);

item.SetProperty("disaster:type", DisasterType.Volcano);

var itemJson = StacConvert.Serialize(item);

item = StacConvert.Deserialize<StacItem>(itemJson);

Assert.Equal("volcano", item.GetProperty<string>("disaster:type"));
}

[JsonConverter(typeof(StringEnumConverter))]
public enum DisasterType
{

[EnumMember(Value = "earthquake")]
Earthquake,

[EnumMember(Value = "fire")]
Fire,

[EnumMember(Value = "flood")]
Flood,

[EnumMember(Value = "flood_large")]
[System.Obsolete("Use Flood instead")]
FloodLarge,

[EnumMember(Value = "flood_flash")]
[System.Obsolete("Use Flood instead")]
FloodFlash,

[EnumMember(Value = "ice")]
Ice,

[EnumMember(Value = "landslide")]
Landslide,

[EnumMember(Value = "storm_hurricane")]
StormHurricane,

[EnumMember(Value = "storm_hurricane_rural")]
[System.Obsolete("Use StormHurricane instead")]
StormHurricaneRural,

[EnumMember(Value = "storm_hurricane_urban")]
[System.Obsolete("Use StormHurricane instead")]
StormHurricaneUrban,

[EnumMember(Value = "tsunami")]
Tsunami,

[EnumMember(Value = "oil_spill")]
OilSpill,

[EnumMember(Value = "volcano")]
Volcano,

/// <remarks/>
[EnumMember(Value = "snow_hazard")]
SnowHazard,

[EnumMember(Value = "explosive_event")]
ExplosiveEvent,

/// <remarks/>
Other,
}
}
}
2 changes: 1 addition & 1 deletion src/DotNetStac/DotNetStac.csproj
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
<Title>DotNetStac</Title>
<Description>Terradue .Net library for working with any SpatioTemporal Asset Catalog</Description>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<VersionPrefix>1.7.1</VersionPrefix>
<VersionPrefix>1.7.2</VersionPrefix>
<Authors>Emmanuel Mathot</Authors>
<Authors>emmanuelmathot</Authors>
<Company>Terradue</Company>
1 change: 1 addition & 0 deletions src/DotNetStac/StacLink.cs
Original file line number Diff line number Diff line change
@@ -67,6 +67,7 @@ public StacLink(StacLink source)
this.ContentType = source.ContentType;
this.Parent = source.Parent;
this.Length = source.Length;
this.AdditionalProperties = source.AdditionalProperties;
}

/// <summary>

0 comments on commit 1ef9b20

Please sign in to comment.