Skip to content

Commit

Permalink
Merge branch 'hotfix/1.6.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelmathot committed Dec 12, 2022
2 parents 361716f + 2b9b39a commit a33f4a2
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@ 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.6.3](https://github.com/Terradue/DotNetStac/compare/1.6.3...1.6.3)
## [1.6.4](https://github.com/Terradue/DotNetStac/compare/1.6.4...1.6.4)

### Commits

- throws on invalid date [`361716f`](https://github.com/Terradue/DotNetStac/commit/361716f9c3b5fca8c12b0611806dc22fde4876c2)
- fix stac extent creation with null geometries and infinite date [`e8b1aaa`](https://github.com/Terradue/DotNetStac/commit/e8b1aaac6276e1d14a0aaa7d18fb343acec6cb73)

## [1.6.4](https://github.com/Terradue/DotNetStac/compare/1.6.3...1.6.4) - 2022-12-12

### Commits

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

<h3 align="center">

![Build Status](https://github.com/Terradue/DotNetStac/actions/workflows/build.yaml/badge.svg?branch=master)
![Build Status](https://github.com/Terradue/DotNetStac/actions/workflows/build.yaml/badge.svg?branch=hotfix/1.6.5)
[![NuGet](https://img.shields.io/nuget/vpre/DotNetStac)](https://www.nuget.org/packages/DotNetStac/)
[![codecov](https://codecov.io/gh/Terradue/DotNetStac/branch/master/graph/badge.svg)](https://codecov.io/gh/Terradue/DotNetStac)
[![codecov](https://codecov.io/gh/Terradue/DotNetStac/branch/hotfix/1.6.5/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)
Expand Down
3 changes: 3 additions & 0 deletions src/DotNetStac.Test/Item/ItemTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using GeoJSON.Net.Geometry;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Stac.Collection;
using Stac.Exceptions;
using Xunit;

Expand Down Expand Up @@ -464,6 +465,8 @@ public void EmptyGeometry()

Assert.NotNull(token.Children().FirstOrDefault(c => c.Path == "geometry"));

var extent = StacExtent.Create(new List<StacItem>() { item });

}

[Fact]
Expand Down
7 changes: 6 additions & 1 deletion src/DotNetStac/Collection/StacExtent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,17 @@ public StacExtent(StacExtent extent)
/// <returns>A <see cref="StacExtent" /> that represents the spatio-temporal extent of all the items together</returns>
public static StacExtent Create(IEnumerable<StacItem> items)
{
DateTime? minDate = items.Where(i => i.DateTime != Itenso.TimePeriod.TimeInterval.Anytime).Min(i => i.DateTime.Start);
DateTime? maxDate = items.Where(i => i.DateTime != Itenso.TimePeriod.TimeInterval.Anytime).Max(i => i.DateTime.End);
minDate = minDate == DateTime.MinValue ? null : minDate;
maxDate = maxDate == DateTime.MaxValue ? null : maxDate;
return new StacExtent(
new StacSpatialExtent(items.Min(i => i.GetBoundingBoxFromGeometryExtent()[0]),
items.Min(i => i.GetBoundingBoxFromGeometryExtent()[1]),
items.Max(i => i.GetBoundingBoxFromGeometryExtent()[2]),
items.Max(i => i.GetBoundingBoxFromGeometryExtent()[3])),
new StacTemporalExtent(items.Min(i => i.DateTime.Start), items.Max(i => i.DateTime.End))

new StacTemporalExtent(minDate, maxDate)
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/DotNetStac/DotNetStac.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Title>DotNetStac</Title>
<Description>Terradue .Net library for working with any SpatioTemporal Asset Catalog</Description>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<VersionPrefix>1.6.4</VersionPrefix>
<VersionPrefix>1.6.5</VersionPrefix>
<Authors>Emmanuel Mathot</Authors>
<Authors>emmanuelmathot</Authors>
<Company>Terradue</Company>
Expand Down
4 changes: 3 additions & 1 deletion src/DotNetStac/StacGeometryHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ public static class StacGeometryHelpers
/// <returns></returns>
public static double[] GetBoundingBoxFromGeometryExtent(this StacItem stacItem)
{
var boundingBoxes = stacItem.Geometry.GetBoundingBox();
var boundingBoxes = stacItem.Geometry?.GetBoundingBox();
if (boundingBoxes == null)
return new double[] { -180, -90, 180, 90 };
if (boundingBoxes[0].Altitude.HasValue)
return new double[] {
boundingBoxes[0].Longitude, boundingBoxes[0].Latitude, boundingBoxes[0].Altitude.Value,
Expand Down

0 comments on commit a33f4a2

Please sign in to comment.