Skip to content

Commit

Permalink
ProjectionStacExtension for asset
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelmathot committed Nov 22, 2021
1 parent c4534ad commit dc400ed
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
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=release/1.2.0)
![Build Status](https://github.com/Terradue/DotNetStac/actions/workflows/build.yaml/badge.svg?branch=hotfix/1.2.1)
[![NuGet](https://img.shields.io/nuget/vpre/DotNetStac)](https://www.nuget.org/packages/DotNetStac/)
[![codecov](https://codecov.io/gh/Terradue/DotNetStac/branch/release/1.2.0/graph/badge.svg)](https://codecov.io/gh/Terradue/DotNetStac)
[![codecov](https://codecov.io/gh/Terradue/DotNetStac/branch/hotfix/1.2.1/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
18 changes: 18 additions & 0 deletions src/DotNetStac/Extensions/Projection/ProjectionStacExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ internal ProjectionStacExtension(StacItem stacItem) : base(JsonSchemaUrl, stacIt
itemFields.Add(ProjTransformField, typeof(double[]));
}

internal ProjectionStacExtension(StacAsset stacAsset) : base(JsonSchemaUrl, stacAsset)
{
itemFields = new Dictionary<string, Type>();
itemFields.Add(EpsgField, typeof(int));
itemFields.Add(Wkt2Field, typeof(string));
itemFields.Add(ProjJsonField, typeof(string));
itemFields.Add(ProjGeometryField, typeof(IGeometryObject));
itemFields.Add(ProjBboxField, typeof(double[]));
itemFields.Add(ProjCentroidField, typeof(CentroidObject));
itemFields.Add(ProjShapeField, typeof(int[]));
itemFields.Add(ProjTransformField, typeof(double[]));
}

public long? Epsg
{
get { return StacPropertiesContainer.GetProperty<long?>(EpsgField); }
Expand Down Expand Up @@ -122,5 +135,10 @@ public static ProjectionStacExtension ProjectionExtension(this StacItem stacItem
{
return new ProjectionStacExtension(stacItem);
}

public static ProjectionStacExtension ProjectionExtension(this StacAsset stacAsset)
{
return new ProjectionStacExtension(stacAsset);
}
}
}

0 comments on commit dc400ed

Please sign in to comment.