OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ossim::GroundControlPoint Class Reference

Class for representing a ground control point. More...

#include <GroundControlPoint.h>

Inheritance diagram for ossim::GroundControlPoint:
ossim::JsonInterface

Public Member Functions

 GroundControlPoint (const Json::Value &image_json_node)
 Creates new GCP from JSON object. More...
 
virtual ~GroundControlPoint ()
 
const std::string & getId () const
 
const ossimEcefPointgetECF () const
 
const NEWMAT::SymmetricMatrix & getCovariance () const
 
virtual void loadJSON (const Json::Value &json)
 
virtual void saveJSON (Json::Value &json) const
 
- Public Member Functions inherited from ossim::JsonInterface
 JsonInterface ()
 
virtual ~JsonInterface ()
 

Private Member Functions

 GroundControlPoint ()
 

Private Attributes

std::string m_id
 
ossimEcefPoint m_gcp
 
NEWMAT::SymmetricMatrix m_covariance
 

Detailed Description

Class for representing a ground control point.

TODO: mplement cross-correlation between GCPs

Definition at line 22 of file GroundControlPoint.h.

Constructor & Destructor Documentation

◆ GroundControlPoint() [1/2]

ossim::GroundControlPoint::GroundControlPoint ( const Json::Value &  image_json_node)

Creates new GCP from JSON object.

The ground point (GCP) coordinates are specified in either ECF or geographic. The associated covariance must be in the same coordinate system. If correlations exist to other GCPs, those GCPs must share the same coordinate system. TBD: Perhaps the GCP information, including coordinates, covariances and cross-covariances can be ingested prior and accessed from the database with only GCP ID. Id so, the remainder of this message is not needed.

The JSON Format: { "id": <string>, "ecf": [ <X>, <Y>, <Z> ], OR "geo": [ <lat>, <lon>, <hgt_msl> ], "covariance": [ c11, c22, c33, c12, c13, c23 ], "crossCovariances": [ (Can be excluded if no correlation information available) { "id": <string>, The other GCP’s ID "crossCovariance": [ c11, c22, c33, c12, c13, c23 ] } ] }

Definition at line 20 of file GroundControlPoint.cpp.

References loadJSON(), and m_covariance.

21 : m_covariance (3)
22 {
23  m_covariance.ReSize(3);
24  loadJSON(json_node);
25 }
NEWMAT::SymmetricMatrix m_covariance
virtual void loadJSON(const Json::Value &json)

◆ ~GroundControlPoint()

ossim::GroundControlPoint::~GroundControlPoint ( )
virtual

Definition at line 28 of file GroundControlPoint.cpp.

29 {
30 
31 }

◆ GroundControlPoint() [2/2]

ossim::GroundControlPoint::GroundControlPoint ( )
private

Definition at line 15 of file GroundControlPoint.cpp.

16 {
17 
18 }

Member Function Documentation

◆ getCovariance()

const NEWMAT::SymmetricMatrix& ossim::GroundControlPoint::getCovariance ( ) const
inline

Definition at line 58 of file GroundControlPoint.h.

References m_covariance.

58 {return m_covariance;}
NEWMAT::SymmetricMatrix m_covariance

◆ getECF()

const ossimEcefPoint& ossim::GroundControlPoint::getECF ( ) const
inline

Definition at line 56 of file GroundControlPoint.h.

References m_gcp.

56 { return m_gcp; }

◆ getId()

const std::string& ossim::GroundControlPoint::getId ( ) const
inline

Definition at line 55 of file GroundControlPoint.h.

References m_id.

55 { return m_id; }

◆ loadJSON()

void ossim::GroundControlPoint::loadJSON ( const Json::Value &  json)
virtual

Implements ossim::JsonInterface.

Definition at line 33 of file GroundControlPoint.cpp.

References ossimGpt::hgt, ossimGpt::lat, ossimGpt::lon, m_covariance, m_gcp, m_id, ossimNotify(), ossimNotifyLevel_WARN, ossimEcefPoint::x(), ossimEcefPoint::y(), and ossimEcefPoint::z().

Referenced by GroundControlPoint().

