HiRISE
 PDS_JP2

Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Attributes

PDS_Projection_Data Class Reference

The PDS_Projection_Data provides geographic projection capabilities between image and real world coordinates. More...

#include <PDS_Projection_Data.hh>

Inheritance diagram for PDS_Projection_Data:
Inheritance graph
[legend]
Collaboration diagram for PDS_Projection_Data:
Collaboration graph
[legend]

List of all members.

Classes

struct  Projection_Definition
 A Projection_Definition maps GDAL OGRSpatialReference parameter names to their required PDS parameter names and default values. More...

Public Types

enum  Projection_Type {
  UNKNOWN_PROJECTION = -1,
  EQUIRECTANGULAR = 0,
  POLAR_STEREOGRAPHIC,
  ALBERS,
  BONNE,
  CYLINDRICAL_EQUAL_AREA,
  GNOMONIC,
  LAMBERT_AZIMUTHAL_EQUAL_AREA,
  LAMBERT_CONFORMAL_CONIC,
  MERCATOR,
  MOLLWEIDE,
  OBLIQUE_CYLINDRICAL,
  ORTHOGRAPHIC,
  SINUSOIDAL,
  STEREOGRAPHIC,
  TRANSVERSE_MERCATOR,
  VANDERGRINTEN,
  TOTAL_PROJECTION_TYPES
}
 

Projection types.

More...

Public Member Functions

 PDS_Projection_Data ()
 Construct a default identity projection.
 PDS_Projection_Data (const PDS_Data &PDS_data)
 Construct a projection from a set of PDS data parameters.
 PDS_Projection_Data (const std::string &pathname)
 Construct a projection from a file source of PDS parameters.
virtual ~PDS_Projection_Data ()
 Destructor.
virtual PDS_Dataparameters (const std::string &pathname)
 Set the PDS parameters from a source file.
virtual PDS_Dataparameters (const idaeim::PVL::Aggregate &parameters)
 Set the PDS parameters from a Parameter Aggregate.
const double * geo_transform () const
 Get the geo-transform array.
OGRSpatialReference * spatial_reference () const
 Get the OGRSpatialReference.
Projection_Type projection_type () const
 Get the projection type.
std::string projection_name () const
 Get the name of the applicable projection.
PDS_Projection_Datainitialize_geo_transform ()
 Initialized the geo-transform array values from the PDS parameter values.
PDS_Projection_Datainitialize_spatial_reference ()
 Initialize the spatial reference information of a new OGRSpatialReference object.
JP2_BoxJP2_GeoTIFF () const
 Get a JP2_Box with GeoTIFF data content.
JP2_BoxJP2_GML (unsigned int image_width=0, unsigned int image_height=0) const
 Get a JP2_Box with GML data content.

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.
static Projection_Type projection_type (const std::string &projection_name)
 Get the projection type code for a projection name.

Static Public Attributes

static const char *const ID = "UA::HiRISE::PDS_Projection_Data (1.22 2013/03/14 21:00:43)"
 Class identification name with source code version and date.
static const char * PLANET_PARAMETER_NAME = "TARGET_NAME"
 Name of the parameter providing the planet name.
static const char * IMAGE_MAP_PROJECTION_GROUP_NAME = "IMAGE_MAP_PROJECTION"
 Name of the parameter group containing projection parameters.
static const char * PROJECTION_TYPE_PARAMETER_NAME = "MAP_PROJECTION_TYPE"
 Name of the parameter specifying the type of projection.
static const char * COORDINATE_SYSTEM_PARAMETER_NAME = "COORDINATE_SYSTEM_NAME"
 Name of the parameter specifying the type of coordinate system.
static const char * LATITUDE_TYPE_PARAMETER_NAME = "PROJECTION_LATITUDE_TYPE"
 Name of the parameter specifying the type of coordinate system.
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.
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.
static const char * IMAGE_HEIGHT_PARAMETER_NAME = "LINE_LAST_PIXEL"
 Name of the parameter specifying the number of image lines.
static const char * IMAGE_WIDTH_PARAMETER_NAME = "SAMPLE_LAST_PIXEL"
 Name of the parameter specifying the number of pixels per image line.
static const char * PIXELS_PER_DEGREE_PARAMETER_NAME = "MAP_RESOLUTION"
 Name of the parameter specifying the number of pixels per world degree.
