Commit 8749d879 authored by Cédric Traizet's avatar Cédric Traizet
Browse files

Merge branch 'sar_io_2' into 'develop'

Fixes in SAR metadata

See merge request !864
parents 07195a9f 8ea7df65
Pipeline #9205 canceled with stages
in 52 minutes and 5 seconds
mytime : 2009-08-10T10:30:08.142149Z
First try size: 512
Second try size: 264
Third try size: 264
First try size: 528
Second try size: 272
Third try size: 272
......@@ -22,5 +22,6 @@ SARCalib <SARCalib>
GCP <GCPParam>
GCP
{"Projection": "",
[]}
{"Projection": "GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AXIS["Latitude",NORTH],AXIS["Longitude",EAST],AUTHORITY["EPSG","4326"]]",
[{"GCP_Id": "1", "GCP_Info": "", "GCP_Row": "0", "GCP_Col": "0", "GCP_X": "1.52086", "GCP_Y": "43.6454", "GCP_Z": "5.53428e-10", },
]}
......@@ -19,12 +19,12 @@ AverageSceneHeight 19
RedDisplayChannel 0
GreenDisplayChannel 0
BlueDisplayChannel 0
CalScale 1
PRF 1663.48
RadarFrequency 5.405e+09
CenterIncidenceAngle 44.7171
LineSpacing 4.08568
PixelSpacing 3.19483
AbsoluteCalibrationConstant 1
AcquisitionDate 2015-06-19T19:50:43.223221Z
ProductionDate 2015-06-20T01:51:06.838854Z
AcquisitionStartTime 2015-06-19T19:50:43.223221Z
......
......@@ -243,6 +243,12 @@ private:
SetParameterRole("gcp.geocoord", Role_Output);
EnableParameter("gcp.geocoord");
AddParameter(ParameterType_String, "metadata", "Metadata");
SetParameterDescription("metadata", "Image metadata");
SetParameterRole("metadata", Role_Output);
EnableParameter("metadata");
// Doc example parameter settings
SetDocExampleParameterValue("in", "QB_Toulouse_Ortho_XS.tif");
......
......@@ -160,6 +160,7 @@ enum class MDNum
PixelSpacing,
RangeTimeFirstPixel,
RangeTimeLastPixel,
AbsoluteCalibrationConstant,
END
};
......
......@@ -183,6 +183,8 @@ struct OTBMetadata_EXPORT SARParam
unsigned long numberOfLinesPerBurst;
unsigned long numberOfSamplesPerBurst;
bool rightLookingFlag = true;
/** Doppler centroid estimates */
std::vector<DopplerCentroid> dopplerCentroids;
......
......@@ -96,7 +96,7 @@ public:
void Parse(ImageMetadata &) override;
protected:
TerraSarXSarImageMetadataInterface();
TerraSarXSarImageMetadataInterface() = default;
~TerraSarXSarImageMetadataInterface() override = default;
void PrintSelf(std::ostream& os, itk::Indent indent) const override;
......
......@@ -30,6 +30,7 @@ ENABLE_SHARED
OTBITK
OTBCommon
OTBGdalAdapters
OTBTinyXML
TEST_DEPENDS
OTBTestKernel
......
......@@ -91,6 +91,7 @@ target_link_libraries(OTBMetadata
${OTBCommon_LIBRARIES}
${OTBGdalAdapters_LIBRARIES}
${OTBBoostAdapters_LIBRARIES}
${OTBTinyXML_LIBRARIES}
)
otb_module_target(OTBMetadata)
......@@ -24,6 +24,7 @@
#include "otbMacro.h"
#include "itkMetaDataObject.h"
#include "otbSpatialReference.h"
// useful constants
#include <otbMath.h>
......@@ -121,7 +122,6 @@ std::vector<Orbit> CosmoImageMetadataInterface::getOrbits(const std::string & re
int hour = static_cast<int> (total_seconds/3600.0);
int minutes = static_cast<int> ((total_seconds-hour*3600)/60.0);
double seconds = total_seconds - hour*3600 - minutes*60;
seconds += 0.5;
std::string timeStr = reference_UTC + "T" + formatTimeInt(hour) + ":" + formatTimeInt(minutes) + ":" + formatTimeDouble(seconds);
......@@ -250,19 +250,40 @@ void CosmoImageMetadataInterface::ParseGdal(ImageMetadata & imd)
}
sarParam.rangeSamplingRate = 1 / rangeTimeInterval;
sarParam.azimuthTimeInterval = MetaData::DurationType(
std::stod(metadataBands[0]["S01_SBI_Line_Time_Interval"])
* 1e6);
sarParam.azimuthTimeInterval = MetaData::Duration::Seconds(
std::stod(metadataBands[0]["S01_SBI_Line_Time_Interval"]));
sarParam.nearRangeTime = std::stod(metadataBands[0]["S01_SBI_Zero_Doppler_Range_First_Time"]);
auto lookSide = m_MetadataSupplierInterface->GetAs<std::string>("Look_Side");
if (lookSide != "RIGHT" && lookSide != "LEFT")
{
otbGenericExceptionMacro(MissingMetadataException, "Not an expected look side (only RIGHT or LEFT expected)");
}
sarParam.rightLookingFlag = lookSide == "RIGHT";
imd.Add(MDGeom::SAR, sarParam);
// TODO: compute a GCP at the center of scene using the inverse sar model like it is done in ossim plugins
// This require to move IMIs to another higher level module that depends on OTBTransform (which depends
// on OTBMetadata) so that SarSensorModel can be used. (this cannot be done while IMIs still depend on Ossim)
Projection::GCPParam gcp;
imd.Add(MDGeom::GCP, gcp);
// Add the top left corner as GCP for now
std::istringstream output(metadataBands[0]["S01_SBI_Top_Left_Geodetic_Coordinates"]);
GCP gcp;
output >> gcp.m_GCPY; // lat
output >> gcp.m_GCPX; // lon
output >> gcp.m_GCPZ; // height
gcp.m_GCPRow = 0;
gcp.m_GCPCol = 0;
gcp.m_Id = "1";
Projection::GCPParam gcpParam;
gcpParam.GCPProjection = SpatialReference::FromWGS84().ToWkt();
gcpParam.GCPs.push_back(gcp);
imd.Add(MDGeom::GCP, gcpParam);
SARCalib sarCalib;
std::istringstream("1970-01-01T00:00:00.000000") >> sarCalib.calibrationStartTime;
......
Supports Markdown
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