From 765de2120cd4757449e7034a15e84e5d92a803a3 Mon Sep 17 00:00:00 2001 From: floeschau Date: Wed, 6 Mar 2024 17:15:31 +0100 Subject: [PATCH] Corrections for Vision-1 and related functionality (2) --- .../Model/Metadata/Dimap/DimapMetadataExtractor.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Stars.Data/Model/Metadata/Dimap/DimapMetadataExtractor.cs b/src/Stars.Data/Model/Metadata/Dimap/DimapMetadataExtractor.cs index d982253d..27547119 100644 --- a/src/Stars.Data/Model/Metadata/Dimap/DimapMetadataExtractor.cs +++ b/src/Stars.Data/Model/Metadata/Dimap/DimapMetadataExtractor.cs @@ -377,8 +377,11 @@ protected void AddAssets(StacItem stacItem, IItem item, DimapProfiler dimapProfi private KeyValuePair CreateRasterAsset(StacItem stacItem, IAsset bandAsset, DimapProfiler dimapProfiler, t_Data_File dataFile, Schemas.DimapDocument dimap) { - string mimeType = MimeTypes.GetMimeType(Path.GetFileName(bandAsset.Uri.ToString())); - StacAsset stacAsset = StacAsset.CreateDataAsset(stacItem, bandAsset.Uri, new ContentType(MimeTypes.GetMimeType(Path.GetFileName(bandAsset.Uri.ToString())))); + string mimeType; + Console.WriteLine("EXT = {0}", Path.GetExtension(bandAsset.Uri.AbsolutePath)); + if (Path.GetExtension(bandAsset.Uri.AbsolutePath) == ".jp2") mimeType = "image/jpeg"; + else mimeType = MimeTypes.GetMimeType(Path.GetFileName(bandAsset.Uri.AbsolutePath)); + StacAsset stacAsset = StacAsset.CreateDataAsset(stacItem, bandAsset.Uri, new ContentType(mimeType)); stacAsset.Properties.AddRange(bandAsset.Properties); stacAsset.Title = dimapProfiler.GetAssetTitle(bandAsset, dataFile, dimap); return new KeyValuePair(dimapProfiler.GetProductKey(bandAsset, dataFile), stacAsset);