vtProjection Class Reference

List of all members.

Public Member Functions

vtProjectionoperator= (const vtProjection &ref)
bool operator== (const vtProjection &ref) const
bool operator!= (const vtProjection &ref) const
void SetUTMZone (int iZone)
int GetUTMZone () const
OGRErr SetDatum (int iDatum)
int GetDatum () const
LinearUnits GetUnits () const
int GuessEPSGCode () const
OGRErr SetGeogCSFromDatum (int iDatum)
bool SetProjectionSimple (bool bUTM, int iUTMZone, int iDatum)
void SetSpatialReference (OGRSpatialReference *pRef)
const char * GetProjectionName () const
const char * GetProjectionNameShort () const
bool GetTextDescription (char *type, char *value) const
bool SetTextDescription (const char *type, const char *value)
bool ReadProjFile (const char *filename)
bool WriteProjFile (const char *filename) const
void SetDymaxion (bool bTrue)
bool IsDymaxion () const

Static Public Member Functions

static double GeodesicDistance (const DPoint2 &in, const DPoint2 &out, bool bQuick=false)

Protected Member Functions

void LogDescription () const

Protected Attributes

bool m_bDymaxion


Detailed Description

The vtProjection class represents an earth coordinate reference system (CRS), which is generally a projected coordinate system (PCS). It is based on the class OGRSpatialReference which represents a full OpenGIS Spatial Reference System. The vtProjection class extends OGRSpatialReference with several useful methods.

Member Function Documentation

double vtProjection::GeodesicDistance ( const DPoint2 geo1,
const DPoint2 geo2,
bool  bQuick = false 
) [static]

Given two geographic coordinates (longitude/latitude in degrees), return the geodesic arc distance in meters. The WGS84 spheroid is used.

int vtProjection::GetDatum (  )  const

Return the datum as an EPSG code (an integer in the range of 6120 - 6904), or -1 if the datum could not be determined.

const char * vtProjection::GetProjectionName (  )  const

Return a string describing the type of projection.

Example:
"Geographic", "Transverse_Mercator", "Albers_Conic_Equal_Area"

const char * vtProjection::GetProjectionNameShort (  )  const

Return a very short string describing the type of projection.

Example values are "Geo", "UTM", "TM", "Albers", "LCC", etc. or "Unknown" if it is unknown.

bool vtProjection::GetTextDescription ( char *  type,
char *  value 
) const

Get the projection as a text description. If the projection is Geographic or UTM, then a "simple" type string will be returned. For all other projection types, a WKT string is returned.

Parameters:
type A string buffer to contain the type of description. This buffer should be at least 7 characters long to contain either the word "simple" or "wkt".
value A string buffer to contain the full description. This buffer should be at least 2048 characters long to contain either a simple or WKT description.

LinearUnits vtProjection::GetUnits (  )  const

Return the kind of horizontal units used by the projection. This is also called "linear units."

Returns:
  • LU_DEGREES - Arc Degrees
  • LU_METERS - Meters
  • LU_FEET_INT - Feet (International Foot)
  • LU_FEET_US - Feet (U.S. Survey Foot)

int vtProjection::GetUTMZone (  )  const

Get the UTM zone of the projection.

Returns:
  • 1 through 60 in the northern hemisphere
  • -1 through -60 for the southern hemisphere
  • 0 if the projection is not UTM

int vtProjection::GuessEPSGCode (  )  const

Try to determine the EPSG code that corresponds to the current projection. This important capability is mysteriously absent from the underlying libraries (OGR, PROJ.4) so it is implemented here.

Returns:
An EPSG coordinate system code, or -1 if it couldn't be guessed.

bool vtProjection::operator!= ( const vtProjection ref  )  const

Inequality operator.

vtProjection & vtProjection::operator= ( const vtProjection ref  ) 

Assignment operator.

bool vtProjection::operator== ( const vtProjection ref  )  const

Equality operator.

bool vtProjection::ReadProjFile ( const char *  filename  ) 

Read the projection from a .prj file.

If the filename does not have the file extension ".prj", this method will look for a file which has the same name with a ".prj" extension.

Returns:
true if successful.

OGRErr vtProjection::SetDatum ( int  iDatum  ) 

Set the datum to an EPSG Datum code, a value in the range (6120 - 6904).

Here are the codes for some of the better-known datums:

  • NAD27 6267
  • NAD83 6269
  • WGS84 6326

OGRErr vtProjection::SetGeogCSFromDatum ( int  iDatum  ) 

Set the projection to a fresh, new geographical coordinate system based on the indicated Datum.

bool vtProjection::SetProjectionSimple ( bool  bUTM,
int  iUTMZone,
int  iDatum 
)

Convenient way to set a simple projection.

Parameters:
bUTM true for UTM, false for Geographic.
iUTMZone If UTM, this is the zone: 1 through 60 in the northern hemisphere, -1 through -60 for the southern hemisphere.
iDatum The Datum as either an old USGS code or an EPSG code

void vtProjection::SetSpatialReference ( OGRSpatialReference *  pRef  ) 

Set the projection by copying from a OGRSpatialReference.

bool vtProjection::SetTextDescription ( const char *  type,
const char *  value 
)

Set the projection using a text description.

Parameters:
type The type of description, either "simple" for short simple string, or "wkt" for a full-length WKT (Well-Known Text) description.
value The description itself. A WKT description should be a single string, with no extra whitespace. A simple string can have the following forms:
  • geo, datum D
  • utm, datum D, zone Z
Example:
    proj.SetTextDescription("simple", "utm, datum WGS_84, zone 11");

void vtProjection::SetUTMZone ( int  iZone  ) 

Get the UTM zone of the projection.

Parameters:
iZone Should be one of the following values:
  • 1 through 60 for the northern hemisphere
  • -1 through -60 for the southern hemisphere

bool vtProjection::WriteProjFile ( const char *  filename  )  const

Write the projection to a .prj file.

Returns:
true if successful.


Generated on Wed Dec 24 13:08:41 2008 for vtdata library by  doxygen 1.5.7.1