static const char * PIXEL_SIZE_PARAMETER_NAME = "MAP_SCALE"
 Name of the parameter specifying the real world size of a pixel.
static const char * SEMI_MAJOR_RADIUS_PARAMETER_NAME = "A_AXIS_RADIUS"
 Name of the parameter specifying the planet's semi-major axis radius.
static const char * SEMI_MINOR_RADIUS_PARAMETER_NAME = "C_AXIS_RADIUS"
 Name of the parameter specifying the planet's semi-minor axis radius.
static const char * FIRST_STANDARD_PARALLEL_PARAMETER_NAME = "FIRST_STANDARD_PARALLEL"
 Name of the parameter specifying the projection first standard parallel.
static const char * SECOND_STANDARD_PARALLEL_PARAMETER_NAME = "SECOND_STANDARD_PARALLEL"
 Name of the parameter specifying the projection second standard parallel.
static const char * CENTER_LONGITUDE_PARAMETER_NAME = "CENTER_LONGITUDE"
 Name of the parameter specifying the projection center longitude.
static const char * CENTER_LATITUDE_PARAMETER_NAME = "CENTER_LATITUDE"
 Name of the parameter specifying the projection center latitude.
static const char * MINIMUM_LATITUDE_PARAMETER_NAME = "MINIMUM_LATITUDE"
 Name of the parameter specifying the image minimum latitude.
static const char * MAXIMUM_LATITUDE_PARAMETER_NAME = "MAXIMUM_LATITUDE"
 Name of the parameter specifying the image maximum latitude.
static const char * MINIMUM_LONGITUDE_PARAMETER_NAME = "WESTERNMOST_LONGITUDE"
 Name of the parameter specifying the image minimum longitude.
static const char * MAXIMUM_LONGITUDE_PARAMETER_NAME = "EASTERNMOST_LONGITUDE"
 Name of the parameter specifying the image maximum longitude.
static const char * PROJECTION_ROTATION_PARAMETER_NAME = "MAP_PROJECTION_ROTATION"
 Name of the parameter specifying the projection rotation.
static const Projection_Definition Projection_Definitions [TOTAL_PROJECTION_TYPES]
 A Projection_Definition is provided for each known Projection_Type.
static const double DEFAULT_GEO_TIFF_TRANSFORM [6]
 The default identity affine transformation matrix.
static const unsigned char GEO_TIFF_UUID [16]
 UUID for the GeoTIFF JP2_Box.

Protected Attributes

std::string Projection_Name
 The projection name specified in the PDS label.
Projection_Type Projection_Type_Code
 The projection type matching the projection name.
OGRSpatialReference * Spatial_Reference
 The spatial reference object.
double Geo_Transform [6]
 The geo-transform array.

Detailed Description

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.

Author:
Bradford Castalia, UA/HiROC
Version:
1.11

Member Enumeration Documentation

Projection types.

Enumerator:
UNKNOWN_PROJECTION 
EQUIRECTANGULAR 
POLAR_STEREOGRAPHIC 
ALBERS 
BONNE 
CYLINDRICAL_EQUAL_AREA 
GNOMONIC 
LAMBERT_AZIMUTHAL_EQUAL_AREA 
LAMBERT_CONFORMAL_CONIC 
MERCATOR 
MOLLWEIDE 
OBLIQUE_CYLINDRICAL 
ORTHOGRAPHIC 
SINUSOIDAL 
STEREOGRAPHIC 
TRANSVERSE_MERCATOR 
VANDERGRINTEN 
TOTAL_PROJECTION_TYPES 

Constructor & Destructor Documentation

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.

Parameters:
PDS_dataA reference to a set of PDS data parameters that will be copied into this PDS_Projection_Data object.
See also:
initialize_geo_transform()
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.

Parameters:
pathnameA pathname to a file that is will be parsed as a source of PDS parameters.
See also:
initialize_geo_transform()
initialize_spatial_reference()
~PDS_Projection_Data (  ) [virtual]

Destructor.

All memory owned by the object is released.

References PDS_Projection_Data::Spatial_Reference.


Member Function Documentation

PDS_Data & parameters ( const std::string &  pathname ) [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.

Parameters:
pathnameThe pathname to the source file that will be parsed for PVL parameters.
Returns:
This PDS_Projection_Data object.
Exceptions:
std::ios::failureIf the source file can not be accessed or read.
idaeim::PVL::Invalid_SyntaxIf the source file contains contains invalid PVL syntax.
See also:
idaeim::PVL::Parser
initialize_geo_transform()
initialize_spatial_reference()

Reimplemented from PDS_Data.

References PDS_Data::parameters().

PDS_Data & parameters ( const idaeim::PVL::Aggregate parameters ) [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:
parametersA Parameter Aggregate that is the source of new parameters.
Returns:
This PDS_Projection_Data object.
See also:
initialize_geo_transform()
initialize_spatial_reference()

Reimplemented from PDS_Data.

References PDS_Data::parameters().

const double* geo_transform (  ) const [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):

  1. -(Sx * Ox * cos (A)) - (Sx * Oy * sin (A))
  2. Sx * cos (A)
  3. Sx * sin (A)
  4. (Sy * Ox * sin (A)) - (Sy * Oy * cos (A))
  5. Sy * -sin (A)
  6. Sy * cos (A)

Where:

Ox,Oy
The offset, in pixels, of the projection origin relative to the upper-left corner of the upper-left image pixel.
Sx,Sy
The pixel size dimensions, in meters.
A
The clockwise angle of rotation about the projection origin relative to the vertical (north-pointing) axis.

For the normal case of an unrotated image projection this reduces to:

  1. -Sx * Ox
  2. Sx
  3. 0
  4. -Sy * Oy
  5. 0
  6. Sy

N.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.

Returns:
A pointer to the array of six double values of the geo-transform. N.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.

OGRSpatialReference* spatial_reference (  ) const [inline]

Get the OGRSpatialReference.

Returns:
If a OGRSpatialReference was assembled from the available parameter values a copy is returned; otherwise NULL is returned.

References PDS_Projection_Data::Spatial_Reference.

Referenced by PDS_Projection_Data::initialize_spatial_reference().

Projection_Type projection_type (  ) const [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.

Returns:
A Projection_Type code. If a projection could not be initialized this will be the UNKNOWN_PROJECTION value.

References PDS_Projection_Data::Projection_Type_Code.

Referenced by PDS_Projection_Data::initialize_spatial_reference().

std::string projection_name (  ) const [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];
Returns:
A string having the formal name of the applicable projection. If a projection could not be initialized this will be an empty string.

References PDS_Projection_Data::Projection_Name.

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.

Returns:
This PDS_Projection_Data object.
Exceptions:
std::logic_errorIf 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_ValueIf any of the required PDS parameters is not an assignment of a single numeric value.
See also:
geo_transform()

References PDS_Projection_Data::DEFAULT_GEO_TIFF_TRANSFORM, 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(), Parameter::path_delimiter(), 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.

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.

A PROJECTION_TYPE_PARAMETER_NAME parameter is required that names the type of applicable projection. This determines the projection name which is used to search the list of known projection definitions for a Projection_Definition with a matching name in its Aliases list. If no match is found nothing more is done.

A tentative OGRSpatialReference object is constructed and initialized (OGRSpatialReference::SetProjection) with the formal projection name - the first name in the projection definition's Aliases list - which may be different from the PDS projection name. The value of each required PDS parameter of the projection definition is used to initialize (OGRSpatialReference::SetNormProjParm) the associated OGRSpatialReference object's spatial reference system parameter. In addition, each default value of the projection definition is used to initialize the associated OGRSpatialReference object's spatial reference system parameter.

The OGRSpatialReference object's projection coordinate system name is initialized (OGRSpatialReference::SetProjCS) with the formal projection name followed, after a single space character, by the planet name. The planet name is obtained from the PLANET_PARAMETER_NAME PDS parameter; if this can't be found "Unknown" is used. The geographic coordinate system specification is initialized (OGRSpatialReference::SetGeogCS) with the following values:

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 spatial reference object. Note that it is possible to have identified a projection name and projection type but fail to initialize a spatial reference object.

Returns:
This PDS_Projection_Data object.
Exceptions:
idaeim::Invalid_ArgumentIf a required PDS parameter can not be found.
idaeim::PVL_Invalid_ValueIf a required PDS parameter is not an assignment of a single numeric (or string, as the situation requires) value.
std::logic_errorIf 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::ID, PDS_Projection_Data::IMAGE_MAP_PROJECTION_GROUP_NAME, Parameter::is_Aggregate(), PDS_Projection_Data::LATITUDE_TYPE_PARAMETER_NAME, PDS_Data::numeric_value(), PDS_Projection_Data::ORTHOGRAPHIC, Parameter::path_delimiter(), 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::Default_Projection_Parameter::SRS_Parameter_Name, PDS_Projection_Data::Projection_Definition::Required_Projection_Parameter::SRS_Parameter_Name, PDS_Projection_Data::STEREOGRAPHIC, PDS_Data::string_value(), UA::HiRISE::to_uppercase(), PDS_Projection_Data::UNKNOWN_PROJECTION, Parameter::value(), and Aggregate::value().

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.

Returns:
A pointer to a JP2_Box containing the GeoTIFF data, or NULL if no spatial reference object has been initialized. N.B.: Ownership of the JP2_Box is transferred to the caller.
Exceptions:
std::logic_errorIf 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:

  • gml:id="CRSU1"
  • xmlns:gml="http://www.opengis.net/gml"
  • xmlns:xlink="http://www.w3.org/1999/xlink"
  • xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

The XML dictionary document is produced by the OGRSpatialReference::exportToXML method of the current spatial reference object.

WARNING: As of this writing no tests have been able to confirm that the GML content is correct.

Parameters:
image_widthThe width of the image be referenced. If zero the IMAGE_WIDTH_PARAMETER_NAME parameter value, if available, will be used.
image_heightThe height of the image be referenced. If zero the IMAGE_HEIGHT_PARAMETER_NAME parameter value, if available, will be used.
Returns:
A pointer to a JP2_Box containing the GML data, or NULL if no spatial reference object has been initialized. N.B.: Ownership of the JP2_Box is transferred to the caller.
Exceptions:
idaeim::ExceptionIf the image width or height values can not be determined from the PDS_Data.
std::logic_errorIf the GeoTIFF data production by GDAL fails.

References JP2_Box::add(), JP2_Box::ASSOCIATION_BOX_TYPE, ID, JP2_Box::LABEL_BOX_TYPE, UA::HiRISE::numeric_value(), UA::HiRISE::to_uppercase(), and JP2_Box::XML_BOX_TYPE.

Referenced by main().

bool named_in_list ( std::string  name,
const char *const *  aliases 
) [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.

Parameters:
nameThe name to be checked.
aliasesThe NULL-terminated list of alias names.
Returns:
true if a match was found; false otherwise.
PDS_Projection_Data::Projection_Type projection_type ( const std::string &  projection_name ) [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.

Parameters:
projection_nameThe projection name to match against a Projection_Definition aliases list.
Returns:
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.


Member Data Documentation

const char *const ID = "UA::HiRISE::PDS_Projection_Data (1.22 2013/03/14 21:00:43)" [static]

Class identification name with source code version and date.

Reimplemented from PDS_Data.

Referenced by PDS_Projection_Data::initialize_geo_transform(), PDS_Projection_Data::initialize_spatial_reference(), and PDS_Projection_Data::JP2_GeoTIFF().

const char * PLANET_PARAMETER_NAME = "TARGET_NAME" [static]

Name of the parameter providing the planet name.

Referenced by PDS_Projection_Data::initialize_spatial_reference().

const char * IMAGE_MAP_PROJECTION_GROUP_NAME = "IMAGE_MAP_PROJECTION" [static]

Name of the parameter group containing projection parameters.

Referenced by PDS_Projection_Data::initialize_geo_transform(), and PDS_Projection_Data::initialize_spatial_reference().

const char * PROJECTION_TYPE_PARAMETER_NAME = "MAP_PROJECTION_TYPE" [static]

Name of the parameter specifying the type of projection.

Referenced by PDS_Projection_Data::initialize_spatial_reference().

const char * COORDINATE_SYSTEM_PARAMETER_NAME = "COORDINATE_SYSTEM_NAME" [static]

Name of the parameter specifying the type of coordinate system.

Referenced by PDS_Projection_Data::initialize_spatial_reference().

const char * LATITUDE_TYPE_PARAMETER_NAME = "PROJECTION_LATITUDE_TYPE" [static]

Name of the parameter specifying the type of coordinate system.

Referenced by PDS_Projection_Data::initialize_spatial_reference().

const char * HORIZONATAL_OFFSET_PARAMETER_NAME = "SAMPLE_PROJECTION_OFFSET" [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().

const char * VERTICAL_OFFSET_PARAMETER_NAME = "LINE_PROJECTION_OFFSET" [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().

const char * IMAGE_HEIGHT_PARAMETER_NAME = "LINE_LAST_PIXEL" [static]

Name of the parameter specifying the number of image lines.

const char * IMAGE_WIDTH_PARAMETER_NAME = "SAMPLE_LAST_PIXEL" [static]

Name of the parameter specifying the number of pixels per image line.

const char * PIXELS_PER_DEGREE_PARAMETER_NAME = "MAP_RESOLUTION" [static]

Name of the parameter specifying the number of pixels per world degree.

const char * PIXEL_SIZE_PARAMETER_NAME = "MAP_SCALE" [static]

Name of the parameter specifying the real world size of a pixel.

Referenced by PDS_Projection_Data::initialize_geo_transform().

const char * SEMI_MAJOR_RADIUS_PARAMETER_NAME = "A_AXIS_RADIUS" [static]

Name of the parameter specifying the planet's semi-major axis radius.

Referenced by PDS_Projection_Data::initialize_spatial_reference().

const char * SEMI_MINOR_RADIUS_PARAMETER_NAME = "C_AXIS_RADIUS" [static]

Name of the parameter specifying the planet's semi-minor axis radius.

Referenced by PDS_Projection_Data::initialize_spatial_reference().

const char * FIRST_STANDARD_PARALLEL_PARAMETER_NAME = "FIRST_STANDARD_PARALLEL" [static]

Name of the parameter specifying the projection first standard parallel.

const char * SECOND_STANDARD_PARALLEL_PARAMETER_NAME = "SECOND_STANDARD_PARALLEL" [static]

Name of the parameter specifying the projection second standard parallel.

const char * CENTER_LONGITUDE_PARAMETER_NAME = "CENTER_LONGITUDE" [static]

Name of the parameter specifying the projection center longitude.

const char * CENTER_LATITUDE_PARAMETER_NAME = "CENTER_LATITUDE" [static]

Name of the parameter specifying the projection center latitude.

Referenced by PDS_Projection_Data::initialize_spatial_reference().

const char * MINIMUM_LATITUDE_PARAMETER_NAME = "MINIMUM_LATITUDE" [static]

Name of the parameter specifying the image minimum latitude.

const char * MAXIMUM_LATITUDE_PARAMETER_NAME = "MAXIMUM_LATITUDE" [static]

Name of the parameter specifying the image maximum latitude.

const char * MINIMUM_LONGITUDE_PARAMETER_NAME = "WESTERNMOST_LONGITUDE" [static]

Name of the parameter specifying the image minimum longitude.

const char * MAXIMUM_LONGITUDE_PARAMETER_NAME = "EASTERNMOST_LONGITUDE" [static]

Name of the parameter specifying the image maximum longitude.

const char * PROJECTION_ROTATION_PARAMETER_NAME = "MAP_PROJECTION_ROTATION" [static]

Name of the parameter specifying the projection rotation.

Referenced by PDS_Projection_Data::initialize_geo_transform().

A Projection_Definition is provided for each known Projection_Type.

Referenced by PDS_Projection_Data::initialize_spatial_reference().

const double DEFAULT_GEO_TIFF_TRANSFORM [static]
Initial value:
        {0.0, 1.0, 0.0, 0.0, 0.0, 1.0}

The default identity affine transformation matrix.

See also:
geo_transform()

Referenced by PDS_Projection_Data::initialize_geo_transform(), and PDS_Projection_Data::PDS_Projection_Data().

const unsigned char GEO_TIFF_UUID [static]
Initial value:
        {
        0xb1, 0x4b, 0xf8, 0xbd, 0x08, 0x3d, 0x4b, 0x43,
        0xa5, 0xae, 0x8c, 0xd7, 0xd5, 0xa6, 0xce, 0x03
        }

UUID for the GeoTIFF JP2_Box.

Referenced by PDS_Projection_Data::JP2_GeoTIFF().

std::string Projection_Name [protected]

The projection name specified in the PDS label.

See also:
projection_name()

Referenced by PDS_Projection_Data::initialize_spatial_reference(), and PDS_Projection_Data::projection_name().

The projection type matching the projection name.

See also:
projection_type()

Referenced by PDS_Projection_Data::initialize_spatial_reference(), and PDS_Projection_Data::projection_type().

OGRSpatialReference* Spatial_Reference [protected]
double Geo_Transform[6] [protected]

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