OGRSpatialReference Class Reference

#include <ogr_spatialref.h>

List of all members.

Public Member Functions

 OGRSpatialReference (const char *=NULL)
virtual ~OGRSpatialReference ()
int Reference ()
int Dereference ()
int GetReferenceCount () const
void Release ()
OGRSpatialReferenceClone () const
OGRErr exportToWkt (char **) const
OGRErr exportToProj4 (char **) const
OGRErr exportToPCI (char **, char **, double **) const
OGRErr exportToUSGS (long *, long *, double **, long *) const
OGRErr exportToPanorama (long *, long *, long *, long *, double *) const
OGRErr exportToERM (char *pszProj, char *pszDatum, char *pszUnits)
OGRErr importFromWkt (char **)
OGRErr importFromProj4 (const char *)
OGRErr importFromEPSG (int)
OGRErr importFromESRI (char **)
OGRErr importFromPCI (const char *, const char *=NULL, double *=NULL)
OGRErr importFromUSGS (long, long, double *, long)
OGRErr importFromPanorama (long, long, long, double *)
OGRErr importFromDict (const char *pszDict, const char *pszCode)
OGRErr importFromURN (const char *)
OGRErr importFromERM (const char *pszProj, const char *pszDatum, const char *pszUnits)
OGRErr importFromUrl (const char *)
OGRErr morphToESRI ()
OGRErr morphFromESRI ()
OGRErr Validate ()
OGRErr StripCTParms (OGR_SRSNode *=NULL)
OGRErr FixupOrdering ()
OGRErr Fixup ()
void SetRoot (OGR_SRSNode *)
OGR_SRSNodeGetAttrNode (const char *)
const char * GetAttrValue (const char *, int=0) const
OGRErr SetNode (const char *, const char *)
OGRErr SetLinearUnitsAndUpdateParameters (const char *pszName, double dfInMeters)
OGRErr SetLinearUnits (const char *pszName, double dfInMeters)
double GetLinearUnits (char **=NULL) const
OGRErr SetAngularUnits (const char *pszName, double dfInRadians)
double GetAngularUnits (char **=NULL) const
double GetPrimeMeridian (char **=NULL) const
int IsGeographic () const
int IsProjected () const
int IsLocal () const
int IsSameGeogCS (const OGRSpatialReference *) const
int IsSame (const OGRSpatialReference *) const
void Clear ()
OGRErr SetLocalCS (const char *)
OGRErr SetProjCS (const char *)
OGRErr SetProjection (const char *)
OGRErr SetGeogCS (const char *pszGeogName, const char *pszDatumName, const char *pszEllipsoidName, double dfSemiMajor, double dfInvFlattening, const char *pszPMName=NULL, double dfPMOffset=0.0, const char *pszUnits=NULL, double dfConvertToRadians=0.0)
OGRErr SetWellKnownGeogCS (const char *)
OGRErr CopyGeogCSFrom (const OGRSpatialReference *poSrcSRS)
OGRErr SetFromUserInput (const char *)
OGRErr SetTOWGS84 (double, double, double, double=0.0, double=0.0, double=0.0, double=0.0)
OGRErr GetTOWGS84 (double *padfCoef, int nCoeff=7) const
double GetSemiMajor (OGRErr *=NULL) const
double GetSemiMinor (OGRErr *=NULL) const
double GetInvFlattening (OGRErr *=NULL) const
OGRErr SetAuthority (const char *pszTargetKey, const char *pszAuthority, int nCode)
OGRErr AutoIdentifyEPSG ()
const char * GetAuthorityCode (const char *pszTargetKey) const
const char * GetAuthorityName (const char *pszTargetKey) const
const char * GetExtension (const char *pszTargetKey, const char *pszName, const char *pszDefault=NULL) const
OGRErr SetProjParm (const char *, double)
double GetProjParm (const char *, double=0.0, OGRErr *=NULL) const
OGRErr SetNormProjParm (const char *, double)
double GetNormProjParm (const char *, double=0.0, OGRErr *=NULL) const
OGRErr SetACEA (double dfStdP1, double dfStdP2, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetAE (double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetBonne (double dfStdP1, double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetCEA (double dfStdP1, double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetCS (double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetEC (double dfStdP1, double dfStdP2, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetEckert (int nVariation, double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetEquirectangular (double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetGEOS (double dfCentralMeridian, double dfSatelliteHeight, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetGH (double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetGS (double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetGnomonic (double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetHOM (double dfCenterLat, double dfCenterLong, double dfAzimuth, double dfRectToSkew, double dfScale, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetHOM2PNO (double dfCenterLat, double dfLat1, double dfLong1, double dfLat2, double dfLong2, double dfScale, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetKrovak (double dfCenterLat, double dfCenterLong, double dfAzimuth, double dfPseudoStdParallelLat, double dfScale, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetLAEA (double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetLCC (double dfStdP1, double dfStdP2, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetLCC1SP (double dfCenterLat, double dfCenterLong, double dfScale, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetLCCB (double dfStdP1, double dfStdP2, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetMC (double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetMercator (double dfCenterLat, double dfCenterLong, double dfScale, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetMollweide (double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetNZMG (double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetOS (double dfOriginLat, double dfCMeridian, double dfScale, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetOrthographic (double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetPolyconic (double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetPS (double dfCenterLat, double dfCenterLong, double dfScale, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetRobinson (double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetSinusoidal (double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetStereographic (double dfCenterLat, double dfCenterLong, double dfScale, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetSOC (double dfLatitudeOfOrigin, double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetTM (double dfCenterLat, double dfCenterLong, double dfScale, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetTMVariant (const char *pszVariantName, double dfCenterLat, double dfCenterLong, double dfScale, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetTMG (double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetTMSO (double dfCenterLat, double dfCenterLong, double dfScale, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetTPED (double dfLat1, double dfLong1, double dfLat2, double dfLong2, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetVDG (double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)
OGRErr SetUTM (int nZone, int bNorth=TRUE)
int GetUTMZone (int *pbNorth=NULL) const
OGRErr SetStatePlane (int nZone, int bNAD83=TRUE, const char *pszOverrideUnitName=NULL, double dfOverrideUnit=0.0)


Detailed Description

This class respresents a OpenGIS Spatial Reference System, and contains methods for converting between this object organization and well known text (WKT) format. This object is reference counted as one instance of the object is normally shared between many OGRGeometry objects.

Normally application code can fetch needed parameter values for this SRS using GetAttrValue(), but in special cases the underlying parse tree (or OGR_SRSNode objects) can be accessed more directly.

See the tutorial for more information on how to use this class.


Constructor & Destructor Documentation

OGRSpatialReference::OGRSpatialReference ( const char *  pszWKT = NULL  ) 

Constructor.

This constructor takes an optional string argument which if passed should be a WKT representation of an SRS. Passing this is equivelent to not passing it, and then calling importFromWkt() with the WKT string.

Note that newly created objects are given a reference count of one.

The C function OSRNewSpatialReference() does the same thing as this constructor.

Parameters:
pszWKT well known text definition to which the object should be initialized, or NULL (the default).

References importFromWkt().

OGRSpatialReference::~OGRSpatialReference (  )  [virtual]

OGRSpatialReference destructor.

The C function OSRDestroySpatialReference() does the same thing as this method.


Member Function Documentation

OGRErr OGRSpatialReference::AutoIdentifyEPSG (  ) 

Set EPSG authority info if possible.

This method inspects a WKT definition, and adds EPSG authority nodes where an aspect of the coordinate system can be easily and safely corresponded with an EPSG identifier. In practice, this method will evolve over time. In theory it can add authority nodes for any object (ie. spheroid, datum, GEOGCS, units, and PROJCS) that could have an authority node. Mostly this is useful to inserting appropriate PROJCS codes for common formulations (like UTM n WGS84).

If it success the OGRSpatialReference is updated in place, and the method return OGRERR_NONE. If the method fails to identify the general coordinate system OGRERR_UNSUPPORTED_SRS is returned but no error message is posted via CPLError().

This method is the same as the C function OSRAutoIdentifyEPSG().

Returns:
OGRERR_NONE or OGRERR_UNSUPPORTED_SRS.

References GetAuthorityCode(), GetAuthorityName(), GetUTMZone(), IsGeographic(), IsProjected(), and SetAuthority().

void OGRSpatialReference::Clear (  ) 

Wipe current definition.

Returns OGRSpatialReference to a state with no definition, as it exists when first created. It does not affect reference counts.

Referenced by CopyGeogCSFrom(), importFromERM(), SetFromUserInput(), SetGeogCS(), and SetStatePlane().

OGRSpatialReference * OGRSpatialReference::Clone (  )  const

Make a duplicate of this OGRSpatialReference.

This method is the same as the C function OSRClone().

Returns:
a new SRS, which becomes the responsibility of the caller.

References OGR_SRSNode::Clone(), and poRoot.

OGRErr OGRSpatialReference::CopyGeogCSFrom ( const OGRSpatialReference poSrcSRS  ) 

Copy GEOGCS from another OGRSpatialReference.

The GEOGCS information is copied into this OGRSpatialReference from another. If this object has a PROJCS root already, the GEOGCS is installed within it, otherwise it is installed as the root.

Parameters:
poSrcSRS the spatial reference to copy the GEOGCS information from.
Returns:
OGRERR_NONE on success or an error code.

References Clear(), OGR_SRSNode::Clone(), OGR_SRSNode::DestroyChild(), OGR_SRSNode::FindChild(), GetAttrNode(), OGR_SRSNode::InsertChild(), and SetRoot().

Referenced by importFromERM(), importFromESRI(), importFromPanorama(), importFromPCI(), importFromProj4(), and SetWellKnownGeogCS().

int OGRSpatialReference::Dereference (  ) 

Decrements the reference count by one.

The method does the same thing as the C function OSRDereference().

Returns:
the updated reference count.

Referenced by Release().

OGRErr OGRSpatialReference::exportToERM ( char *  pszProj,
char *  pszDatum,
char *  pszUnits 
)

Convert coordinate system to ERMapper format.

Parameters:
pszProj 32 character buffer to receive projection name.
pszDatum 32 character buffer to recieve datum name.
pszUnits 32 character buffer to receive units name.
Returns:
OGRERR_NONE on success, OGRERR_SRS_UNSUPPORTED if not translation is found, or OGRERR_FAILURE on other failures.

References GetAttrValue(), GetAuthorityCode(), GetAuthorityName(), GetLinearUnits(), GetUTMZone(), importFromDict(), IsGeographic(), and IsProjected().

OGRErr OGRSpatialReference::exportToPanorama ( long *  piProjSys,
long *  piDatum,
long *  piEllips,
long *  piZone,
double *  padfPrjParams 
) const

Export coordinate system in "Panorama" GIS projection definition.

This method is the equivalent of the C function OSRExportToPanorama().

Parameters:
piProjSys Pointer to variable, where the projection system code will be returned.
piDatum Pointer to variable, where the coordinate system code will be returned.
piEllips Pointer to variable, where the spheroid code will be returned.
piZone Pointer to variable, where the zone for PAN_PROJ_UTM projection system will be returned.
padfPrjParams an existing 7 double buffer into which the projection parameters will be placed. See importFromPanorama() for the list of parameters.
Returns:
OGRERR_NONE on success or an error code on failure.

References GetAttrValue(), GetInvFlattening(), GetNormProjParm(), GetSemiMajor(), GetUTMZone(), and IsLocal().

OGRErr OGRSpatialReference::exportToPCI ( char **  ppszProj,
char **  ppszUnits,
double **  ppadfPrjParams 
) const

Export coordinate system in PCI projection definition.

Converts the loaded coordinate reference system into PCI projection definition to the extent possible. The strings returned in ppszProj, ppszUnits and ppadfPrjParams array should be deallocated by the caller with CPLFree() when no longer needed.

LOCAL_CS coordinate systems are not translatable. An empty string will be returned along with OGRERR_NONE.

This method is the equivelent of the C function OSRExportToPCI().

Parameters:
ppszProj pointer to which dynamically allocated PCI projection definition will be assigned.
ppszUnits pointer to which dynamically allocated units definition will be assigned.
ppadfPrjParams pointer to which dynamically allocated array of 17 projection parameters will be assigned. See importFromPCI() for the list of parameters.
Returns:
OGRERR_NONE on success or an error code on failure.

References GetAttrNode(), GetAttrValue(), OGR_SRSNode::GetChild(), OGR_SRSNode::GetChildCount(), GetInvFlattening(), GetLinearUnits(), GetNormProjParm(), GetSemiMajor(), GetUTMZone(), OGR_SRSNode::GetValue(), and IsLocal().

OGRErr OGRSpatialReference::exportToProj4 ( char **  ppszProj4  )  const

Export coordinate system in PROJ.4 format.

Converts the loaded coordinate reference system into PROJ.4 format to the extent possible. The string returned in ppszProj4 should be deallocated by the caller with CPLFree() when no longer needed.

LOCAL_CS coordinate systems are not translatable. An empty string will be returned along with OGRERR_NONE.

This method is the equivelent of the C function OSRExportToProj4().

Parameters:
ppszProj4 pointer to which dynamically allocated PROJ.4 definition will be assigned.
Returns:
OGRERR_NONE on success or an error code on failure.

References CPLAtof(), GetAttrNode(), GetAttrValue(), GetAuthorityCode(), GetAuthorityName(), OGR_SRSNode::GetChild(), OGR_SRSNode::GetChildCount(), GetExtension(), GetInvFlattening(), GetLinearUnits(), GetNormProjParm(), GetSemiMajor(), GetSemiMinor(), GetUTMZone(), OGR_SRSNode::GetValue(), and IsGeographic().

OGRErr OGRSpatialReference::exportToUSGS ( long *  piProjSys,
long *  piZone,
double **  ppadfPrjParams,
long *  piDatum 
) const

Export coordinate system in USGS GCTP projection definition.

This method is the equivalent of the C function OSRExportToUSGS().

Parameters:
piProjSys Pointer to variable, where the projection system code will be returned.
piZone Pointer to variable, where the zone for UTM and State Plane projection systems will be returned.
ppadfPrjParams Pointer to which dynamically allocated array of 15 projection parameters will be assigned. See importFromUSGS() for the list of parameters. Caller responsible to free this array.
Returns:
OGRERR_NONE on success or an error code on failure.

References GetAttrValue(), GetInvFlattening(), GetNormProjParm(), GetSemiMajor(), GetUTMZone(), and IsLocal().

OGRErr OGRSpatialReference::exportToWkt ( char **  ppszResult  )  const

Convert this SRS into WKT format.

Note that the returned WKT string should be freed with OGRFree() or CPLFree() when no longer needed. It is the responsibility of the caller.

This method is the same as the C function OSRExportToWkt().

Parameters:
ppszResult the resulting string is returned in this pointer.
Returns:
currently OGRERR_NONE is always returned, but the future it is possible error conditions will develop.

References OGR_SRSNode::exportToWkt().

OGRErr OGRSpatialReference::Fixup (  ) 

Fixup as needed.

Some mechanisms to create WKT using OGRSpatialReference, and some imported WKT, are not valid according to the OGC CT specification. This method attempts to fill in any missing defaults that are required, and fixup ordering problems (using OSRFixupOrdering()) so that the resulting WKT is valid.

This method should be expected to evolve over time to as problems are discovered. The following are amoung the fixup actions this method will take:

  • Fixup the ordering of nodes to match the BNF WKT ordering, using the FixupOrdering() method.

  • Add missing linear or angular units nodes.

This method is the same as the C function OSRFixup().

Returns:
OGRERR_NONE on success or an error code if something goes wrong.

References CPLAtof(), OGR_SRSNode::FindChild(), FixupOrdering(), GetAttrNode(), SetAngularUnits(), and SetLinearUnits().

Referenced by morphToESRI().

OGRErr OGRSpatialReference::FixupOrdering (  ) 

Correct parameter ordering to match CT Specification.

Some mechanisms to create WKT using OGRSpatialReference, and some imported WKT fail to maintain the order of parameters required according to the BNF definitions in the OpenGIS SF-SQL and CT Specifications. This method attempts to massage things back into the required order.

This method is the same as the C function OSRFixupOrdering().

Returns:
OGRERR_NONE on success or an error code if something goes wrong.

References OGR_SRSNode::FixupOrdering().

Referenced by Fixup(), importFromEPSG(), importFromPanorama(), importFromPCI(), importFromUSGS(), and morphFromESRI().

double OGRSpatialReference::GetAngularUnits ( char **  ppszName = NULL  )  const

Fetch angular geographic coordinate system units.

If no units are available, a value of "degree" and SRS_UA_DEGREE_CONV will be assumed. This method only checks directly under the GEOGCS node for units.

This method does the same thing as the C function OSRGetAngularUnits().

Parameters:
ppszName a pointer to be updated with the pointer to the units name. The returned value remains internal to the OGRSpatialReference and shouldn't be freed, or modified. It may be invalidated on the next OGRSpatialReference call.
Returns:
the value to multiply by angular distances to transform them to radians.

References CPLAtof(), GetAttrNode(), OGR_SRSNode::GetChild(), OGR_SRSNode::GetChildCount(), and OGR_SRSNode::GetValue().

Referenced by morphToESRI().

OGR_SRSNode * OGRSpatialReference::GetAttrNode ( const char *  pszNodePath  ) 

Find named node in tree.

This method does a pre-order traversal of the node tree searching for a node with this exact value (case insensitive), and returns it. Leaf nodes are not considered, under the assumption that they are just attribute value nodes.

If a node appears more than once in the tree (such as UNIT for instance), the first encountered will be returned. Use GetNode() on a subtree to be more specific.

Parameters:
pszNodePath the name of the node to search for. May contain multiple components such as "GEOGCS|UNITS".
Returns:
a pointer to the node found, or NULL if none.

References OGR_SRSNode::GetNode().

Referenced by CopyGeogCSFrom(), exportToPCI(), exportToProj4(), Fixup(), GetAngularUnits(), GetAttrValue(), GetInvFlattening(), GetLinearUnits(), GetPrimeMeridian(), GetProjParm(), GetSemiMajor(), GetTOWGS84(), importFromESRI(), importFromProj4(), IsSame(), morphFromESRI(), morphToESRI(), SetAngularUnits(), SetAuthority(), SetGeogCS(), SetLinearUnits(), SetLinearUnitsAndUpdateParameters(), SetLocalCS(), SetProjCS(), SetProjection(), SetProjParm(), SetStatePlane(), and SetTOWGS84().

const char * OGRSpatialReference::GetAttrValue ( const char *  pszNodeName,
int  iAttr = 0 
) const

Fetch indicated attribute of named node.

This method uses GetAttrNode() to find the named node, and then extracts the value of the indicated child. Thus a call to GetAttrValue("UNIT",1) would return the second child of the UNIT node, which is normally the length of the linear unit in meters.

This method does the same thing as the C function OSRGetAttrValue().

Parameters:
pszNodeName the tree node to look for (case insensitive).
iAttr the child of the node to fetch (zero based).
Returns:
the requested value, or NULL if it fails for any reason.

References GetAttrNode(), OGR_SRSNode::GetChild(), OGR_SRSNode::GetChildCount(), and OGR_SRSNode::GetValue().

Referenced by exportToERM(), exportToPanorama(), exportToPCI(), exportToProj4(), exportToUSGS(), GetUTMZone(), IsSame(), IsSameGeogCS(), morphFromESRI(), morphToESRI(), and SetUTM().

const char * OGRSpatialReference::GetAuthorityCode ( const char *  pszTargetKey  )  const

Get the authority code for a node.

This method is used to query an AUTHORITY[] node from within the WKT tree, and fetch the code value.

While in theory values may be non-numeric, for the EPSG authority all code values should be integral.

This method is the same as the C function OSRGetAuthorityCode().

Parameters:
pszTargetKey the partial or complete path to the node to get an authority from. ie. "PROJCS", "GEOGCS", "GEOGCS|UNIT" or NULL to search for an authority node on the root element.
Returns:
value code from authority node, or NULL on failure. The value returned is internal and should not be freed or modified.

References OGR_SRSNode::FindChild(), OGR_SRSNode::GetChild(), OGR_SRSNode::GetChildCount(), and OGR_SRSNode::GetValue().

Referenced by AutoIdentifyEPSG(), exportToERM(), exportToProj4(), and morphToESRI().

const char * OGRSpatialReference::GetAuthorityName ( const char *  pszTargetKey  )  const

Get the authority name for a node.

This method is used to query an AUTHORITY[] node from within the WKT tree, and fetch the authority name value.

The most common authority is "EPSG".

This method is the same as the C function OSRGetAuthorityName().

Parameters:
pszTargetKey the partial or complete path to the node to get an authority from. ie. "PROJCS", "GEOGCS", "GEOGCS|UNIT" or NULL to search for an authority node on the root element.
Returns:
value code from authority node, or NULL on failure. The value returned is internal and should not be freed or modified.

References OGR_SRSNode::FindChild(), OGR_SRSNode::GetChild(), OGR_SRSNode::GetChildCount(), and OGR_SRSNode::GetValue().

Referenced by AutoIdentifyEPSG(), exportToERM(), exportToProj4(), importFromEPSG(), and morphToESRI().

const char * OGRSpatialReference::GetExtension ( const char *  pszTargetKey,
const char *  pszName,
const char *  pszDefault = NULL 
) const

Fetch extension value.

Fetch the value of the named EXTENSION item for the identified target node.

Parameters:
pszTargetKey the name or path to the parent node of the EXTENSION.
pszName the name of the extension being fetched.
pszDefault the value to return if the extension is not found.
Returns:
node value if successful or pszDefault on failure.

References OGR_SRSNode::GetChild(), OGR_SRSNode::GetChildCount(), and OGR_SRSNode::GetValue().

Referenced by exportToProj4().

double OGRSpatialReference::GetInvFlattening ( OGRErr *  pnErr = NULL  )  const

Get spheroid inverse flattening.

This method does the same thing as the C function OSRGetInvFlattening().

Parameters:
pnErr if non-NULL set to OGRERR_FAILURE if no inverse flattening can be found.
Returns:
inverse flattening, or SRS_WGS84_INVFLATTENING if it can't be found.

References CPLAtof(), GetAttrNode(), OGR_SRSNode::GetChild(), OGR_SRSNode::GetChildCount(), and OGR_SRSNode::GetValue().

Referenced by exportToPanorama(), exportToPCI(), exportToProj4(), exportToUSGS(), and GetSemiMinor().

double OGRSpatialReference::GetLinearUnits ( char **  ppszName = NULL  )  const

Fetch linear projection units.

If no units are available, a value of "Meters" and 1.0 will be assumed. This method only checks directly under the PROJCS or LOCAL_CS node for units.

This method does the same thing as the C function OSRGetLinearUnits()/

Parameters:
ppszName a pointer to be updated with the pointer to the units name. The returned value remains internal to the OGRSpatialReference and shouldn't be freed, or modified. It may be invalidated on the next OGRSpatialReference call.
Returns:
the value to multiply by linear distances to transform them to meters.

References CPLAtof(), GetAttrNode(), OGR_SRSNode::GetChild(), OGR_SRSNode::GetChildCount(), and OGR_SRSNode::GetValue().

Referenced by exportToERM(), exportToPCI(), exportToProj4(), importFromESRI(), importFromProj4(), IsSame(), morphToESRI(), SetLinearUnitsAndUpdateParameters(), and SetStatePlane().

double OGRSpatialReference::GetNormProjParm ( const char *  pszName,
double  dfDefaultValue = 0.0,
OGRErr *  pnErr = NULL 
) const

Fetch a normalized projection parameter value.

This method is the same as GetProjParm() except that the value of the parameter is "normalized" into degrees or meters depending on whether it is linear or angular.

This method is the same as the C function OSRGetNormProjParm().

Parameters:
pszName the name of the parameter to fetch, from the set of SRS_PP codes in ogr_srs_api.h.
dfDefaultValue the value to return if this parameter doesn't exist.
pnErr place to put error code on failure. Ignored if NULL.
Returns:
value of parameter.

References GetProjParm().

Referenced by exportToPanorama(), exportToPCI(), exportToProj4(), exportToUSGS(), GetUTMZone(), and SetStatePlane().

double OGRSpatialReference::GetPrimeMeridian ( char **  ppszName = NULL  )  const

Fetch prime meridian info.

Returns the offset of the prime meridian from greenwich in degrees, and the prime meridian name (if requested). If no PRIMEM value exists in the coordinate system definition a value of "Greenwich" and an offset of 0.0 is assumed.

If the prime meridian name is returned, the pointer is to an internal copy of the name. It should not be freed, altered or depended on after the next OGR call.

This method is the same as the C function OSRGetPrimeMeridian().

Parameters:
ppszName return location for prime meridian name. If NULL, name is not returned.
Returns:
the offset to the GEOGCS prime meridian from greenwich in decimal degrees.

References CPLAtof(), GetAttrNode(), OGR_SRSNode::GetChild(), OGR_SRSNode::GetChildCount(), and OGR_SRSNode::GetValue().

double OGRSpatialReference::GetProjParm ( const char *  pszName,
double  dfDefaultValue = 0.0,
OGRErr *  pnErr = NULL 
) const

Fetch a projection parameter value.

NOTE: This code should be modified to translate non degree angles into degrees based on the GEOGCS unit. This has not yet been done.

This method is the same as the C function OSRGetProjParm().

Parameters:
pszName the name of the parameter to fetch, from the set of SRS_PP codes in ogr_srs_api.h.
dfDefaultValue the value to return if this parameter doesn't exist.
pnErr place to put error code on failure. Ignored if NULL.
Returns:
value of parameter.

References CPLAtof(), GetAttrNode(), OGR_SRSNode::GetChild(), OGR_SRSNode::GetChildCount(), and OGR_SRSNode::GetValue().

Referenced by GetNormProjParm(), GetUTMZone(), importFromProj4(), IsSame(), morphFromESRI(), morphToESRI(), and SetLinearUnitsAndUpdateParameters().

int OGRSpatialReference::GetReferenceCount (  )  const [inline]

Fetch current reference count.

Returns:
the current reference count.

double OGRSpatialReference::GetSemiMajor ( OGRErr *  pnErr = NULL  )  const

Get spheroid semi major axis.

This method does the same thing as the C function OSRGetSemiMajor().

Parameters:
pnErr if non-NULL set to OGRERR_FAILURE if semi major axis can be found.
Returns:
semi-major axis, or SRS_WGS84_SEMIMAJOR if it can't be found.

References CPLAtof(), GetAttrNode(), OGR_SRSNode::GetChild(), OGR_SRSNode::GetChildCount(), and OGR_SRSNode::GetValue().

Referenced by exportToPanorama(), exportToPCI(), exportToProj4(), exportToUSGS(), and GetSemiMinor().

double OGRSpatialReference::GetSemiMinor ( OGRErr *  pnErr = NULL  )  const

Get spheroid semi minor axis.

This method does the same thing as the C function OSRGetSemiMinor().

Parameters:
pnErr if non-NULL set to OGRERR_FAILURE if semi minor axis can be found.
Returns:
semi-minor axis, or WGS84 semi minor if it can't be found.

References GetInvFlattening(), and GetSemiMajor().

Referenced by exportToProj4().

OGRErr OGRSpatialReference::GetTOWGS84 ( double *  padfCoeff,
int  nCoeffCount = 7 
) const

Fetch TOWGS84 parameters, if available.

Parameters:
padfCoeff array into which up to 7 coefficients are placed.
nCoeffCount size of padfCoeff - defaults to 7.
Returns:
OGRERR_NONE on success, or OGRERR_FAILURE if there is no TOWGS84 node available.

References CPLAtof(), GetAttrNode(), OGR_SRSNode::GetChild(), OGR_SRSNode::GetChildCount(), and OGR_SRSNode::GetValue().

int OGRSpatialReference::GetUTMZone ( int *  pbNorth = NULL  )  const

Get utm zone information.

This is the same as the C function OSRGetUTMZone().

Parameters:
pbNorth pointer to in to set to TRUE if northern hemisphere, or FALSE if southern.
Returns:
UTM zone number or zero if this isn't a UTM definition.

References GetAttrValue(), GetNormProjParm(), and GetProjParm().

Referenced by AutoIdentifyEPSG(), exportToERM(), exportToPanorama(), exportToPCI(), exportToProj4(), exportToUSGS(), and morphToESRI().

OGRErr OGRSpatialReference::importFromDict ( const char *  pszDictFile,
const char *  pszCode 
)

Read SRS from WKT dictionary.

This method will attempt to find the indicated coordinate system identity in the indicated dictionary file. If found, the WKT representation is imported and used to initialize this OGRSpatialReference.

More complete information on the format of the dictionary files can be found in the epsg.wkt file in the GDAL data tree. The dictionary files are searched for in the "GDAL" domain using CPLFindFile(). Normally this results in searching /usr/local/share/gdal or somewhere similar.

This method is the same as the C function OSRImportFromDict().

Parameters:
pszDictFile the name of the dictionary file to load.
pszCode the code to lookup in the dictionary.
Returns:
OGRERR_NONE on success, or OGRERR_SRS_UNSUPPORTED if the code isn't found, and OGRERR_SRS_FAILURE if something more dramatic goes wrong.

References importFromWkt().

Referenced by exportToERM(), importFromEPSG(), importFromERM(), and SetFromUserInput().

OGRErr OGRSpatialReference::importFromEPSG ( int  nCode  ) 

Initialize SRS based on EPSG GCS or PCS code.

This code uses the GeoTIFF cpl_csv services to access the EPSG CSV data. If frmts/gtiff/libgeotiff isn't linked in, linking will fail. If EPSG tables can't be found at runtime, the method will fail.

This method is the same as the C function OSRImportFromEPSG().

Parameters:
nCode a GCS or PCS code from the horizontal coordinate system table.
Returns:
OGRERR_NONE on success, or an error code on failure.

References FixupOrdering(), GetAuthorityName(), importFromDict(), importFromProj4(), IsGeographic(), IsProjected(), and SetAuthority().

Referenced by importFromESRI(), importFromPanorama(), importFromPCI(), importFromProj4(), importFromURN(), SetFromUserInput(), SetStatePlane(), and SetWellKnownGeogCS().

OGRErr OGRSpatialReference::importFromERM ( const char *  pszProj,
const char *  pszDatum,
const char *  pszUnits 
)

OGR WKT from ERMapper projection definitions.

Generates an OGRSpatialReference definition from an ERMapper datum and projection name. Based on the ecw_cs.wkt dictionary file from gdal/data.

Parameters:
pszProj the projection name, such as "NUTM11" or "GEOGRAPHIC".
pszDatum the datum name, such as "NAD83".
pszUnits the linear units "FEET" or "METERS".
Returns:
OGRERR_NONE on success or OGRERR_UNSUPPORTED_SRS if not found.

References Clear(), CopyGeogCSFrom(), importFromDict(), IsLocal(), and SetLinearUnits().

OGRErr OGRSpatialReference::importFromESRI ( char **  papszPrj  ) 

Import coordinate system from ESRI .prj format(s).

This function will read the text loaded from an ESRI .prj file, and translate it into an OGRSpatialReference definition. This should support many (but by no means all) old style (Arc/Info 7.x) .prj files, as well as the newer pseudo-OGC WKT .prj files. Note that new style .prj files are in OGC WKT format, but require some manipulation to correct datum names, and units on some projection parameters. This is addressed within importFromESRI() by an automatical call to morphFromESRI().

Currently only GEOGRAPHIC, UTM, STATEPLANE, GREATBRITIAN_GRID, ALBERS, EQUIDISTANT_CONIC, and TRANSVERSE (mercator) projections are supported from old style files.

At this time there is no equivelent exportToESRI() method. Writing old style .prj files is not supported by OGRSpatialReference. However the morphToESRI() and exportToWkt() methods can be used to generate output suitable to write to new style (Arc 8) .prj files.

This function is the equilvelent of the C function OSRImportFromESRI().

Parameters:
papszPrj NULL terminated list of strings containing the definition.
Returns:
OGRERR_NONE on success or an error code in case of failure.

References CopyGeogCSFrom(), OGR_SRSNode::DestroyChild(), GetAttrNode(), GetLinearUnits(), importFromEPSG(), importFromWkt(), IsLocal(), IsProjected(), morphFromESRI(), SetACEA(), SetEC(), SetLCC(), SetLinearUnitsAndUpdateParameters(), SetLocalCS(), SetPS(), SetStatePlane(), SetTM(), SetUTM(), and SetWellKnownGeogCS().

OGRErr OGRSpatialReference::importFromPanorama ( long  iProjSys,
long  iDatum,
long  iEllips,
double *  padfPrjParams 
)

Import coordinate system from "Panorama" GIS projection definition.

This method will import projection definition in style, used by "Panorama" GIS.

This function is the equivalent of the C function OSRImportFromPanorama().

Parameters:
iProjSys Input projection system code, used in GIS "Panorama".

Supported Projections

      1:  Gauss-Kruger (Transverse Mercator)
      4:  Lambert Azimuthal Equal Area
      5:  Stereographic
      6:  Azimuthal Equidistant (Postel)
      8:  Mercator
      11: Polyconic
      13: Polar Stereographic
      15: Gnomonic
      17: Universal Transverse Mercator (PAN_PROJ_UTM)
      19: Mollweide
      20: Equidistant Conic
 

Parameters:
iDatum Input coordinate system.

Supported Datums

       1: Pulkovo, 1942
       2: WGS, 1984
 

Parameters:
iEllips Input spheroid.

Supported Spheroids

       1: Krassovsky, 1940
       2: WGS, 1972
       3: International, 1924 (Hayford, 1909)
       4: Clarke, 1880
       5: Clarke, 1866 (NAD1927)
       6: Everest, 1830
       7: Bessel, 1841
       8: Airy, 1830
       9: WGS, 1984 (GPS)
 

Parameters:
padfPrjParams Array of 7 coordinate system parameters:
      [0]  Latitude of the first standard parallel (radians)
      [1]  Latitude of the second standard parallel (radians)
      [2]  Latitude of center of projection (radians)
      [3]  Longitude of center of projection (radians)
      [4]  Scaling factor
      [5]  False Easting
      [6]  False Northing
 

Particular projection uses different parameters, unused ones may be set to zero. If NULL supplied instead of array pointer default values will be used (i.e., zeroes).

Returns:
OGRERR_NONE on success or an error code in case of failure.

References CopyGeogCSFrom(), FixupOrdering(), importFromEPSG(), IsLocal(), IsProjected(), SetAE(), SetAuthority(), SetEC(), SetGeogCS(), SetGnomonic(), SetLAEA(), SetLCC(), SetLinearUnits(), SetLocalCS(), SetMercator(), SetMollweide(), SetPolyconic(), SetPS(), SetStereographic(), SetTM(), SetUTM(), and SetWellKnownGeogCS().

OGRErr OGRSpatialReference::importFromPCI ( const char *  pszProj,
const char *  pszUnits = NULL,
double *  padfPrjParams = NULL 
)

Import coordinate system from PCI projection definition.

PCI software uses 16-character string to specify coordinate system and datum/ellipsoid. You should supply at least this string to the importFromPCI() function.

This function is the equilvelent of the C function OSRImportFromPCI().

Parameters:
pszProj NULL terminated string containing the definition. Looks like "pppppppppppp Ennn" or "pppppppppppp Dnnn", where "pppppppppppp" is a projection code, "Ennn" is an ellipsoid code, "Dnnn" --- a datum code.
pszUnits Grid units code ("DEGREE" or "METRE"). If NULL "METRE" will be used.
padfPrjParams Array of 16 coordinate system parameters:
[0] Spheroid semi major axis [1] Spheroid semi minor axis [2] Reference Longitude [3] Reference Latitude [4] First Standard Parallel [5] Second Standard Parallel [6] False Easting [7] False Northing [8] Scale Factor [9] Height above sphere surface [10] Longitude of 1st point on center line [11] Latitude of 1st point on center line [12] Longitude of 2nd point on center line [13] Latitude of 2nd point on center line [14] Azimuth east of north for center line [15] Landsat satellite number [16] Landsat path number

Particular projection uses different parameters, unused ones may be set to zero. If NULL suppliet instead of array pointer default values will be used (i.e., zeroes).

Returns:
OGRERR_NONE on success or an error code in case of failure.

References CopyGeogCSFrom(), FixupOrdering(), importFromEPSG(), IsGeographic(), IsLocal(), IsProjected(), SetACEA(), SetAE(), SetAngularUnits(), SetAuthority(), SetEC(), SetEquirectangular(), SetGeogCS(), SetGnomonic(), SetLAEA(), SetLCC(), SetLinearUnits(), SetLocalCS(), SetMC(), SetMercator(), SetOrthographic(), SetPolyconic(), SetPS(), SetRobinson(), SetSinusoidal(), SetStatePlane(), SetStereographic(), SetTM(), SetUTM(), SetVDG(), and SetWellKnownGeogCS().

OGRErr OGRSpatialReference::importFromProj4 ( const char *  pszProj4  ) 

Import PROJ.4 coordinate string.

The OGRSpatialReference is initialized from the passed PROJ.4 style coordinate system string. In addition to many +proj formulations which have OGC equivelents, it is also possible to import "+init=epsg:n" style definitions. These are passed to importFromEPSG(). Other init strings (such as the state plane zones) are not currently supported.

Example: pszProj4 = "+proj=utm +zone=11 +datum=WGS84"

This method is the equivelent of the C function OSRImportFromProj4().

Parameters:
pszProj4 the PROJ.4 style string.
Returns:
OGRERR_NONE on success or OGRERR_CORRUPT_DATA on failure.

References CopyGeogCSFrom(), CPLAtof(), CPLAtofM(), GetAttrNode(), OGR_SRSNode::GetChild(), OGR_SRSNode::GetChildCount(), GetLinearUnits(), GetProjParm(), OGR_SRSNode::GetValue(), importFromEPSG(), IsLocal(), IsProjected(), SetACEA(), SetAE(), SetBonne(), SetCEA(), SetCS(), SetEC(), SetEquirectangular(), SetGeogCS(), SetGEOS(), SetGH(), SetGnomonic(), SetGS(), SetHOM(), SetKrovak(), SetLAEA(), SetLCC(), SetLCC1SP(), SetLinearUnits(), SetMC(), SetMercator(), SetMollweide(), SetNormProjParm(), SetNZMG(), SetOrthographic(), SetOS(), SetPolyconic(), SetPS(), SetRobinson(), SetSinusoidal(), SetStereographic(), SetTM(), SetTOWGS84(), SetTPED(), SetUTM(), SetVDG(), and SetWellKnownGeogCS().

Referenced by importFromEPSG(), and SetFromUserInput().

OGRErr OGRSpatialReference::importFromUrl ( const char *  pszUrl  ) 

Set spatial reference from a URL.

This method will download the spatial reference at a given URL and feed it into SetFromUserInput for you.

This method does the same thing as the OSRImportFromUrl() function.

Parameters:
pszDefinition text definition to try to deduce SRS from.
Returns:
OGRERR_NONE on success, or an error code with the curl error message if it is unable to dowload data.

References SetFromUserInput().

Referenced by SetFromUserInput().

OGRErr OGRSpatialReference::importFromURN ( const char *  pszURN  ) 

Initialize from OGC URN.

Initializes this spatial reference from a coordinate system defined by an OGC URN prefixed with "urn:ogc:def:crs:" per recommendation paper 06-023r1. Currently EPSG and OGC authority values are supported, including OGC auto codes, but not including CRS1 or CRS88 (NAVD88).

This method is also support through SetFromUserInput() which can normally be used for URNs.

Parameters:
pszURN the urn string.
Returns:
OGRERR_NONE on success or an error code.

References importFromEPSG(), and SetWellKnownGeogCS().

Referenced by SetFromUserInput().

OGRErr OGRSpatialReference::importFromUSGS ( long  iProjSys,
long  iZone,
double *  padfPrjParams,
long  iDatum 
)

Import coordinate system from USGS projection definition.

This method will import projection definition in style, used by USGS GCTP software. GCTP operates on angles in packed DMS format (see CPLDecToPackedDMS() function for details), so all angle values (latitudes, longitudes, azimuths, etc.) specified in the padfPrjParams array should be in the packed DMS format.

This function is the equivalent of the C function OSRImportFromUSGS().

Parameters:
iProjSys Input projection system code, used in GCTP.
iZone Input zone for UTM and State Plane projection systems. For Southern Hemisphere UTM use a negative zone code. iZone ignored for all other projections.
padfPrjParams Array of 15 coordinate system parameters. These parameters differs for different projections.

Projection Transformation Package Projection Parameters

 ----------------------------------------------------------------------------
                         |                    Array Element                  
  Code & Projection Id   |---------------------------------------------------
                         |   0  |   1  |  2   |  3   |   4   |    5    |6 | 7
 ----------------------------------------------------------------------------
  0 Geographic           |      |      |      |      |       |         |  |  
  1 U T M                |Lon/Z |Lat/Z |      |      |       |         |  |  
  2 State Plane          |      |      |      |      |       |         |  |  
  3 Albers Equal Area    |SMajor|SMinor|STDPR1|STDPR2|CentMer|OriginLat|FE|FN
  4 Lambert Conformal C  |SMajor|SMinor|STDPR1|STDPR2|CentMer|OriginLat|FE|FN
  5 Mercator             |SMajor|SMinor|      |      |CentMer|TrueScale|FE|FN
  6 Polar Stereographic  |SMajor|SMinor|      |      |LongPol|TrueScale|FE|FN
  7 Polyconic            |SMajor|SMinor|      |      |CentMer|OriginLat|FE|FN
  8 Equid. Conic A       |SMajor|SMinor|STDPAR|      |CentMer|OriginLat|FE|FN
    Equid. Conic B       |SMajor|SMinor|STDPR1|STDPR2|CentMer|OriginLat|FE|FN
  9 Transverse Mercator  |SMajor|SMinor|Factor|      |CentMer|OriginLat|FE|FN
 10 Stereographic        |Sphere|      |      |      |CentLon|CenterLat|FE|FN
 11 Lambert Azimuthal    |Sphere|      |      |      |CentLon|CenterLat|FE|FN
 12 Azimuthal            |Sphere|      |      |      |CentLon|CenterLat|FE|FN
 13 Gnomonic             |Sphere|      |      |      |CentLon|CenterLat|FE|FN
 14 Orthographic         |Sphere|      |      |      |CentLon|CenterLat|FE|FN
 15 Gen. Vert. Near Per  |Sphere|      |Height|      |CentLon|CenterLat|FE|FN
 16 Sinusoidal           |Sphere|      |      |      |CentMer|         |FE|FN
 17 Equirectangular      |Sphere|      |      |      |CentMer|TrueScale|FE|FN
 18 Miller Cylindrical   |Sphere|      |      |      |CentMer|         |FE|FN
 19 Van der Grinten      |Sphere|      |      |      |CentMer|OriginLat|FE|FN
 20 Hotin Oblique Merc A |SMajor|SMinor|Factor|      |       |OriginLat|FE|FN
    Hotin Oblique Merc B |SMajor|SMinor|Factor|AziAng|AzmthPt|OriginLat|FE|FN
 21 Robinson             |Sphere|      |      |      |CentMer|         |FE|FN
 22 Space Oblique Merc A |SMajor|SMinor|      |IncAng|AscLong|         |FE|FN
    Space Oblique Merc B |SMajor|SMinor|Satnum|Path  |       |         |FE|FN
 23 Alaska Conformal     |SMajor|SMinor|      |      |       |         |FE|FN
 24 Interrupted Goode    |Sphere|      |      |      |       |         |  |  
 25 Mollweide            |Sphere|      |      |      |CentMer|         |FE|FN
 26 Interrupt Mollweide  |Sphere|      |      |      |       |         |  |  
 27 Hammer               |Sphere|      |      |      |CentMer|         |FE|FN
 28 Wagner IV            |Sphere|      |      |      |CentMer|         |FE|FN
 29 Wagner VII           |Sphere|      |      |      |CentMer|         |FE|FN
 30 Oblated Equal Area   |Sphere|      |Shapem|Shapen|CentLon|CenterLat|FE|FN
 ----------------------------------------------------------------------------

       ----------------------------------------------------
                               |      Array Element       |
         Code & Projection Id  |---------------------------
                               |  8  |  9 |  10 | 11 | 12 |  
       ----------------------------------------------------
        0 Geographic           |     |    |     |    |    |
        1 U T M                |     |    |     |    |    |
        2 State Plane          |     |    |     |    |    |
        3 Albers Equal Area    |     |    |     |    |    |
        4 Lambert Conformal C  |     |    |     |    |    |
        5 Mercator             |     |    |     |    |    |
        6 Polar Stereographic  |     |    |     |    |    |
        7 Polyconic            |     |    |     |    |    |
        8 Equid. Conic A       |zero |    |     |    |    |   
          Equid. Conic B       |one  |    |     |    |    |
        9 Transverse Mercator  |     |    |     |    |    |
       10 Stereographic        |     |    |     |    |    |
       11 Lambert Azimuthal    |     |    |     |    |    |    
       12 Azimuthal            |     |    |     |    |    |    
       13 Gnomonic             |     |    |     |    |    |
       14 Orthographic         |     |    |     |    |    |
       15 Gen. Vert. Near Per  |     |    |     |    |    |
       16 Sinusoidal           |     |    |     |    |    |
       17 Equirectangular      |     |    |     |    |    |
       18 Miller Cylindrical   |     |    |     |    |    |
       19 Van der Grinten      |     |    |     |    |    |
       20 Hotin Oblique Merc A |Long1|Lat1|Long2|Lat2|zero|   
          Hotin Oblique Merc B |     |    |     |    |one |
       21 Robinson             |     |    |     |    |    |
       22 Space Oblique Merc A |PSRev|LRat|PFlag|    |zero|    
          Space Oblique Merc B |     |    |     |    |one |
       23 Alaska Conformal     |     |    |     |    |    |
       24 Interrupted Goode    |     |    |     |    |    |
       25 Mollweide            |     |    |     |    |    |
       26 Interrupt Mollweide  |     |    |     |    |    |
       27 Hammer               |     |    |     |    |    |
       28 Wagner IV            |     |    |     |    |    |
       29 Wagner VII           |     |    |     |    |    |
       30 Oblated Equal Area   |Angle|    |     |    |    |
       ----------------------------------------------------

   where

    Lon/Z     Longitude of any point in the UTM zone or zero.  If zero,
              a zone code must be specified.
    Lat/Z     Latitude of any point in the UTM zone or zero.  If zero, a
              zone code must be specified.
    SMajor    Semi-major axis of ellipsoid.  If zero, Clarke 1866 in meters
              is assumed.
    SMinor    Eccentricity squared of the ellipsoid if less than zero,
              if zero, a spherical form is assumed, or if greater than
              zero, the semi-minor axis of ellipsoid.
    Sphere    Radius of reference sphere.  If zero, 6370997 meters is used.
    STDPAR    Latitude of the standard parallel
    STDPR1    Latitude of the first standard parallel
    STDPR2    Latitude of the second standard parallel
    CentMer   Longitude of the central meridian
    OriginLat Latitude of the projection origin
    FE        False easting in the same units as the semi-major axis
    FN        False northing in the same units as the semi-major axis
    TrueScale Latitude of true scale
    LongPol   Longitude down below pole of map
    Factor    Scale factor at central meridian (Transverse Mercator) or
              center of projection (Hotine Oblique Mercator)
    CentLon   Longitude of center of projection
    CenterLat Latitude of center of projection
    Height    Height of perspective point
    Long1     Longitude of first point on center line (Hotine Oblique
              Mercator, format A)
    Long2     Longitude of second point on center line (Hotine Oblique
              Mercator, format A)
    Lat1      Latitude of first point on center line (Hotine Oblique
              Mercator, format A)
    Lat2      Latitude of second point on center line (Hotine Oblique
              Mercator, format A)
    AziAng    Azimuth angle east of north of center line (Hotine Oblique
              Mercator, format B)
    AzmthPt   Longitude of point on central meridian where azimuth occurs
              (Hotine Oblique Mercator, format B)
    IncAng    Inclination of orbit at ascending node, counter-clockwise
              from equator (SOM, format A)
    AscLong   Longitude of ascending orbit at equator (SOM, format A)
    PSRev     Period of satellite revolution in minutes (SOM, format A)
    LRat      Landsat ratio to compensate for confusion at northern end
              of orbit (SOM, format A -- use 0.5201613)
    PFlag     End of path flag for Landsat:  0 = start of path,
              1 = end of path (SOM, format A)
    Satnum    Landsat Satellite Number (SOM, format B)
    Path      Landsat Path Number (Use WRS-1 for Landsat 1, 2 and 3 and
              WRS-2 for Landsat 4, 5 and 6.)  (SOM, format B)
    Shapem    Oblated Equal Area oval shape parameter m
    Shapen    Oblated Equal Area oval shape parameter n
    Angle     Oblated Equal Area oval rotation angle

 Array elements 13 and 14 are set to zero. All array elements with blank
 fields are set to zero too.
 

Parameters:
iDatum Output spheroid.

If the datum code is negative, the first two values in the parameter array (parm) are used to define the values as follows:

  • If padfPrjParams[0] is a non-zero value and padfPrjParams[1] is greater than one, the semimajor axis is set to padfPrjParams[0] and the semiminor axis is set to padfPrjParams[1].

  • If padfPrjParams[0] is nonzero and padfPrjParams[1] is greater than zero but less than or equal to one, the semimajor axis is set to padfPrjParams[0] and the semiminor axis is computed from the eccentricity squared value padfPrjParams[1]:

    semiminor = sqrt(1.0 - ES) * semimajor

    where

    ES = eccentricity squared

  • If padfPrjParams[0] is nonzero and padfPrjParams[1] is equal to zero, the semimajor axis and semiminor axis are set to padfPrjParams[0].

  • If padfPrjParams[0] equals zero and padfPrjParams[1] is greater than zero, the default Clarke 1866 is used to assign values to the semimajor axis and semiminor axis.

  • If padfPrjParams[0] and padfPrjParams[1] equals zero, the semimajor axis is set to 6370997.0 and the semiminor axis is set to zero.

If a datum code is zero or greater, the semimajor and semiminor axis are defined by the datum code as found in the following table:

Supported Datums

       0: Clarke 1866 (default)
       1: Clarke 1880
       2: Bessel
       3: International 1967
       4: International 1909
       5: WGS 72
       6: Everest
       7: WGS 66
       8: GRS 1980/WGS 84
       9: Airy
      10: Modified Everest
      11: Modified Airy
      12: Walbeck
      13: Southeast Asia
      14: Australian National
      15: Krassovsky
      16: Hough
      17: Mercury 1960
      18: Modified Mercury 1968
      19: Sphere of Radius 6370997 meters
 

Returns:
OGRERR_NONE on success or an error code in case of failure.

References FixupOrdering(), IsLocal(), IsProjected(), SetACEA(), SetAE(), SetAuthority(), SetEC(), SetEquirectangular(), SetGeogCS(), SetGnomonic(), SetHOM(), SetHOM2PNO(), SetLAEA(), SetLCC(), SetLinearUnits(), SetLocalCS(), SetMC(), SetMercator(), SetMollweide(), SetOrthographic(), SetPolyconic(), SetPS(), SetRobinson(), SetSinusoidal(), SetStatePlane(), SetStereographic(), SetTM(), SetUTM(), SetVDG(), and SetWellKnownGeogCS().

OGRErr OGRSpatialReference::importFromWkt ( char **  ppszInput  ) 

Import from WKT string.

This method will wipe the existing SRS definition, and reassign it based on the contents of the passed WKT string. Only as much of the input string as needed to construct this SRS is consumed from the input string, and the input string pointer is then updated to point to the remaining (unused) input.

This method is the same as the C function OSRImportFromWkt().

Parameters:
ppszInput Pointer to pointer to input. The pointer is updated to point to remaining unused input text.
Returns:
OGRERR_NONE if import succeeds, or OGRERR_CORRUPT_DATA if it fails for any reason.

References OGR_SRSNode::importFromWkt().

Referenced by importFromDict(), importFromESRI(), OGRSpatialReference(), SetFromUserInput(), and SetWellKnownGeogCS().

int OGRSpatialReference::IsGeographic (  )  const

Check if geographic coordinate system.

This method is the same as the C function OSRIsGeographic().

Returns:
TRUE if this spatial reference is geographic ... that is the root is a GEOGCS node.

Referenced by AutoIdentifyEPSG(), exportToERM(), exportToProj4(), importFromEPSG(), importFromPCI(), and SetWellKnownGeogCS().

int OGRSpatialReference::IsLocal (  )  const

Check if local coordinate system.

This method is the same as the C function OSRIsLocal().

Returns:
TRUE if this spatial reference is local ... that is the root is a LOCAL_CS node.

Referenced by exportToPanorama(), exportToPCI(), exportToUSGS(), importFromERM(), importFromESRI(), importFromPanorama(), importFromPCI(), importFromProj4(), and importFromUSGS().

int OGRSpatialReference::IsProjected (  )  const

Check if projected coordinate system.

This method is the same as the C function OSRIsProjected().

Returns:
TRUE if this contains a PROJCS node indicating a it is a projected coordinate system.

References OGR_SRSNode::GetValue().

Referenced by AutoIdentifyEPSG(), exportToERM(), importFromEPSG(), importFromESRI(), importFromPanorama(), importFromPCI(), importFromProj4(), importFromUSGS(), and IsSame().

int OGRSpatialReference::IsSame ( const OGRSpatialReference poOtherSRS  )  const

These two spatial references describe the same system.

Parameters:
poOtherSRS the SRS being compared to.
Returns:
TRUE if equivelent or FALSE otherwise.

References GetAttrNode(), GetAttrValue(), OGR_SRSNode::GetChild(), OGR_SRSNode::GetChildCount(), GetLinearUnits(), GetProjParm(), GetRoot(), OGR_SRSNode::GetValue(), IsProjected(), and IsSameGeogCS().

int OGRSpatialReference::IsSameGeogCS ( const OGRSpatialReference poOther  )  const

Do the GeogCS'es match?

This method is the same as the C function OSRIsSameGeogCS().

Parameters:
poOther the SRS being compared against.
Returns:
TRUE if they are the same or FALSE otherwise.

References CPLAtof(), and GetAttrValue().

Referenced by IsSame().

OGRErr OGRSpatialReference::morphFromESRI (  ) 

Convert in place to ESRI WKT format.

The value nodes of this coordinate system as modified in various manners more closely map onto the ESRI concept of WKT format. This includes renaming a variety of projections and arguments, and stripping out nodes note recognised by ESRI (like AUTHORITY and AXIS).

This does the same as the C function OSRMorphFromESRI().

Returns:
OGRERR_NONE unless something goes badly wrong.

References OGR_SRSNode::applyRemapper(), FixupOrdering(), GetAttrNode(), GetAttrValue(), OGR_SRSNode::GetChild(), GetProjParm(), OGR_SRSNode::GetValue(), SetNode(), SetProjParm(), and OGR_SRSNode::SetValue().

Referenced by importFromESRI(), and SetFromUserInput().

OGRErr OGRSpatialReference::morphToESRI (  ) 

Convert in place from ESRI WKT format.

The value notes of this coordinate system as modified in various manners to adhere more closely to the WKT standard. This mostly involves translating a variety of ESRI names for projections, arguments and datums to "standard" names, as defined by Adam Gawne-Cain's reference translation of EPSG to WKT for the CT specification.

This does the same as the C function OSRMorphToESRI().

Returns:
OGRERR_NONE unless something goes badly wrong.

References OGR_SRSNode::applyRemapper(), Fixup(), GetAngularUnits(), GetAttrNode(), GetAttrValue(), GetAuthorityCode(), GetAuthorityName(), OGR_SRSNode::GetChild(), OGR_SRSNode::GetChildCount(), GetLinearUnits(), GetProjParm(), GetUTMZone(), OGR_SRSNode::GetValue(), SetNode(), OGR_SRSNode::SetValue(), and StripCTParms().

int OGRSpatialReference::Reference (  ) 

Increments the reference count by one.

The reference count is used keep track of the number of OGRGeometry objects referencing this SRS.

The method does the same thing as the C function OSRReference().

Returns:
the updated reference count.

Referenced by OGRGeometry::assignSpatialReference().

void OGRSpatialReference::Release (  ) 

Decrements the reference count by one, and destroy if zero.

The method does the same thing as the C function OSRRelease().

References Dereference().

Referenced by OGRGeometry::assignSpatialReference().

OGRErr OGRSpatialReference::SetACEA ( double  dfStdP1,
double  dfStdP2,
double  dfCenterLat,
double  dfCenterLong,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Albers Conic Equal Area

References SetNormProjParm(), and SetProjection().

Referenced by importFromESRI(), importFromPCI(), importFromProj4(), and importFromUSGS().

OGRErr OGRSpatialReference::SetAE ( double  dfCenterLat,
double  dfCenterLong,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Azimuthal Equidistant

References SetNormProjParm(), and SetProjection().

Referenced by importFromPanorama(), importFromPCI(), importFromProj4(), and importFromUSGS().

OGRErr OGRSpatialReference::SetAngularUnits ( const char *  pszUnitsName,
double  dfInRadians 
)

Set the angular units for the geographic coordinate system.

This method creates a UNITS subnode with the specified values as a child of the GEOGCS node.

This method does the same as the C function OSRSetAngularUnits().

Parameters:
pszUnitsName the units name to be used. Some preferred units names can be found in ogr_srs_api.h such as SRS_UA_DEGREE.
dfInRadians the value to multiple by an angle in the indicated units to transform to radians. Some standard conversion factors can be found in ogr_srs_api.h.
Returns:
OGRERR_NONE on success.

References OGR_SRSNode::AddChild(), OGR_SRSNode::FindChild(), GetAttrNode(), OGR_SRSNode::GetChild(), and OGR_SRSNode::SetValue().

Referenced by Fixup(), and importFromPCI().

OGRErr OGRSpatialReference::SetAuthority ( const char *  pszTargetKey,
const char *  pszAuthority,
int  nCode 
)

Set the authority for a node.

This method is the same as the C function OSRSetAuthority().

Parameters:
pszTargetKey the partial or complete path to the node to set an authority on. ie. "PROJCS", "GEOGCS" or "GEOGCS|UNIT".
pszAuthority authority name, such as "EPSG".
nCode code for value with this authority.
Returns:
OGRERR_NONE on success.

References OGR_SRSNode::AddChild(), OGR_SRSNode::DestroyChild(), OGR_SRSNode::FindChild(), and GetAttrNode().

Referenced by AutoIdentifyEPSG(), importFromEPSG(), importFromPanorama(), importFromPCI(), and importFromUSGS().

OGRErr OGRSpatialReference::SetBonne ( double  dfStdP1,
double  dfCentralMeridian,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Bonne

References SetNormProjParm(), and SetProjection().

Referenced by importFromProj4().

OGRErr OGRSpatialReference::SetCEA ( double  dfStdP1,
double  dfCentralMeridian,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Cylindrical Equal Area

References SetNormProjParm(), and SetProjection().

Referenced by importFromProj4().

OGRErr OGRSpatialReference::SetCS ( double  dfCenterLat,
double  dfCenterLong,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Cassini-Soldner

References SetNormProjParm(), and SetProjection().

Referenced by importFromProj4().

OGRErr OGRSpatialReference::SetEC ( double  dfStdP1,
double  dfStdP2,
double  dfCenterLat,
double  dfCenterLong,
double  dfFalseEasting,
double  dfFalseNorthing 
)

OGRErr OGRSpatialReference::SetEckert ( int  nVariation,
double  dfCentralMeridian,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Eckert I-VI

References SetNormProjParm(), and SetProjection().

OGRErr OGRSpatialReference::SetEquirectangular ( double  dfCenterLat,
double  dfCenterLong,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Equirectangular

References SetNormProjParm(), and SetProjection().

Referenced by importFromPCI(), importFromProj4(), and importFromUSGS().

OGRErr OGRSpatialReference::SetFromUserInput ( const char *  pszDefinition  ) 

Set spatial reference from various text formats.

This method will examine the provided input, and try to deduce the format, and then use it to initialize the spatial reference system. It may take the following forms:

  1. Well Known Text definition - passed on to importFromWkt().
  2. "EPSG:n" - number passed on to importFromEPSG().
  3. "AUTO:proj_id,unit_id,lon0,lat0" - WMS auto projections.
  4. "urn:ogc:def:crs:EPSG::n" - ogc urns
  5. PROJ.4 definitions - passed on to importFromProj4().
  6. filename - file read for WKT, XML or PROJ.4 definition.
  7. well known name accepted by SetWellKnownGeogCS(), such as NAD27, NAD83, WGS84 or WGS72.
  8. WKT (directly or in a file) in ESRI format should be prefixed with ESRI:: to trigger an automatic morphFromESRI().

It is expected that this method will be extended in the future to support XML and perhaps a simplified "minilanguage" for indicating common UTM and State Plane definitions.

This method is intended to be flexible, but by it's nature it is imprecise as it must guess information about the format intended. When possible applications should call the specific method appropriate if the input is known to be in a particular format.

This method does the same thing as the OSRSetFromUserInput() function.

Parameters:
pszDefinition text definition to try to deduce SRS from.
Returns:
OGRERR_NONE on success, or an error code if the name isn't recognised, the definition is corrupt, or an EPSG value can't be successfully looked up.

References Clear(), importFromDict(), importFromEPSG(), importFromProj4(), importFromUrl(), importFromURN(), importFromWkt(), morphFromESRI(), and SetWellKnownGeogCS().

Referenced by importFromUrl().

OGRErr OGRSpatialReference::SetGeogCS ( const char *  pszGeogName,
const char *  pszDatumName,
const char *  pszSpheroidName,
double  dfSemiMajor,
double  dfInvFlattening,
const char *  pszPMName = NULL,
double  dfPMOffset = 0.0,
const char *  pszAngularUnits = NULL,
double  dfConvertToRadians = 0.0 
)

Set geographic coordinate system.

This method is used to set the datum, ellipsoid, prime meridian and angular units for a geographic coordinate system. It can be used on it's own to establish a geographic spatial reference, or applied to a projected coordinate system to establish the underlying geographic coordinate system.

This method does the same as the C function OSRSetGeogCS().

Parameters:
pszGeogName user visible name for the geographic coordinate system (not to serve as a key).
pszDatumName key name for this datum. The OpenGIS specification lists some known values, and otherwise EPSG datum names with a standard transformation are considered legal keys.
pszSpheroidName user visible spheroid name (not to serve as a key)
dfSemiMajor the semi major axis of the spheroid.
dfInvFlattening the inverse flattening for the spheroid. This can be computed from the semi minor axis as 1/f = 1.0 / (1.0 - semiminor/semimajor).
pszPMName the name of the prime merdidian (not to serve as a key) If this is NULL a default value of "Greenwich" will be used.
dfPMOffset the longitude of greenwich relative to this prime meridian.
pszAngularUnits the angular units name (see ogr_srs_api.h for some standard names). If NULL a value of "degrees" will be assumed.
dfConvertToRadians value to multiply angular units by to transform them to radians. A value of SRS_UL_DEGREE_CONV will be used if pszAngularUnits is NULL.
Returns:
OGRERR_NONE on success.

References OGR_SRSNode::AddChild(), Clear(), CPLAtof(), OGR_SRSNode::DestroyChild(), OGR_SRSNode::FindChild(), GetAttrNode(), OGR_SRSNode::InsertChild(), and SetRoot().

Referenced by importFromPanorama(), importFromPCI(), importFromProj4(), and importFromUSGS().

OGRErr OGRSpatialReference::SetGEOS ( double  dfCentralMeridian,
double  dfSatelliteHeight,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Geostationary Satellite

References SetNormProjParm(), and SetProjection().

Referenced by importFromProj4().

OGRErr OGRSpatialReference::SetGH ( double  dfCentralMeridian,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Goode Homolosine

References SetNormProjParm(), and SetProjection().

Referenced by importFromProj4().

OGRErr OGRSpatialReference::SetGnomonic ( double  dfCenterLat,
double  dfCenterLong,
double  dfFalseEasting,
double  dfFalseNorthing 
)

OGRErr OGRSpatialReference::SetGS ( double  dfCentralMeridian,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Gall Stereograpic

References SetNormProjParm(), and SetProjection().

Referenced by importFromProj4().

OGRErr OGRSpatialReference::SetHOM ( double  dfCenterLat,
double  dfCenterLong,
double  dfAzimuth,
double  dfRectToSkew,
double  dfScale,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Set a Hotine Oblique Mercator projection using azimuth angle.

This method does the same thing as the C function OSRSetHOM().

Parameters:
dfCenterLat Latitude of the projection origin.
dfCenterLong Longitude of the projection origin.
dfAzimuth Azimuth, measured clockwise from North, of the projection centerline.
dfRectToSkew ?.
dfScale Scale factor applies to the projection origin.
dfFalseEasting False easting.
dfFalseNorthing False northing.
Returns:
OGRERR_NONE on success.

References SetNormProjParm(), and SetProjection().

Referenced by importFromProj4(), and importFromUSGS().

OGRErr OGRSpatialReference::SetHOM2PNO ( double  dfCenterLat,
double  dfLat1,
double  dfLong1,
double  dfLat2,
double  dfLong2,
double  dfScale,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Set a Hotine Oblique Mercator projection using two points on projection centerline.

This method does the same thing as the C function OSRSetHOM2PNO().

Parameters:
dfCenterLat Latitude of the projection origin.
dfLat1 Latitude of the first point on center line.
dfLong1 Longitude of the first point on center line.
dfLat2 Latitude of the second point on center line.
dfLong2 Longitude of the second point on center line.
dfScale Scale factor applies to the projection origin.
dfFalseEasting False easting.
dfFalseNorthing False northing.
Returns:
OGRERR_NONE on success.

References SetNormProjParm(), and SetProjection().

Referenced by importFromUSGS().

OGRErr OGRSpatialReference::SetKrovak ( double  dfCenterLat,
double  dfCenterLong,
double  dfAzimuth,
double  dfPseudoStdParallelLat,
double  dfScale,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Krovak Oblique Conic Conformal

References SetNormProjParm(), and SetProjection().

Referenced by importFromProj4().

OGRErr OGRSpatialReference::SetLAEA ( double  dfCenterLat,
double  dfCenterLong,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Lambert Azimuthal Equal-Area

References SetNormProjParm(), and SetProjection().

Referenced by importFromPanorama(), importFromPCI(), importFromProj4(), and importFromUSGS().

OGRErr OGRSpatialReference::SetLCC ( double  dfStdP1,
double  dfStdP2,
double  dfCenterLat,
double  dfCenterLong,
double  dfFalseEasting,
double  dfFalseNorthing 
)

OGRErr OGRSpatialReference::SetLCC1SP ( double  dfCenterLat,
double  dfCenterLong,
double  dfScale,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Lambert Conformal Conic 1SP

References SetNormProjParm(), and SetProjection().

Referenced by importFromProj4().

OGRErr OGRSpatialReference::SetLCCB ( double  dfStdP1,
double  dfStdP2,
double  dfCenterLat,
double  dfCenterLong,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Lambert Conformal Conic (Belgium)

References SetNormProjParm(), and SetProjection().

OGRErr OGRSpatialReference::SetLinearUnits ( const char *  pszUnitsName,
double  dfInMeters 
)

Set the linear units for the projection.

This method creates a UNITS subnode with the specified values as a child of the PROJCS or LOCAL_CS node.

This method does the same as the C function OSRSetLinearUnits().

Parameters:
pszUnitsName the units name to be used. Some preferred units names can be found in ogr_srs_api.h such as SRS_UL_METER, SRS_UL_FOOT and SRS_UL_US_FOOT.
dfInMeters the value to multiple by a length in the indicated units to transform to meters. Some standard conversion factors can be found in ogr_srs_api.h.
Returns:
OGRERR_NONE on success.

References OGR_SRSNode::AddChild(), OGR_SRSNode::DestroyChild(), OGR_SRSNode::FindChild(), GetAttrNode(), OGR_SRSNode::GetChild(), and OGR_SRSNode::SetValue().

Referenced by Fixup(), importFromERM(), importFromPanorama(), importFromPCI(), importFromProj4(), importFromUSGS(), SetLinearUnitsAndUpdateParameters(), SetStatePlane(), and SetUTM().

OGRErr OGRSpatialReference::SetLinearUnitsAndUpdateParameters ( const char *  pszName,
double  dfInMeters 
)

Set the linear units for the projection.

This method creates a UNITS subnode with the specified values as a child of the PROJCS or LOCAL_CS node. It works the same as the SetLinearUnits() method, but it also updates all existing linear projection parameter values from the old units to the new units.

Parameters:
pszUnitsName the units name to be used. Some preferred units names can be found in ogr_srs_api.h such as SRS_UL_METER, SRS_UL_FOOT and SRS_UL_US_FOOT.
dfInMeters the value to multiple by a length in the indicated units to transform to meters. Some standard conversion factors can be found in ogr_srs_api.h.
Returns:
OGRERR_NONE on success.

References GetAttrNode(), OGR_SRSNode::GetChild(), OGR_SRSNode::GetChildCount(), GetLinearUnits(), GetProjParm(), OGR_SRSNode::GetValue(), SetLinearUnits(), and SetProjParm().

Referenced by importFromESRI().

OGRErr OGRSpatialReference::SetLocalCS ( const char *  pszName  ) 

Set the user visible LOCAL_CS name.

This method is the same as the C function OSRSetLocalCS().

This method is will ensure a LOCAL_CS node is created as the root, and set the provided name on it. It must be used before SetLinearUnits().

Parameters:
pszName the user visible name to assign. Not used as a key.
Returns:
OGRERR_NONE on success.

References GetAttrNode(), and SetNode().

Referenced by importFromESRI(), importFromPanorama(), importFromPCI(), importFromUSGS(), and SetStatePlane().

OGRErr OGRSpatialReference::SetMC ( double  dfCenterLat,
double  dfCenterLong,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Miller Cylindrical

References SetNormProjParm(), and SetProjection().

Referenced by importFromPCI(), importFromProj4(), and importFromUSGS().

OGRErr OGRSpatialReference::SetMercator ( double  dfCenterLat,
double  dfCenterLong,
double  dfScale,
double  dfFalseEasting,
double  dfFalseNorthing 
)

OGRErr OGRSpatialReference::SetMollweide ( double  dfCentralMeridian,
double  dfFalseEasting,
double  dfFalseNorthing 
)

OGRErr OGRSpatialReference::SetNode ( const char *  pszNodePath,
const char *  pszNewNodeValue 
)

Set attribute value in spatial reference.

Missing intermediate nodes in the path will be created if not already in existance. If the attribute has no children one will be created and assigned the value otherwise the zeroth child will be assigned the value.

This method does the same as the C function OSRSetAttrValue().

Parameters:
pszNodePath full path to attribute to be set. For instance "PROJCS|GEOGCS|UNITS".
pszNewNodeValue value to be assigned to node, such as "meter". This may be NULL if you just want to force creation of the intermediate path.
Returns:
OGRERR_NONE on success.

References OGR_SRSNode::AddChild(), OGR_SRSNode::GetChild(), OGR_SRSNode::GetChildCount(), OGR_SRSNode::GetValue(), SetRoot(), and OGR_SRSNode::SetValue().

Referenced by morphFromESRI(), morphToESRI(), SetLocalCS(), SetProjCS(), SetProjection(), and SetUTM().

OGRErr OGRSpatialReference::SetNormProjParm ( const char *  pszName,
double  dfValue 
)

Set a projection parameter with a normalized value.

This method is the same as SetProjParm() except that the value of the parameter passed in is assumed to be in "normalized" form (decimal degrees for angular values, meters for linear values. The values are converted in a form suitable for the GEOGCS and linear units in effect.

This method is the same as the C function OSRSetNormProjParm().

Parameters:
pszName the parameter name, which should be selected from the macros in ogr_srs_api.h, such as SRS_PP_CENTRAL_MERIDIAN.
dfValue value to assign.
Returns:
OGRERR_NONE on success.

References SetProjParm().

Referenced by importFromProj4(), SetACEA(), SetAE(), SetBonne(), SetCEA(), SetCS(), SetEC(), SetEckert(), SetEquirectangular(), SetGEOS(), SetGH(), SetGnomonic(), SetGS(), SetHOM(), SetHOM2PNO(), SetKrovak(), SetLAEA(), SetLCC(), SetLCC1SP(), SetLCCB(), SetMC(), SetMercator(), SetMollweide(), SetNZMG(), SetOrthographic(), SetOS(), SetPolyconic(), SetPS(), SetRobinson(), SetSinusoidal(), SetSOC(), SetStatePlane(), SetStereographic(), SetTM(), SetTMG(), SetTMSO(), SetTMVariant(), SetTPED(), SetUTM(), and SetVDG().

OGRErr OGRSpatialReference::SetNZMG ( double  dfCenterLat,
double  dfCenterLong,
double  dfFalseEasting,
double  dfFalseNorthing 
)

New Zealand Map Grid

References SetNormProjParm(), and SetProjection().

Referenced by importFromProj4().

OGRErr OGRSpatialReference::SetOrthographic ( double  dfCenterLat,
double  dfCenterLong,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Orthographic

References SetNormProjParm(), and SetProjection().

Referenced by importFromPCI(), importFromProj4(), and importFromUSGS().

OGRErr OGRSpatialReference::SetOS ( double  dfOriginLat,
double  dfCMeridian,
double  dfScale,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Oblique Stereographic

References SetNormProjParm(), and SetProjection().

Referenced by importFromProj4().

OGRErr OGRSpatialReference::SetPolyconic ( double  dfCenterLat,
double  dfCenterLong,
double  dfFalseEasting,
double  dfFalseNorthing 
)

OGRErr OGRSpatialReference::SetProjCS ( const char *  pszName  ) 

Set the user visible PROJCS name.

This method is the same as the C function OSRSetProjCS().

This method is will ensure a PROJCS node is created as the root, and set the provided name on it. If used on a GEOGCS coordinate system, the GEOGCS node will be demoted to be a child of the new PROJCS root.

Parameters:
pszName the user visible name to assign. Not used as a key.
Returns:
OGRERR_NONE on success.

References GetAttrNode(), OGR_SRSNode::GetValue(), OGR_SRSNode::InsertChild(), and SetNode().

OGRErr OGRSpatialReference::SetProjection ( const char *  pszProjection  ) 

Set a projection name.

This method is the same as the C function OSRSetProjection().

Parameters:
pszProjection the projection name, which should be selected from the macros in ogr_srs_api.h, such as SRS_PT_TRANSVERSE_MERCATOR.
Returns:
OGRERR_NONE on success.

References GetAttrNode(), OGR_SRSNode::GetValue(), OGR_SRSNode::InsertChild(), and SetNode().

Referenced by SetACEA(), SetAE(), SetBonne(), SetCEA(), SetCS(), SetEC(), SetEckert(), SetEquirectangular(), SetGEOS(), SetGH(), SetGnomonic(), SetGS(), SetHOM(), SetHOM2PNO(), SetKrovak(), SetLAEA(), SetLCC(), SetLCC1SP(), SetLCCB(), SetMC(), SetMercator(), SetMollweide(), SetNZMG(), SetOrthographic(), SetOS(), SetPolyconic(), SetPS(), SetRobinson(), SetSinusoidal(), SetSOC(), SetStereographic(), SetTM(), SetTMG(), SetTMSO(), SetTMVariant(), SetTPED(), SetUTM(), and SetVDG().

OGRErr OGRSpatialReference::SetProjParm ( const char *  pszParmName,
double  dfValue 
)

Set a projection parameter value.

Adds a new PARAMETER under the PROJCS with the indicated name and value.

This method is the same as the C function OSRSetProjParm().

Please check http://www.remotesensing.org/geotiff/proj_list pages for legal parameter names for specific projections.

Parameters:
pszParmName the parameter name, which should be selected from the macros in ogr_srs_api.h, such as SRS_PP_CENTRAL_MERIDIAN.
dfValue value to assign.
Returns:
OGRERR_NONE on success.

References OGR_SRSNode::AddChild(), GetAttrNode(), OGR_SRSNode::GetChild(), OGR_SRSNode::GetChildCount(), OGR_SRSNode::GetValue(), and OGR_SRSNode::SetValue().

Referenced by morphFromESRI(), SetLinearUnitsAndUpdateParameters(), and SetNormProjParm().

OGRErr OGRSpatialReference::SetPS ( double  dfCenterLat,
double  dfCenterLong,
double  dfScale,
double  dfFalseEasting,
double  dfFalseNorthing 
)

OGRErr OGRSpatialReference::SetRobinson ( double  dfCenterLong,
double  dfFalseEasting,
double  dfFalseNorthing 
)

void OGRSpatialReference::SetRoot ( OGR_SRSNode poNewRoot  ) 

Set the root SRS node.

If the object has an existing tree of OGR_SRSNodes, they are destroyed as part of assigning the new root. Ownership of the passed OGR_SRSNode is is assumed by the OGRSpatialReference.

Parameters:
poNewRoot object to assign as root.

Referenced by CopyGeogCSFrom(), SetGeogCS(), and SetNode().

OGRErr OGRSpatialReference::SetSinusoidal ( double  dfCenterLong,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Sinusoidal

References SetNormProjParm(), and SetProjection().

Referenced by importFromPCI(), importFromProj4(), and importFromUSGS().

OGRErr OGRSpatialReference::SetSOC ( double  dfLatitudeOfOrigin,
double  dfCentralMeridian,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Swiss Oblique Cylindrical

References SetNormProjParm(), and SetProjection().

OGRErr OGRSpatialReference::SetStatePlane ( int  nZone,
int  bNAD83 = TRUE,
const char *  pszOverrideUnitName = NULL,
double  dfOverrideUnit = 0.0 
)

State Plane

Set State Plane projection definition.

This will attempt to generate a complete definition of a state plane zone based on generating the entire SRS from the EPSG tables. If the EPSG tables are unavailable, it will produce a stubbed LOCAL_CS definition and return OGRERR_FAILURE.

This method is the same as the C function OSRSetStatePlaneWithUnits().

Parameters:
nZone State plane zone number, in the USGS numbering scheme (as dinstinct from the Arc/Info and Erdas numbering scheme.
bNAD83 TRUE if the NAD83 zone definition should be used or FALSE if the NAD27 zone definition should be used.
pszOverrideUnitName Linear unit name to apply overriding the legal definition for this zone.
dfOverrideUnit Linear unit conversion factor to apply overriding the legal definition for this zone.
Returns:
OGRERR_NONE on success, or OGRERR_FAILURE on failure, mostly likely due to the EPSG tables not being accessable.

References Clear(), CPLAtof(), OGR_SRSNode::DestroyChild(), OGR_SRSNode::FindChild(), GetAttrNode(), GetLinearUnits(), GetNormProjParm(), importFromEPSG(), SetLinearUnits(), SetLocalCS(), and SetNormProjParm().

Referenced by importFromESRI(), importFromPCI(), and importFromUSGS().

OGRErr OGRSpatialReference::SetStereographic ( double  dfCenterLat,
double  dfCenterLong,
double  dfScale,
double  dfFalseEasting,
double  dfFalseNorthing 
)

OGRErr OGRSpatialReference::SetTM ( double  dfCenterLat,
double  dfCenterLong,
double  dfScale,
double  dfFalseEasting,
double  dfFalseNorthing 
)

OGRErr OGRSpatialReference::SetTMG ( double  dfCenterLat,
double  dfCenterLong,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Tunesia Mining Grid

References SetNormProjParm(), and SetProjection().

OGRErr OGRSpatialReference::SetTMSO ( double  dfCenterLat,
double  dfCenterLong,
double  dfScale,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Transverse Mercator (South Oriented)

References SetNormProjParm(), and SetProjection().

OGRErr OGRSpatialReference::SetTMVariant ( const char *  pszVariantName,
double  dfCenterLat,
double  dfCenterLong,
double  dfScale,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Transverse Mercator variants.

References SetNormProjParm(), and SetProjection().

OGRErr OGRSpatialReference::SetTOWGS84 ( double  dfDX,
double  dfDY,
double  dfDZ,
double  dfEX = 0.0,
double  dfEY = 0.0,
double  dfEZ = 0.0,
double  dfPPM = 0.0 
)

Set the Bursa-Wolf conversion to WGS84.

This will create the TOWGS84 node as a child of the DATUM. It will fail if there is no existing DATUM node. Unlike most OGRSpatialReference methods it will insert itself in the appropriate order, and will replace an existing TOWGS84 node if there is one.

The parameters have the same meaning as EPSG transformation 9606 (Position Vector 7-param. transformation).

This method is the same as the C function OSRSetTOWGS84().

Parameters:
dfDX X child in meters.
dfDY Y child in meters.
dfDZ Z child in meters.
dfEX X rotation in arc seconds (optional, defaults to zero).
dfEY Y rotation in arc seconds (optional, defaults to zero).
dfEZ Z rotation in arc seconds (optional, defaults to zero).
dfPPM scaling factor (parts per million).
Returns:
OGRERR_NONE on success.

References OGR_SRSNode::AddChild(), OGR_SRSNode::DestroyChild(), OGR_SRSNode::FindChild(), GetAttrNode(), OGR_SRSNode::GetChildCount(), and OGR_SRSNode::InsertChild().

Referenced by importFromProj4().

OGRErr OGRSpatialReference::SetTPED ( double  dfLat1,
double  dfLong1,
double  dfLat2,
double  dfLong2,
double  dfFalseEasting,
double  dfFalseNorthing 
)

Two Point Equidistant

References SetNormProjParm(), and SetProjection().

Referenced by importFromProj4().

OGRErr OGRSpatialReference::SetUTM ( int  nZone,
int  bNorth = TRUE 
)

Universal Transverse Mercator

Set UTM projection definition.

This will generate a projection definition with the full set of transverse mercator projection parameters for the given UTM zone. If no PROJCS[] description is set yet, one will be set to look like "UTM Zone %d, {Northern, Southern} Hemisphere".

This method is the same as the C function OSRSetUTM().

Parameters:
nZone UTM zone.
bNorth TRUE for northern hemisphere, or FALSE for southern hemisphere.
Returns:
OGRERR_NONE on success.

References GetAttrValue(), SetLinearUnits(), SetNode(), SetNormProjParm(), and SetProjection().

Referenced by importFromESRI(), importFromPanorama(), importFromPCI(), importFromProj4(), and importFromUSGS().

OGRErr OGRSpatialReference::SetVDG ( double  dfCenterLong,
double  dfFalseEasting,
double  dfFalseNorthing 
)

VanDerGrinten

References SetNormProjParm(), and SetProjection().

Referenced by importFromPCI(), importFromProj4(), and importFromUSGS().

OGRErr OGRSpatialReference::SetWellKnownGeogCS ( const char *  pszName  ) 

Set a GeogCS based on well known name.

This may be called on an empty OGRSpatialReference to make a geographic coordinate system, or on something with an existing PROJCS node to set the underlying geographic coordinate system of a projected coordinate system.

The following well known text values are currently supported:

  • "WGS84": same as "EPSG:4326" but has no dependence on EPSG data files.
  • "WGS72": same as "EPSG:4322" but has no dependence on EPSG data files.
  • "NAD27": same as "EPSG:4267" but has no dependence on EPSG data files.
  • "NAD83": same as "EPSG:4269" but has no dependence on EPSG data files.
  • "EPSG:n": same as doing an ImportFromEPSG(n).

Parameters:
pszName name of well known geographic coordinate system.
Returns:
OGRERR_NONE on success, or OGRERR_FAILURE if the name isn't recognised, the target object is already initialized, or an EPSG value can't be successfully looked up.

References CopyGeogCSFrom(), importFromEPSG(), importFromWkt(), and IsGeographic().

Referenced by importFromESRI(), importFromPanorama(), importFromPCI(), importFromProj4(), importFromURN(), importFromUSGS(), and SetFromUserInput().

OGRErr OGRSpatialReference::StripCTParms ( OGR_SRSNode poCurrent = NULL  ) 

Strip OGC CT Parameters.

This method will remove all components of the coordinate system that are specific to the OGC CT Specification. That is it will attempt to strip it down to being compatible with the Simple Features 1.0 specification.

This method is the same as the C function OSRStripCTParms().

Parameters:
poCurrent node to operate on. NULL to operate on whole tree.
Returns:
OGRERR_NONE on success or an error code.

References OGR_SRSNode::GetValue(), and OGR_SRSNode::StripNodes().

Referenced by morphToESRI().

OGRErr OGRSpatialReference::Validate (  ) 

Validate SRS tokens.

This method attempts to verify that the spatial reference system is well formed, and consists of known tokens. The validation is not comprehensive.

This method is the same as the C function OSRValidate().

Returns:
OGRERR_NONE if all is fine, OGRERR_CORRUPT_DATA if the SRS is not well formed, and OGRERR_UNSUPPORTED_SRS if the SRS is well formed, but contains non-standard PROJECTION[] values.

References CPLAtof(), OGR_SRSNode::GetChild(), OGR_SRSNode::GetChildCount(), OGR_SRSNode::GetNode(), and OGR_SRSNode::GetValue().


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

Generated for GDAL by doxygen 1.5.8.