34 {
35  ostringstream xmsg;
36  xmsg<<__FILE__<<": ";
37 
38  m_id = json_node["gcpId"].asString();
39  if (m_id.empty())
40  m_id = json_node["pointId"].asString();
41 
42  if (json_node.isMember("lat") && json_node.isMember("lon") && json_node.isMember("hgt"))
43  {
44  ossimGpt refGpt;
45  refGpt.lat = json_node["lat"].asDouble();
46  refGpt.lon = json_node["lon"].asDouble();
47  refGpt.hgt = json_node["hgt"].asDouble();
48  m_gcp = ossimEcefPoint(refGpt);
49  }
50  else if (json_node.isMember("x") && json_node.isMember("y") && json_node.isMember("z"))
51  {
52  m_gcp.x() = json_node["x"].asDouble();
53  m_gcp.y() = json_node["y"].asDouble();
54  m_gcp.z() = json_node["z"].asDouble();
55  }
56  else
57  {
58  xmsg<<"Ground point coordinates JSON not correct. JSON: \n"<<json_node.toStyledString()<<endl;
59  throw ossimException(xmsg.str());
60  }
61 
62  const Json::Value& covariance = json_node["covariance"];
63  unsigned int covSize = covariance.size();
64  if ((covSize != 6) || (covSize != 9))
65  {
66  xmsg<<"No covariance information in JSON or not correctly formatted (must be 6 or 9 element array)";
67  throw ossimException(xmsg.str());
68  }
69 
70  // TODO: Covariance in proper coordinate system. ENU -> ECF conversion needed here?
71  if (covSize == 6)
72  {
73  m_covariance(0,0) = covariance[0].asDouble();
74  m_covariance(1,1) = covariance[1].asDouble();
75  m_covariance(2,2) = covariance[2].asDouble();
76  m_covariance(0,1) = covariance[3].asDouble();
77  m_covariance(0,2) = covariance[4].asDouble();
78  m_covariance(1,2) = covariance[5].asDouble();
79  }
80  else
81  {
82  m_covariance(0,0) = covariance[0].asDouble();
83  m_covariance(0,1) = covariance[1].asDouble();
84  m_covariance(0,2) = covariance[2].asDouble();
85  m_covariance(1,0) = covariance[3].asDouble();
86  m_covariance(1,1) = covariance[4].asDouble();
87  m_covariance(1,2) = covariance[5].asDouble();
88  m_covariance(2,0) = covariance[6].asDouble();
89  m_covariance(2,1) = covariance[7].asDouble();
90  m_covariance(2,2) = covariance[8].asDouble();
91  }
92 
93  // TODO: Implement GCP cross-correlation
94  if (json_node.isMember("crossCovariances") || json_node.isMember("gpCrossCovList"))
95  {
96  ossimNotify(ossimNotifyLevel_WARN)<<"GCP cross covariances are specified in the JSON, but the"
97  " capability is not yet implemented!"<<endl;
98  }
99 }
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
NEWMAT::SymmetricMatrix m_covariance
double x() const
ossim_float64 hgt
Height in meters above the ellipsiod.
Definition: ossimGpt.h:274
ossim_float64 lon
Definition: ossimGpt.h:266
double y() const
ossim_float64 lat
Definition: ossimGpt.h:265
double z() const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ saveJSON()

void ossim::GroundControlPoint::saveJSON ( Json::Value &  json) const
virtual

Implements ossim::JsonInterface.

Definition at line 101 of file GroundControlPoint.cpp.

References m_covariance, m_gcp, m_id, ossimEcefPoint::x(), ossimEcefPoint::y(), and ossimEcefPoint::z().

102 {
103  // ID
104  json_node["gcpId"] = m_id;
105 
106  // ECF
107  json_node["X"] = m_gcp.x();
108  json_node["Y"] = m_gcp.y();
109  json_node["Z"] = m_gcp.z();
110 
111  Json::Value covJson (Json::arrayValue);
112  covJson[0] = m_covariance(1,1);
113  covJson[1] = m_covariance(2,2);
114  covJson[2] = m_covariance(3,3);
115  covJson[3] = m_covariance(1,2);
116  covJson[4] = m_covariance(1,3);
117  covJson[5] = m_covariance(2,3);
118 
119  json_node["covariance"] = covJson;
120 }
NEWMAT::SymmetricMatrix m_covariance
double x() const
double y() const
double z() const

Member Data Documentation

◆ m_covariance

NEWMAT::SymmetricMatrix ossim::GroundControlPoint::m_covariance
private

Definition at line 77 of file GroundControlPoint.h.

Referenced by getCovariance(), GroundControlPoint(), loadJSON(), and saveJSON().

◆ m_gcp

ossimEcefPoint ossim::GroundControlPoint::m_gcp
private

Definition at line 76 of file GroundControlPoint.h.

Referenced by getECF(), loadJSON(), and saveJSON().

◆ m_id

std::string ossim::GroundControlPoint::m_id
private

Definition at line 75 of file GroundControlPoint.h.

Referenced by getId(), loadJSON(), and saveJSON().


The documentation for this class was generated from the following files: