Commit 0df350d8 authored by Cédric Traizet's avatar Cédric Traizet

Merge branch '2024-metadata-refac' of...

Merge branch '2024-metadata-refac' of https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb into 2024-metadata-refac
parents d351fe11 79b7faac
{{"Extra.Comment": "Test Extrakeys",
"ProductionDate": "2009-08-10T10:30:08.142149Z",
"ProjectionWKT": "UTM projRef",
"SensorID": "PHR",
}Bands[{"PhysicalBias": "1",
"PhysicalGain": "2",
"BandName": "B0",
"NoData": "-10000",
},{"PhysicalBias": "2",
"PhysicalGain": "3",
"BandName": "B1",
"NoData": "-10000",
},{"PhysicalBias": "1",
"PhysicalGain": "2",
"BandName": "B0",
"NoData": "-10000",
},{"PhysicalBias": "2",
"PhysicalGain": "3",
"BandName": "B1",
"NoData": "-10000",
},{"PhysicalBias": "3",
"PhysicalGain": "4",
"BandName": "B2",
"NoData": "-10000",
},]
}
\ No newline at end of file
SensorID PHR
ProductionDate 2009-08-10T10:30:08.142149Z
ProjectionWKT UTM projRef
Extra.Comment Test Extrakeys
BandName B0
NoData -10000
PhysicalGain 2
PhysicalBias 1
BandName B1
NoData -10000
PhysicalGain 3
PhysicalBias 2
BandName B0
NoData -10000
PhysicalGain 2
PhysicalBias 1
BandName B1
NoData -10000
PhysicalGain 3
PhysicalBias 2
BandName B2
NoData -10000
PhysicalGain 4
PhysicalBias 3
{{"Extra.Information": "Very important",
"Extra.Comment": "Test Extrakeys",
"SensorID": "PHR",
"ProjectionWKT": "UTM projRef",
"ProductionDate": "2009-08-10T10:30:08.142149Z",
"Polarization": "Polarization",
"NoData": "-10000",
"AcquisitionDate": "2009-08-05T20:34:38.236478Z",
}Bands[{"PhysicalBias": "1",
"BandName": "B0",
"PhysicalGain": "2",
},{"PhysicalBias": "2",
"BandName": "B1",
"PhysicalGain": "3",
},{"PhysicalBias": "3",
"BandName": "B2",
"PhysicalGain": "4",
},]
}
\ No newline at end of file
SensorID PHR
Polarization Polarization
NoData -10000
AcquisitionDate 2009-08-05T20:34:38.236478Z
ProductionDate 2009-08-10T10:30:08.142149Z
ProjectionWKT UTM projRef
Extra.Comment Test Extrakeys
Extra.Information Very important
BandName B0
PhysicalGain 2
PhysicalBias 1
BandName B1
PhysicalGain 3
PhysicalBias 2
BandName B2
PhysicalGain 4
PhysicalBias 3
{{"ProductionDate": "2009-08-10T10:30:08.142149Z",
"Polarization": "Polarization",
"ProjectionWKT": "UTM projRef",
"Extra.Comment": "Test Extrakeys",
"SensorID": "SPOT",
}Bands[{"PhysicalBias": "1",
"PhysicalGain": "2",
"BandName": "B0",
"NoData": "-10000",
},{"PhysicalBias": "2",
"PhysicalGain": "3",
"BandName": "B1",
"SunAzimuth": "20",
"NoData": "-10000",
},]
}
\ No newline at end of file
SensorID SPOT
Polarization Polarization
ProductionDate 2009-08-10T10:30:08.142149Z
ProjectionWKT UTM projRef
Extra.Comment Test Extrakeys
BandName B0
NoData -10000
PhysicalGain 2
PhysicalBias 1
BandName B1
NoData -10000
PhysicalGain 3
PhysicalBias 2
SunAzimuth 20
{{"Extra.Comment": "Test Extrakeys",
"ProductionDate": "2009-08-10T10:30:08.142149Z",
"ProjectionWKT": "UTM projRef",
"SensorID": "PHR",
}Bands[{"PhysicalBias": "1",
"PhysicalGain": "2",
"BandName": "B0",
"NoData": "-10000",
},{"PhysicalBias": "2",
"PhysicalGain": "3",
"BandName": "B1",
"NoData": "-10000",
},]
}
\ No newline at end of file
SensorID PHR
ProductionDate 2009-08-10T10:30:08.142149Z
ProjectionWKT UTM projRef
Extra.Comment Test Extrakeys
BandName B0
NoData -10000
PhysicalGain 2
PhysicalBias 1
BandName B1
NoData -10000
PhysicalGain 3
PhysicalBias 2
{{"Extra.Comment": "Test Extrakeys",
"ProjectionEPSG": "4326",
"ProjectionWKT": "UTM projRef",
"ProjectionProj": "+proj=longlat +datum=WGS84 +no_defs ",
"SpectralSensitivity": "LUT1D.DIM0.SIZE = 3
SensorID PHR
ProductionDate 2009-08-10T10:30:08.142149Z
ProjectionWKT UTM projRef
ProjectionEPSG 4326
ProjectionProj +proj=longlat +datum=WGS84 +no_defs
SpectralSensitivity LUT1D.DIM0.SIZE = 3
LUT1D.DIM0.ORIGIN = 0
LUT1D.DIM0.SPACING = 1
LUT1D.ARRAY = 1 2 3"
"RPC": "<RPCParam>",
"ProductionDate": "2009-08-10T10:30:08.142149Z",
"GCP": "<GCPParam>",
"SensorID": "PHR",
}Bands[{"PhysicalBias": "1",
"PhysicalGain": "2",
"BandName": "B0",
"NoData": "-10000",
},{"PhysicalBias": "2",
"PhysicalGain": "3",
"BandName": "B1",
"NoData": "-10000",
},{"PhysicalBias": "3",
"PhysicalGain": "4",
"BandName": "B2",
"NoData": "-10000",
},]
}
\ No newline at end of file
LUT1D.ARRAY = 1 2 3
Extra.Comment Test Extrakeys
BandName B0
NoData -10000
PhysicalGain 2
PhysicalBias 1
BandName B1
NoData -10000
PhysicalGain 3
PhysicalBias 2
BandName B2
NoData -10000
PhysicalGain 4
PhysicalBias 3
......@@ -26,6 +26,7 @@
#include <utility>
#include <cstdlib>
#include "otbStopwatch.h"
#include "otbTestTools.h"
void SetUpImageMetadata(otb::ImageMetadata& md, unsigned int nbBands)
{
......@@ -189,7 +190,7 @@ void otbImageMetadataSliceTest(char* argv[])
SetUpImageMetadata(md, 3);
ImageMetadata md2 = md.slice(0, 1);
outfile << md2;
otb::testtools::PrintMetadata(md2, outfile);
outfile.close();
}
......@@ -207,7 +208,7 @@ void otbImageMetadataAppendTest(char* argv[])
SetUpImageMetadata(md2, 3);
md.append(md2);
outfile << md;
otb::testtools::PrintMetadata(md, outfile);
outfile.close();
}
......@@ -234,7 +235,7 @@ void otbImageMetadataMergeTest(char* argv[])
md.Merge(md2);
outfile << md;
otb::testtools::PrintMetadata(md, outfile);
outfile.close();
}
void otbImageMetadataToFromKeywordlistTest(char* argv[])
......@@ -265,7 +266,7 @@ void otbImageMetadataToFromKeywordlistTest(char* argv[])
md.AppendToKeywordlists(kwlVect);
ImageMetadata md2;
md2.FromKeywordlists(kwlVect);
outfile << md2;
otb::testtools::PrintMetadata(md2, outfile);
outfile.close();
}
......@@ -288,7 +289,7 @@ void otbImageMetadataCompactTest(char* argv[])
}
md.compact();
outfile << md;
otb::testtools::PrintMetadata(md, outfile);
outfile.close();
}
......
/*
* Copyright (C) 2005-2020 Centre National d'Etudes Spatiales (CNES)
*
* This file is part of Orfeo Toolbox
*
* https://www.orfeo-toolbox.org/
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef otbTestTools_h
#define otbTestTools_h
#include "otbMetaDataKey.h"
#include "otbImageMetadata.h"
namespace otb
{
namespace testtools
{
void PrintMetadataBase(ImageMetadataBase imdb, std::ostream& oss)
{
std::unordered_map<std::string, std::string> kwl;
imdb.ToKeywordlist(kwl);
for (auto It = otb::MetaData::MDStrNames.left.begin() ; It != otb::MetaData::MDStrNames.left.end() ; ++It)
{
auto Key = kwl.find(It->second);
if (Key != kwl.end())
oss << It->second << ' ' << Key->second << '\n';
}
for (auto It = otb::MetaData::MDNumNames.left.begin() ; It != otb::MetaData::MDNumNames.left.end() ; ++It)
{
auto Key = kwl.find(It->second);
if (Key != kwl.end())
oss << It->second << ' ' << Key->second << '\n';
}
for (auto It = otb::MetaData::MDTimeNames.left.begin() ; It != otb::MetaData::MDTimeNames.left.end() ; ++It)
{
auto Key = kwl.find(It->second);
if (Key != kwl.end())
oss << It->second << ' ' << Key->second << '\n';
}
for (auto It = otb::MetaData::MDGeomNames.left.begin() ; It != otb::MetaData::MDGeomNames.left.end() ; ++It)
{
auto Key = kwl.find(It->second);
if (Key != kwl.end())
oss << It->second << ' ' << Key->second << '\n';
}
for (auto It = otb::MetaData::MDL1DNames.left.begin() ; It != otb::MetaData::MDL1DNames.left.end() ; ++It)
{
auto Key = kwl.find(It->second);
if (Key != kwl.end())
oss << It->second << ' ' << Key->second << '\n';
}
for (auto It = otb::MetaData::MDL2DNames.left.begin() ; It != otb::MetaData::MDL2DNames.left.end() ; ++It)
{
auto Key = kwl.find(It->second);
if (Key != kwl.end())
oss << It->second << ' ' << Key->second << '\n';
}
std::string prefix("Extra.");
for (const auto& kv : imdb.ExtraKeys)
oss << prefix + kv.first << ' ' << kv.second << '\n';
}
void PrintMetadata(ImageMetadata imd, std::ostream& oss)
{
PrintMetadataBase(imd, oss);
for (ImageMetadataBase imdb : imd.Bands)
PrintMetadataBase(imdb, oss);
}
}
}
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment