|
| | 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_Data & | parameters (const std::string &pathname) |
| | Set the PDS parameters from a source file.
|
| virtual PDS_Data & | parameters (const idaeim::PVL::Aggregate ¶meters) |
| | 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_Data & | initialize_geo_transform () |
| | Initialized the geo-transform array values from the PDS parameter values.
|
| PDS_Projection_Data & | initialize_spatial_reference () |
| | Initialize the spatial reference information of a new OGRSpatialReference object.
|
| JP2_Box * | JP2_GeoTIFF () const |
| | Get a JP2_Box with GeoTIFF data content.
|
| JP2_Box * | JP2_GML (unsigned int image_width=0, unsigned int image_height=0) const |
| | Get a JP2_Box with GML data content.
|
| | PDS_Data () |
| | Construct PDS_Data with no parameters.
|
| | PDS_Data (const idaeim::PVL::Aggregate ¶meters) |
| | Construct PDS_Data from a PVL Parameter Aggregate.
|
| | PDS_Data (const idaeim::PVL::Aggregate ¶meters, const std::string &detached) |
| | Construct PDS_Data from a PVL Parameter Aggregate.
|
| | PDS_Data (const std::string &pathname) |
| | Construct PDS_Data from a named file.
|
| 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.
|
| 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.
|
| 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.
|
| 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.
|
| double | numeric_value (const std::string &pathname, bool case_sensitive=false, int skip=0) const |
| | Get the numeric value of a named parameter.
|
| std::string | string_value (const std::string &pathname, bool case_sensitive=false, int skip=0) const |
| | Get the string value of a named parameter.
|
| 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 () |
| 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 () |
| 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 () |
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.13
| 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):
-
-(Sx * Ox * cos (A)) - (Sx * Oy * sin (A))
-
Sx * cos (A)
-
Sx * sin (A)
-
(Sy * Ox * sin (A)) - (Sy * Oy * cos (A))
-
Sy * -sin (A)
-
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:
-
-Sx * Ox
-
Sx
-
0
-
-Sy * Oy
-
0
-
Sy
<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.
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.
<b>N.B.</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.
<b>Warning</b>: 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.
@return This PDS_Projection_Data object.
@throws 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).
@throws idaeim::PVL_Invalid_Value If any of the required PDS
parameters is not an assignment of a single numeric value.
@see geo_transform()
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
{@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.