PDS_JP2
|
The PDS_Projection_Data provides geographic projection capabilities between image and real world coordinates. More...
#include <PDS_Projection_Data.hh>
Classes | |
struct | Projection_Definition |
A Projection_Definition maps GDAL OGRSpatialReference parameter names to their required PDS parameter names and default values. More... | |
Public Member Functions | |
PDS_Projection_Data () | |
Construct a default identity projection. More... | |
PDS_Projection_Data (const PDS_Data &PDS_data) | |
Construct a projection from a set of PDS data parameters. More... | |
PDS_Projection_Data (const std::string &pathname) | |
Construct a projection from a file source of PDS parameters. More... | |
virtual | ~PDS_Projection_Data () |
Destructor. More... | |
virtual PDS_Data & | parameters (const std::string &pathname) |
Set the PDS parameters from a source file. More... | |
virtual PDS_Data & | parameters (const idaeim::PVL::Aggregate ¶meters) |
Set the PDS parameters from a Parameter Aggregate. More... | |
const double * | geo_transform () const |
Get the geo-transform array. More... | |
OGRSpatialReference * | spatial_reference () const |
Get the OGRSpatialReference. More... | |
Projection_Type | projection_type () const |
Get the projection type. More... | |
std::string | projection_name () const |
Get the name of the applicable projection. More... | |
PDS_Projection_Data & | initialize_geo_transform () |
Initialized the geo-transform array values from the PDS parameter values. More... | |
PDS_Projection_Data & | initialize_spatial_reference () |
Initialize the spatial reference information of a new OGRSpatialReference object. More... | |
JP2_Box * | JP2_GeoTIFF () const |
Get a JP2_Box with GeoTIFF data content. More... | |
JP2_Box * | JP2_GML (unsigned int image_width=0, unsigned int image_height=0) const |
Get a JP2_Box with GML data content. More... | |
Public Member Functions inherited from PDS_Data | |
PDS_Data () | |
Construct PDS_Data with no parameters. More... | |
PDS_Data (const idaeim::PVL::Aggregate ¶meters) | |
Construct PDS_Data from a PVL Parameter Aggregate. More... | |
PDS_Data (const idaeim::PVL::Aggregate ¶meters, const std::string &detached) | |
Construct PDS_Data from a PVL Parameter Aggregate. More... | |
PDS_Data (const std::string &pathname) | |
Construct PDS_Data from a named file. More... | |
PDS_Data_Block_List * | data_blocks (const char **excluded=NULL, const char **image_block_names=NULL) |
Get a list of all binary data blocks in the PDS data. More... | |
idaeim::PVL::Parameter * | find_parameter (const std::string &pathname, bool case_sensitive=false, int skip=0, Parameter_Class_Selection parameter_class=ANY_PARAMETER) const |
Find a named Parameter. More... | |
idaeim::PVL::Parameter * | remove_parameter (const std::string &pathname, bool case_sensitive=false, int skip=0, Parameter_Class_Selection parameter_class=ANY_PARAMETER) |
Removes a named Parameter. More... | |
template<typename T > | |
bool | parameter_value (const std::string &pathname, T &value, bool case_sensitive=false, int skip=0) |
Set the value of a named parameter. More... | |
double | numeric_value (const std::string &pathname, bool case_sensitive=false, int skip=0) const |
Get the numeric value of a named parameter. More... | |
std::string | string_value (const std::string &pathname, bool case_sensitive=false, int skip=0) const |
Get the string value of a named parameter. More... | |
Public Member Functions inherited from Aggregate | |
Aggregate & | add (const Parameter ¶meter) |
Aggregate & | add (Parameter *parameter) |
Aggregate (const Aggregate &aggregate) | |
Aggregate (Parser &parser, const std::string name="") | |
Aggregate (const std::string name="", const idaeim::PVL::Parameter::Type type_code=Default_Subtype) | |
Aggregate (const Parameter ¶meter) | |
Depth_Iterator | begin_depth () |
Aggregate * | clone () const |
int | compare (const Parameter ¶meter) const |
Aggregate & | copy_in (const Aggregate &aggregate) |
Depth_Iterator | end_depth () |
void | entering (Parameter *parameter) |
Parameter * | find (const std::string &pathname, bool case_sensitive=false, int skip=0, idaeim::PVL::Parameter::Type type=(Type)(ASSIGNMENT|AGGREGATE)) const |
bool | is (const Type type) const |
bool | is_Aggregate () const |
bool | is_Group () const |
bool | is_Object () const |
Aggregate & | move_in (Aggregate &aggregate) |
Aggregate & | operator= (const Parameter ¶meter) |
Aggregate & | operator= (const Aggregate ¶meter) |
Aggregate & | operator= (const Assignment ¶meter) |
Aggregate & | operator= (const Value &value) |
const Parameter & | operator[] (unsigned int index) const |
Parameter & | operator[] (unsigned int index) |
void | read (std::istream &in=std::cin) |
void | read (Parser &parser) |
Parameter * | remove (size_type index) |
Parameter * | remove (Parameter *parameter) |
Parameter * | remove (iterator position) |
Parameter * | remove_depth (Parameter *parameter) |
void | removing (Parameter *parameter) |
size_type | total_size () |
Aggregate & | type (const int type) |
Type | type () const |
std::string | type_name () const |
Value & | value () const |
~Aggregate () | |
Public Member Functions inherited from Parameter | |
bool | at_pathname (std::string pathname, bool case_sensitive, const Parameter *root=NULL) const |
bool | at_pathname (std::string pathname) const |
bool | at_pathname (std::string pathname, bool case_sensitive, const Parameter &root) const |
std::string | comment () const |
Parameter & | comment (const std::string &comment) |
bool | has_children () const |
Parameter & | indenting (const MODE_STATE state, const WHICH_MODE which=LOCAL_MODE_SET) |
Parameter & | indenting (const bool enable) |
MODE_STATE | indenting (const WHICH_MODE which=RECURSIVE_MODE_SET) const |
virtual bool | is_Assignment () const |
virtual bool | is_Token () const |
Parameter & | mode_state (const MODE mode, const MODE_STATE state, const WHICH_MODE which=LOCAL_MODE_SET) |
const MODE_STATE * | mode_state (const WHICH_MODE which=LOCAL_MODE_SET) const |
MODE_STATE | mode_state (const MODE mode, const WHICH_MODE which=RECURSIVE_MODE_SET) const |
Parameter & | mode_state (const MODE_STATE *const modes, const WHICH_MODE which=LOCAL_MODE_SET) |
std::string | name () const |
Parameter & | name (const std::string &name) |
bool | operator!= (const Parameter ¶meter) const |
bool | operator< (const Parameter ¶meter) const |
bool | operator<= (const Parameter ¶meter) const |
bool | operator== (const Parameter ¶meter) const |
bool | operator> (const Parameter ¶meter) const |
bool | operator>= (const Parameter ¶meter) const |
Parameter (const Parameter ¶meter) | |
Parameter (const std::string &name="") | |
Aggregate * | parent () const |
std::string | pathname (const Parameter *root=NULL) const |
std::string | pathname (const Parameter &root) const |
std::string | pathname_to (const Parameter *root=NULL) const |
std::string | pathname_to (const Parameter &root) const |
std::ostream & | print (std::ostream &out=std::cout) const |
Aggregate * | root () const |
MODE_STATE | verbatim_strings (const WHICH_MODE which=RECURSIVE_MODE_SET) const |
Parameter & | verbatim_strings (const bool enable) |
Parameter & | verbatim_strings (const MODE_STATE state, const WHICH_MODE which=LOCAL_MODE_SET) |
unsigned int | write (std::ostream &out=std::cout, int depth=0) const |
virtual | ~Parameter () |
Public Member Functions inherited from Vectal< Parameter > | |
void | assign (size_type number, const_reference value) |
void | assign (Iterator start, Iterator stop) |
reference | at (size_type index) |
const_reference | at (size_type index) const |
reference | back () |
const_reference | back () const |
Iterator | begin () |
Const_Iterator | begin () const |
void | clear () |
Iterator | end () |
Const_Iterator | end () const |
void | erase (size_type index) |
iterator | erase (iterator start, iterator stop) |
iterator | erase (iterator position) |
reference | front () |
const_reference | front () const |
iterator | insert (iterator position, const_reference value) |
void | insert (size_type index, const_reference value) |
void | insert (iterator position, size_type number, const_reference value) |
void | insert (iterator position, InputIterator start, InputIterator stop) |
Vectal & | operator= (const Vectal< value_type > &vectal) |
const_reference | operator[] (size_type index) const |
reference | operator[] (size_type index) |
pointer | peek (const iterator &position) |
pointer | peek (const const_iterator &position) const |
pointer | peek_back () |
pointer | peek_back () const |
iterator | poke (iterator position, pointer value_pointer) |
void | poke (size_type index, pointer value_pointer) |
iterator | poke (iterator position, const_iterator start, const_iterator stop) |
void | poke_back (pointer value_pointer) |
void | pop_back () |
iterator | pull (iterator position) |
iterator | pull (iterator start, iterator stop) |
pointer | pull_back () |
pointer | pull_out (size_type index) |
pointer | pull_out (iterator position) |
void | push_back (const_reference value) |
Reverse_Iterator | rbegin () |
Const_Reverse_Iterator | rbegin () const |
Const_Reverse_Iterator | rend () const |
Reverse_Iterator | rend () |
pointer | replace (iterator position, pointer value_pointer) |
void | resize (size_type new_size) |
void | resize (size_type new_size, const_reference value) |
Vectal (Iterator start, Iterator stop) | |
Vectal (const Vectal &vectal) | |
Vectal () | |
Vectal (size_type size, const_reference value) | |
Base & | vector_base () |
void | wipe () |
virtual | ~Vectal () |
Static Public Member Functions | |
static bool | named_in_list (std::string name, const char *const *aliases) |
Try to match a name against an alias list. More... | |
static Projection_Type | projection_type (const std::string &projection_name) |
Get the projection type code for a projection name. More... | |
Static Public Member Functions inherited from PDS_Data | |
static Image_Data_Block * | image_data (PDS_Data_Block_List *data_block_list) |
Get the Image_Data_Block from a PDS_Data::PDS_Data_Block_List. More... | |
Static Public Member Functions inherited from Aggregate | |
static Type | default_type () |
static Type | default_type (const int type) |
Static Public Member Functions inherited from Parameter | |
static bool | case_sensitive () |
static bool | case_sensitive (bool enable) |
static char | path_delimiter (const char delimiter) |
static char | path_delimiter () |
static std::string | type_name (const Type type) |
Static Public Attributes | |
static const char *const | ID |
Class identification name with source code version and date. More... | |
static const char * | PLANET_PARAMETER_NAME = "TARGET_NAME" |
Name of the parameter providing the planet name. More... | |
static const char * | IMAGE_MAP_PROJECTION_GROUP_NAME = "IMAGE_MAP_PROJECTION" |
Name of the parameter group containing projection parameters. More... | |
static const char * | PROJECTION_TYPE_PARAMETER_NAME = "MAP_PROJECTION_TYPE" |
Name of the parameter specifying the type of projection. More... | |
static const char * | COORDINATE_SYSTEM_PARAMETER_NAME = "COORDINATE_SYSTEM_NAME" |
Name of the parameter specifying the type of coordinate system. More... | |
static const char * | LATITUDE_TYPE_PARAMETER_NAME = "PROJECTION_LATITUDE_TYPE" |
Name of the parameter specifying the type of coordinate system. More... | |
static const char * | HORIZONATAL_OFFSET_PARAMETER_NAME = "SAMPLE_PROJECTION_OFFSET" |
Name of the parameter specifying the horizontal offset of the projection origin from the image origin. More... | |
static const char * | VERTICAL_OFFSET_PARAMETER_NAME = "LINE_PROJECTION_OFFSET" |
Name of the parameter specifying the vertical offset of the projection origin from the image origin. More... | |
static const char * | IMAGE_HEIGHT_PARAMETER_NAME = "LINE_LAST_PIXEL" |
Name of the parameter specifying the number of image lines. More... | |
static const char * | IMAGE_WIDTH_PARAMETER_NAME = "SAMPLE_LAST_PIXEL" |
Name of the parameter specifying the number of pixels per image line. More... | |
static const char * | PIXELS_PER_DEGREE_PARAMETER_NAME = "MAP_RESOLUTION" |
Name of the parameter specifying the number of pixels per world degree. More... | |
static const char * | PIXEL_SIZE_PARAMETER_NAME = "MAP_SCALE" |
Name of the parameter specifying the real world size of a pixel. More... | |
static const char * | SEMI_MAJOR_RADIUS_PARAMETER_NAME = "A_AXIS_RADIUS" |
Name of the parameter specifying the planet's semi-major axis radius. More... | |
static const char * | SEMI_MINOR_RADIUS_PARAMETER_NAME = "C_AXIS_RADIUS" |
Name of the parameter specifying the planet's semi-minor axis radius. More... | |
static const char * | FIRST_STANDARD_PARALLEL_PARAMETER_NAME = "FIRST_STANDARD_PARALLEL" |
Name of the parameter specifying the projection first standard parallel. More... | |
static const char * | SECOND_STANDARD_PARALLEL_PARAMETER_NAME = "SECOND_STANDARD_PARALLEL" |
Name of the parameter specifying the projection second standard parallel. More... | |
static const char * | CENTER_LONGITUDE_PARAMETER_NAME = "CENTER_LONGITUDE" |
Name of the parameter specifying the projection center longitude. More... | |
static const char * | CENTER_LATITUDE_PARAMETER_NAME = "CENTER_LATITUDE" |
Name of the parameter specifying the projection center latitude. More... | |
static const char * | MINIMUM_LATITUDE_PARAMETER_NAME = "MINIMUM_LATITUDE" |
Name of the parameter specifying the image minimum latitude. More... | |
static const char * | MAXIMUM_LATITUDE_PARAMETER_NAME = "MAXIMUM_LATITUDE" |
Name of the parameter specifying the image maximum latitude. More... | |
static const char * | MINIMUM_LONGITUDE_PARAMETER_NAME = "WESTERNMOST_LONGITUDE" |
Name of the parameter specifying the image minimum longitude. More... | |
static const char * | MAXIMUM_LONGITUDE_PARAMETER_NAME = "EASTERNMOST_LONGITUDE" |
Name of the parameter specifying the image maximum longitude. More... | |
static const char * | PROJECTION_ROTATION_PARAMETER_NAME = "MAP_PROJECTION_ROTATION" |
Name of the parameter specifying the projection rotation. More... | |
static const char * | MISSING_CONSTANT_PARAMETER_NAME = "MISSING_CONSTANT" |
static const char * | GDAL_NODATA_PARAMETER_NAME = "GDAL_NODATA" |
static const Projection_Definition | Projection_Definitions [TOTAL_PROJECTION_TYPES] |
A Projection_Definition is provided for each known Projection_Type. More... | |
static const double | DEFAULT_GEO_TIFF_TRANSFORM [6] |
The default identity affine transformation matrix. More... | |
static const unsigned char | GEO_TIFF_UUID [16] |
UUID for the GeoTIFF JP2_Box. More... | |
Static Public Attributes inherited from PDS_Data | |
static const char *const | ID |
Class identification name with source code version and date. More... | |
static const char * | PDS_ID_PARAMETER_NAME = "PDS_VERSION_ID" |
Name of the parameter providing the PDS ID. More... | |
static const char * | RECORD_TYPE_PARAMETER_NAME = "RECORD_TYPE" |
Name of the parameter specifying the type of label records. More... | |
static const char * | BYTE_RECORD_TYPE = "UNDEFINED" |
The record type used to define byte count based records. More... | |
static const char * | FIXED_LENGTH_RECORD_TYPE = "FIXED_LENGTH" |
The record type used to define fixed length records. More... | |
static const char * | LABEL_RECORDS_PARAMETER_NAME = "LABEL_RECORDS" |
Name of the parameter specifying the number of records in the label. More... | |
static const char * | RECORD_BYTES_PARAMETER_NAME = "RECORD_BYTES" |
Name of the parameter specifying the number of bytes per record. More... | |
static const char * | FILE_RECORDS_PARAMETER_NAME = "FILE_RECORDS" |
Name of the parameter specifying the number of records in the file. More... | |
static const char * | INTERCHANGE_FORMAT_PARAMETER_NAME = "INTERCHANGE_FORMAT" |
Name of the parameter indicating the data format. More... | |
static const char * | IMAGE_DATA_BLOCK_NAME = "IMAGE" |
Name of the Image_Data_Block parameter group. More... | |
static const char * | BYTES_UNITS = "BYTES" |
Units name for storage measured in bytes. More... | |
static const char | RECORD_POINTER_PARAMETER_MARKER = '^' |
Record pointer parameter prefix. More... | |
Static Public Attributes inherited from Parameter | |
static const bool | DEFAULT_CASE_SENSITIVITY |
static const char | DEFAULT_PATHNAME_DELIMITER |
static const char *const | ID |
Static Public Attributes inherited from Vectal_ID | |
static const char *const | ID |
Protected Attributes | |
std::string | Projection_Name |
The projection name specified in the PDS label. More... | |
Projection_Type | Projection_Type_Code |
The projection type matching the projection name. More... | |
OGRSpatialReference * | Spatial_Reference |
The spatial reference object. More... | |
double | Geo_Transform [6] |
The geo-transform array. More... | |
Protected Attributes inherited from Parameter | |
std::string | Comment |
MODE_STATE | Modes [TOTAL_LOCAL_MODES] |
std::string | Name |
Aggregate * | Parent |
Additional Inherited Members | |
Public Attributes inherited from Aggregate | |
CASE_INSENSITIVE | |
CASE_SENSITIVE | |
Public Attributes inherited from Parameter | |
Verbatim_Strings | |
Indenting | |
TOTAL_LOCAL_MODES | |
MODE_FALSE | |
MODE_TRUE | |
MODE_INHERITED | |
ASSIGNMENT | |
TOKEN | |
AGGREGATE | |
GROUP | |
OBJECT | |
END | |
END_GROUP | |
END_OBJECT | |
LOCAL_MODE_SET | |
DEFAULT_MODE_SET | |
RECURSIVE_MODE_SET | |
Protected Member Functions inherited from Vectal< Parameter > | |
virtual void | entering (pointer value_pointer) |
virtual void | removing (pointer value_pointer) |
Static Protected Attributes inherited from Parameter | |
static bool | Case_Sensitive |
static MODE_STATE | DEFAULT_MODES [TOTAL_LOCAL_MODES] |
static char | Path_Delimiter |
The PDS_Projection_Data provides geographic projection capabilities between image and real world coordinates.
The projection information is defined by a set of PDS_Data parameters, of which this is a subclass. Parameters of known names are sought to provide the required values to assemble the projection definition. As usual, this dependency on parameter names can be a source of misunderstanding. If a required parameter is not found this will be reported in an expception that names the missing parameter.
At the very least, an affine geo-transform array for the identity projection - in which image coordinates and world coordinates are identical - is available. PDS parameters may be provided that enable the identification and assembly of other projections. In addition to a geo-transform array a GDAL (Geospatial Data Abstraction Library, http://www.gdal.org) OGRSpatialReference object may be assembled using PDS parameter values.
The PDS_Projection_Data class provides methods for generating JP2_Box objects containing GeoTIFF (http://www.remotesensing.org/geotiff/geotiff.html) and GML (Geography Markup Language of the Open Geospatial Consortium; http://www.opengeospatial.org/standards/gml and http://www.ogcnetwork.net/gml-jp2) data. GeoTIFF is an informal public domain metadata standard which allows georeferencing information to be embedded within a tagged image file format (TIFF; the JP2 format employs the TIFF mechanism for identifying box contents). The GeoTIFF format was originally created by Dr. Niles Ritter while he was working at the NASA Jet Propulsion Laboratory. GML is part of a complex of ISO (International Standards Organization) specifications for managing geospatial information.
Software interfaces provided by GDAL for generating the OGRSpatialReference and JP2_Box contents are used in the implementation of the PDS_Projection_Data class. In particular, the JP2_GeoTIFF method is based on the GDALJP2Metadata::CreateJP2GeoTIFF method and the JP2_GML method is based on the GDALJP2Metadata::CreateGMLJP2 method.
N.B.: The projection managment capabilities of this class depend on providing correct PDS parameters and the functions of the GDAL software. There is considerable uncertainty about the correct mapping of PDS parameter values to GDAL projection values. This class has been successfully tested with HiRISE PDS RDR data products using the GeoTIFF box contents with image location projection values reported by IDL/ENVI having no significant difference from the same location projection values reported by the USGS/ISIS software. However, the accuracy of results with other PDS data products can not be assured. Also, as of this writing the GML box contents have not been successfully tested.
enum Projection_Type |
Projection types.
Construct a default identity projection.
Only the default identity geo-transform matrix will be available.
References PDS_Projection_Data::DEFAULT_GEO_TIFF_TRANSFORM, and PDS_Projection_Data::Geo_Transform.
PDS_Projection_Data | ( | const PDS_Data & | PDS_data | ) |
Construct a projection from a set of PDS data parameters.
An attempt will be made to assemble geo-transform and spatial reference information from the parameter values.
PDS_data | A reference to a set of PDS data parameters that will be copied into this PDS_Projection_Data object. |
References PDS_Projection_Data::initialize_geo_transform(), and PDS_Projection_Data::initialize_spatial_reference().
PDS_Projection_Data | ( | const std::string & | pathname | ) |
Construct a projection from a file source of PDS parameters.
The source file is parsed for PDS parameters that will be used to assemble geo-transform and spatial reference information.
pathname | A pathname to a file that is will be parsed as a source of PDS parameters. |
References PDS_Projection_Data::initialize_geo_transform(), and PDS_Projection_Data::initialize_spatial_reference().
|
virtual |
Destructor.
All memory owned by the object is released.
References PDS_Projection_Data::Spatial_Reference.
|
virtual |
Set the PDS parameters from a source file.
The current parameters are cleared before the new parameters are moved in, but not before the new parameters have been successfully obtained from the source file. Then the projection information is initialized.
N.B.: The name of the parameters group is set to the source file pathname.
pathname | The pathname to the source file that will be parsed for PVL parameters. |
std::ios::failure | If the source file can not be accessed or read. |
idaeim::PVL::Invalid_Syntax | If the source file contains contains invalid PVL syntax. |
Reimplemented from PDS_Data.
References PDS_Projection_Data::initialize_geo_transform(), PDS_Projection_Data::initialize_spatial_reference(), PDS_Data::parameters(), and Parameter::pathname().
|
virtual |
Set the PDS parameters from a Parameter Aggregate.
The current parameters are cleared before the new parameters are moved in. Then the projection information is initialized.
N.B.: The name of the parameters group is set to the name of the Parameter Aggregate.
parameters | A Parameter Aggregate that is the source of new parameters. |
Reimplemented from PDS_Data.
References PDS_Projection_Data::initialize_geo_transform(), PDS_Projection_Data::initialize_spatial_reference(), and PDS_Data::parameters().
|
inline |
Get the geo-transform array.
The geo-transform contains the six coefficients of a two-dimensional affine transformation. In the classic expression of the two-dimensional affine transformation matrix by Newman and Sproull (Newman, W.M. and Sproull, R.F., "Principles of Interactive Computer Graphics", McGraw-Hill, 1979, section 4-3 Matrix Representations, p. 57ff) a 3x3 matrix representation is used. The last column is elided away because it is always the identity vector:
[x' y'] = [x y 1]|a d 0| |b e 0| |c f 1|
or
x' = a*x + b*y + c y' = d*x + e*y + f
For an image translation operation by Ox,Oy the matrix values are:
| 1 0| | 0 1| |Ox Oy|
For an image scaling operation by Sx,Sy the matrix values are:
|Sx 0| | 0 Sy| | 0 0|
For an image rotation operation by an angle A the matrix values are:
|cos (A) -sin (A)| |sin (A) cos (A)| | 0 0|
These operations can be concatenated - each operation matrix, including the third column identity vector, multiplied by the subsequent operation matrix - to produce a single matrix that incorporates all of the individual transformation operations.
For the geo-transform array the corresponding values are, by array index, GT[0]=c, GT[1]=a, GT[2]=b, GT[3]=f, GT[4]=d, GT[5]=e, or:
|GT[1] GT[4]| |GT[2] GT[5]| |GT[0] GT[3]|
The geo-transform array contains the six coefficients that result from concatenating an offset of the image back (negative) to the projection origin, rotating the image to align with the projection (north up), and scaling from pixel units to world unit (meters):
Where:
For the normal case of an unrotated image projection this reduces to:
<b>N.B.</b>: Image pixel coordinates use a left-handed coordinate system in which the horizontal x-axis is positive to the right from the origin at the upper left corner of the upper left pixel along increasing sample numbers and the vertical y-axis is positive downwards from the origin along increasing line numbers. However the geo-transform operates in the conventional right-handed coordinate system (in meter units) in which the x-axis is positive to the right from the projection origin and the vertical y-axis is positive upwards from the origin. This reversal of the positive vertical direction can be the source of confusion when using the geo-transform values. @return A pointer to the array of six double values of the geo-transform. <b>N.B.</b>: This array is owned by the PDS_Projection_Data object; modifying it will affect the results of its use in subsequent projection operations.
References PDS_Projection_Data::Geo_Transform.
|
inline |
Get the OGRSpatialReference.
References PDS_Projection_Data::Spatial_Reference.
Referenced by PDS_Projection_Data::initialize_spatial_reference().
|
inline |
Get the projection type.
The Projection_Type code, other than UNKNOWN_PROJECTION, can be used as an index into the Projection_Definitions array to obtain details of the mapping between PDS parameters and GDAL SRS paramters.
References PDS_Projection_Data::Projection_Type_Code.
Referenced by PDS_Projection_Data::initialize_spatial_reference(), and PDS_Projection_Data::projection_type().
|
inline |
Get the name of the applicable projection.
Any given type of projection may have several aliases for its name. The name returned by this method is the one that is specified by the PDS PROJECTION_TYPE_PARAMETER_NAME parameter. To obtain the projection name recognized by the GDAL OGRSpatialReference class, use the projection type code, if it is not UNKNOWN_PROJECTION, as the index into the list of projection definitions and use the first entry in the Aliases array:
string formal_projection_name; if (projection_type () != UNKNOWN_PROJECTION) formal_projection_name = Projection_Definitions[projection_type ()].Aliases[0];
References PDS_Projection_Data::Projection_Name.
Referenced by PDS_Projection_Data::projection_type().
PDS_Projection_Data & initialize_geo_transform | ( | ) |
Initialized the geo-transform array values from the PDS parameter values.
There are three required parameters: PIXEL_SIZE_PARAMETER_NAME, HORIZONATAL_OFFSET_PARAMETER_NAME and VERTICAL_OFFSET_PARAMETER_NAME. If a parameter group with the IMAGE_MAP_PROJECTION_GROUP_NAME is present the parameters will be sought in this group; otherwise they may occur anywhere in the current PDS_Data. If none of the required parameters can be found the geo-transform array will be set to the identity values.
The geo-transform values are set as follows:
GT[1] = PIXEL_SIZE * units_scale GT[5] = -GT[1] GT[0] = -(GT[1] * (HORIZONTAL_OFFSET - 1)) GT[3] = -(GT[5] * (VERTICAL_OFFSET - 1)) GT[2] = GT[4] = 0
The pixel is presumed to have a square shape; thus the PIXEL_SIZE value of the PIXEL_SIZE_PARAMETER_NAME parameter applies to both the horizontal and vertical dimension.
The geo-transform values are in a real world space in which distance is measured in meters. The PDS Data Dictionary specifies that the units for the PIXEL_SIZE_PARAMETER_NAME parameter should be "KM/PIX". However, for some data products (e.g. HiRISE) the pixel size is measured in meters. The only way to distinguish which units apply is to examine the units string associated with the value. However, if the value has no units string it must be assumed that the PDS Data Dictionary units are in effect. Thus the units_scale is 1000 if the parameter units string is empty or specifies kilometers; otherwise it is 1.
N.B.: The pixel vertical (GT[5]) dimension is negative to compensate for the left-handed image coordinate system in which positive vertical is downwards and the right-handed geographic coordinate system in which positive vertical is upwards.
The HORIZONTAL_OFFSET and VERTICAL_OFFSET values of the HORIZONATAL_OFFSET_PARAMETER_NAME and VERTICAL_OFFSET_PARAMETER_NAME parameters, respectively, are the offsets of the map projection origin from the image origin in image coordinate space (sample,line). Because the PDS image origin is (1,1) - there is no (0,0) pixel - while the geographic projection origin is (0,0) the offset values are adjusted to a conventional (0,0) image origin.
Warning: Different PDS data products locate the image origin differently: Some use the upper left corner of the upper left pixel, while others use the center of the upper left pixel. Unfortuntately there is nothing in the PDS label to indicate which location is being used. This implementation assumes that the image origin is located at the upper left corner of the upper left pixel.
std::logic_error | If the PROJECTION_ROTATION_PARAMETER_NAME parameter is found and it has a non-zero value (hopefully this can be supported in a future version of this class). |
idaeim::PVL_Invalid_Value | If any of the required PDS parameters is not an assignment of a single numeric value. |
References PDS_Projection_Data::DEFAULT_GEO_TIFF_TRANSFORM, Aggregate::find(), PDS_Data::find_parameter(), PDS_Projection_Data::Geo_Transform, PDS_Projection_Data::HORIZONATAL_OFFSET_PARAMETER_NAME, PDS_Projection_Data::ID, PDS_Projection_Data::IMAGE_MAP_PROJECTION_GROUP_NAME, Parameter::is_Aggregate(), PDS_Data::numeric_value(), PDS_Projection_Data::PIXEL_SIZE_PARAMETER_NAME, PDS_Projection_Data::PROJECTION_ROTATION_PARAMETER_NAME, UA::HiRISE::to_uppercase(), Aggregate::value(), and PDS_Projection_Data::VERTICAL_OFFSET_PARAMETER_NAME.
Referenced by PDS_Projection_Data::parameters(), and PDS_Projection_Data::PDS_Projection_Data().
PDS_Projection_Data & initialize_spatial_reference | ( | ) |
Initialize the spatial reference information of a new OGRSpatialReference object.
A GDAL OGRSpatialReference object (http://www.gdal.org/ogr/classOGRSpatialReference.html) is initialized if all its required PDS parameter values are successfully found.
First the projection name is erased, the projection type is initialized to UNKNOWN_PROJECTION, any existing OGRSpatialReference object is deleted and the spatial reference set to NULL.
If a parameter group with the IMAGE_MAP_PROJECTION_GROUP_NAME is present all remaining PDS parameters will be sought in this group; otherwise they may occur anywhere in the current PDS_Data.
Planet name The planet name, as determined above. If the projection type is EQUIRECTANGULAR a "_localRadius" suffix is applied. If the projection type is POLAR_STEREOGRAPHIC a "_polarRadius" suffix is applied.
Geographic name The unaltered planet name with a "GCS_" prefix.
Datum name The unaltered planet name with a "D_" prefix.
Planet axis radius The planet axis radius is the value of the SEMI_MAJOR_RADIUS_PARAMETER_NAME parameter. However, if the projection is not geocentric based and the projection type is POLAR_STEREOGRAPHIC or STEREOGRAPHIC with a CENTER_LATITUDE_PARAMETER_NAME parameter absoulte value of 90 (i.e. stereographic centered at a pole) then the SEMI_MINOR_RADIUS_PARAMETER_NAME parameter value is used.
The use of a geocentric based projection (i.e. planetographic) is determined by the COORDINATE_SYSTEM_PARAMETER_NAME parameter, or the LATITUDE_TYPE_PARAMETER_NAME if the former is not found. Unless the parameter value is "planetocentric" (case insensitive) planetographic applies. However, the EQUIRECTANGULAR, ORTHOGRAPHIC and SINUSOIDAL projection types are not subject to this condition; they are always deemed to be planetocentric.
Planet inverse flattening The inverse of an elipsoidal planet model flattening is the ratio of the semi-major axis radius to this value minus the semi-minor axis radius (using the parameters indicated above). Note that as the two values approach equality the ratio approaches infiniity, if the difference is less than or equal to 0.00000001 the inverse flattening is set to zero which indicates a spherical planet model. Also, if the projection is planetocentric (as determined above) or pole centered stereographic (as determined above) then the inverse flattening is always set to zero.
Prime meridian name This descriptive name is set to "Reference_Meridian".
Prime meridian offset Set to 0.
If the tentative OGRSpatialReference object can not be initialized for any reason it is deleted. Otherwise it is set as the current {@link spatial_reference() spatial reference} object. Note that it is possible to have identified a {@link projection_name() projection name} and {@link projection_type() projection type} but fail to initialize a {@link spatial_reference() spatial reference} object. @return This PDS_Projection_Data object. @throws idaeim::Invalid_Argument If a required PDS parameter can not be found. @throws idaeim::PVL_Invalid_Value If a required PDS parameter is not an assignment of a single numeric (or string, as the situation requires) value. @throws std::logic_error If an OGRSpatialReference initialization operation fails.
References PDS_Projection_Data::Projection_Definition::Aliases, PDS_Projection_Data::CENTER_LATITUDE_PARAMETER_NAME, PDS_Projection_Data::COORDINATE_SYSTEM_PARAMETER_NAME, PDS_Projection_Data::Projection_Definition::Default_Parameters, PDS_Projection_Data::EQUIRECTANGULAR, PDS_Data::find_parameter(), PDS_Projection_Data::GDAL_NODATA_PARAMETER_NAME, PDS_Projection_Data::ID, PDS_Projection_Data::IMAGE_MAP_PROJECTION_GROUP_NAME, Parameter::is_Aggregate(), Value::is_String(), PDS_Projection_Data::LATITUDE_TYPE_PARAMETER_NAME, PDS_Projection_Data::MISSING_CONSTANT_PARAMETER_NAME, PDS_Data::numeric_value(), PDS_Projection_Data::ORTHOGRAPHIC, PDS_Projection_Data::PLANET_PARAMETER_NAME, PDS_Projection_Data::POLAR_STEREOGRAPHIC, PDS_Projection_Data::Projection_Definitions, PDS_Projection_Data::Projection_Name, PDS_Projection_Data::projection_type(), PDS_Projection_Data::Projection_Type_Code, PDS_Projection_Data::PROJECTION_TYPE_PARAMETER_NAME, PDS_Projection_Data::Projection_Definition::Required_Parameters, PDS_Projection_Data::SEMI_MAJOR_RADIUS_PARAMETER_NAME, PDS_Projection_Data::SEMI_MINOR_RADIUS_PARAMETER_NAME, PDS_Projection_Data::SINUSOIDAL, PDS_Projection_Data::spatial_reference(), PDS_Projection_Data::Spatial_Reference, PDS_Projection_Data::Projection_Definition::Required_Projection_Parameter::SRS_Parameter_Name, PDS_Projection_Data::Projection_Definition::Default_Projection_Parameter::SRS_Parameter_Name, PDS_Projection_Data::STEREOGRAPHIC, PDS_Data::string_value(), UA::HiRISE::to_uppercase(), PDS_Projection_Data::UNKNOWN_PROJECTION, Aggregate::value(), and Parameter::value().
Referenced by PDS_Projection_Data::parameters(), and PDS_Projection_Data::PDS_Projection_Data().
JP2_Box * JP2_GeoTIFF | ( | ) | const |
Get a JP2_Box with GeoTIFF data content.
The GeoTIFF JP2_Box is a JP2_Box::UUID_BOX_TYPE with content that begins with the GEO_TIFF_UUID signature. Immediately following the signature is binary data produced by the GDAL GTIFMemBufFromWkt function that operates on Spatial Reference System Well-Known_Text representation of the current projection specifications (generated by the OGRSpatialReference::exportToWkt method), and the current geo-transform array.
std::logic_error | If the GeoTIFF data production by GDAL fails. |
References JP2_Box::append_content(), PDS_Projection_Data::GEO_TIFF_UUID, PDS_Projection_Data::Geo_Transform, GTIFMemBufFromWkt(), PDS_Projection_Data::ID, PDS_Projection_Data::Spatial_Reference, and JP2_Box::UUID_BOX_TYPE.
Referenced by main().
JP2_Box * JP2_GML | ( | unsigned int | image_width = 0 , |
unsigned int | image_height = 0 |
||
) | const |
Get a JP2_Box with GML data content.
If the either the image width or height arguments are not specified the PDS IMAGE_WIDTH_PARAMETER_NAME and IMAGE_HEIGHT_PARAMETER_NAME parameters will be used to obtain the required values.
The GML JP2_Box is a JP2_Box::ASSOCIATION_BOX_TYPE containing a JP2_Box::LABEL_BOX_TYPE with a "gml.data" label and a JP2_Box::ASSOCIATION_BOX_TYPE containing a JP2_Box::LABEL_BOX_TYPE with a "gml.root-instance" label followed by a JP2_Box::XML_BOX_TYPE containing a "gml:FeatureCollection" XML document that provides the current geo-transform specifications. N.B. This XML document is a hardcoded copy of the document format text taken verbatim from the GDAL GDALJP2Metadata::CreateGMLJP2 method.
If the current spatial reference object is flagged as projected (OGRSpatialReference::IsProjected) or geographic (OGRSpatialReference::IsGeographic) its corrsponding authority name (OGRSpatialReference::GetAuthorityName) is "epsg" (case insensitive) the XML "srsName" will be "urn:ogc:def:crs:EPSG::" followed by the spatial reference authority code (OGRSpatialReference::GetAuthorityCode).
If no EGSG authority code is found then the XML "srsName" will be "gmljp2://xml/CRSDictionary.gml#ogrcrs1" and an additional JP2_Box::ASSOCIATION_BOX_TYPE will be added to the primary JP2_Box. This will contain a JP2_Box::LABEL_BOX_TYPE with a "CRSDictionary.gml" label followed by a JP2_Box::XML_BOX_TYPE containing a "gml:Dictionary" XML document with the following references:
The XML dictionary document is produced by the OGRSpatialReference::exportToXML method of the current spatial reference object. <b>WARNING</b>: As of this writing no tests have been able to confirm that the GML content is correct. @param image_width The width of the image be referenced. If zero the {@link #IMAGE_WIDTH_PARAMETER_NAME} parameter value, if available, will be used. @param image_height The height of the image be referenced. If zero the {@link #IMAGE_HEIGHT_PARAMETER_NAME} parameter value, if available, will be used. @return A pointer to a JP2_Box containing the GML data, or NULL if no {@link spatial_reference() spatial reference} object has been {@link initialize_spatial_reference() initialized}. <b>N.B.</b>: Ownership of the JP2_Box is transferred to the caller. @throws idaeim::Exception If the image width or height values can not be determined from the PDS_Data. @throws std::logic_error If the GeoTIFF data production by GDAL fails.
References Aggregate::add(), JP2_Box::add(), JP2_Box::ASSOCIATION_BOX_TYPE, PDS_Projection_Data::Geo_Transform, PDS_Projection_Data::ID, PDS_Projection_Data::IMAGE_HEIGHT_PARAMETER_NAME, PDS_Projection_Data::IMAGE_WIDTH_PARAMETER_NAME, JP2_Box::LABEL_BOX_TYPE, PDS_Data::numeric_value(), PDS_Projection_Data::Projection_Name, PDS_Projection_Data::Spatial_Reference, UA::HiRISE::to_uppercase(), and JP2_Box::XML_BOX_TYPE.
Referenced by main().
|
static |
Try to match a name against an alias list.
The name is first uppercased, spaces are replaced with underbars, then compared against each name in the alias list in uppercase form. If this fails the comparison is then made against each alias in uppercase form with any underbar characters removed. Note that the name matching is case insensitive. N.B.: Alias names containing any space characters will never be matched; don't use space characters in alias names.
name | The name to be checked. |
aliases | The NULL-terminated list of alias names. |
References Parameter::name().
Referenced by PDS_Projection_Data::projection_type().
|
static |
Get the projection type code for a projection name.
The list of known projection definitions is searched for a projection name alias that {matches} the specified projection name. projection_name The projection name to match against a Projection_Definition aliases list. The Projection_Type code for the matching Projection_Definition, or UNKNOWN_PROJECTION if no match could be found.
References PDS_Projection_Data::Projection_Definition::Aliases, PDS_Projection_Data::named_in_list(), PDS_Projection_Data::Projection_Definitions, PDS_Projection_Data::projection_name(), PDS_Projection_Data::projection_type(), PDS_Projection_Data::TOTAL_PROJECTION_TYPES, and PDS_Projection_Data::UNKNOWN_PROJECTION.
|
static |
Class identification name with source code version and date.
Referenced by PDS_Projection_Data::initialize_geo_transform(), PDS_Projection_Data::initialize_spatial_reference(), PDS_Projection_Data::JP2_GeoTIFF(), and PDS_Projection_Data::JP2_GML().
|
static |
Name of the parameter providing the planet name.
Referenced by PDS_Projection_Data::initialize_spatial_reference().
|
static |
Name of the parameter group containing projection parameters.
Referenced by PDS_Projection_Data::initialize_geo_transform(), and PDS_Projection_Data::initialize_spatial_reference().
|
static |
Name of the parameter specifying the type of projection.
Referenced by PDS_Projection_Data::initialize_spatial_reference().
|
static |
Name of the parameter specifying the type of coordinate system.
Referenced by PDS_Projection_Data::initialize_spatial_reference().
|
static |
Name of the parameter specifying the type of coordinate system.
Referenced by PDS_Projection_Data::initialize_spatial_reference().
|
static |
Name of the parameter specifying the horizontal offset of the projection origin from the image origin.
Referenced by PDS_Projection_Data::initialize_geo_transform().
|
static |
Name of the parameter specifying the vertical offset of the projection origin from the image origin.
Referenced by PDS_Projection_Data::initialize_geo_transform().
|
static |
Name of the parameter specifying the number of image lines.
Referenced by PDS_Projection_Data::JP2_GML().
|
static |
Name of the parameter specifying the number of pixels per image line.
Referenced by PDS_Projection_Data::JP2_GML().
|
static |
Name of the parameter specifying the number of pixels per world degree.
|
static |
Name of the parameter specifying the real world size of a pixel.
Referenced by PDS_Projection_Data::initialize_geo_transform().
|
static |
Name of the parameter specifying the planet's semi-major axis radius.
Referenced by PDS_Projection_Data::initialize_spatial_reference().
|
static |
Name of the parameter specifying the planet's semi-minor axis radius.
Referenced by PDS_Projection_Data::initialize_spatial_reference().
|
static |
Name of the parameter specifying the projection first standard parallel.
|
static |
Name of the parameter specifying the projection second standard parallel.
|
static |
Name of the parameter specifying the projection center longitude.
|
static |
Name of the parameter specifying the projection center latitude.
Referenced by PDS_Projection_Data::initialize_spatial_reference().
|
static |
Name of the parameter specifying the image minimum latitude.
|
static |
Name of the parameter specifying the image maximum latitude.
|
static |
Name of the parameter specifying the image minimum longitude.
|
static |
Name of the parameter specifying the image maximum longitude.
|
static |
Name of the parameter specifying the projection rotation.
Referenced by PDS_Projection_Data::initialize_geo_transform().
|
static |
Referenced by PDS_Projection_Data::initialize_spatial_reference().
|
static |
Referenced by PDS_Projection_Data::initialize_spatial_reference().
|
static |
A Projection_Definition is provided for each known Projection_Type.
Referenced by PDS_Projection_Data::initialize_spatial_reference(), and PDS_Projection_Data::projection_type().
|
static |
The default identity affine transformation matrix.
Referenced by PDS_Projection_Data::initialize_geo_transform(), and PDS_Projection_Data::PDS_Projection_Data().
|
static |
UUID for the GeoTIFF JP2_Box.
Referenced by PDS_Projection_Data::JP2_GeoTIFF().
|
protected |
The projection name specified in the PDS label.
Referenced by PDS_Projection_Data::initialize_spatial_reference(), PDS_Projection_Data::JP2_GML(), and PDS_Projection_Data::projection_name().
|
protected |
The projection type matching the projection name.
Referenced by PDS_Projection_Data::initialize_spatial_reference(), and PDS_Projection_Data::projection_type().
|
protected |
The spatial reference object.
Referenced by PDS_Projection_Data::initialize_spatial_reference(), PDS_Projection_Data::JP2_GeoTIFF(), PDS_Projection_Data::JP2_GML(), PDS_Projection_Data::spatial_reference(), and PDS_Projection_Data::~PDS_Projection_Data().
|
protected |
The geo-transform array.
Referenced by PDS_Projection_Data::geo_transform(), PDS_Projection_Data::initialize_geo_transform(), PDS_Projection_Data::JP2_GeoTIFF(), PDS_Projection_Data::JP2_GML(), and PDS_Projection_Data::PDS_Projection_Data().