EVOLUTION-MANAGER
Edit File: osr_tutorial.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.5"/> <title>OGR: OGR Projections Tutorial</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">OGR </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.5 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li class="current"><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="headertitle"> <div class="title">OGR Projections Tutorial </div> </div> </div><!--header--> <div class="contents"> <div class="textblock"><h1><a class="anchor" id="osr_tutorial_intro"></a> Introduction</h1> <p>The <a class="el" href="classOGRSpatialReference.html">OGRSpatialReference</a>, and <a class="el" href="classOGRCoordinateTransformation.html">OGRCoordinateTransformation</a> classes provide services to represent coordinate systems (projections and datums) and to transform between them. These services are loosely modelled on the OpenGIS Coordinate Transformations specification, and use the same Well Known Text format for describing coordinate systems.</p> <p>Some background on OpenGIS coordinate systems and services can be found in the Simple Features for COM, and Spatial Reference Systems Abstract Model documents available from the <a href="http://www.opengeospatial.org">Open Geospatial Consortium</a>. The <a href="http://www.remotesensing.org/geotiff/proj_list">GeoTIFF Projections Transform List</a> may also be of assistance in understanding formulations of projections in WKT. The <a href="http://www.epsg.org">EPSG</a> Geodesy web page is also a useful resource.</p> <h1><a class="anchor" id="osr_tutorial_cs"></a> Defining a Geographic Coordinate System</h1> <p>Coordinate systems are encapsulated in the <a class="el" href="classOGRSpatialReference.html">OGRSpatialReference</a> class. There are a number of ways of initializing an <a class="el" href="classOGRSpatialReference.html">OGRSpatialReference</a> object to a valid coordinate system. There are two primary kinds of coordinate systems. The first is geographic (positions are measured in long/lat) and the second is projected (such as UTM - positions are measured in meters or feet).</p> <p>A Geographic coordinate system contains information on the datum (which implies an spheroid described by a semi-major axis, and inverse flattening), prime meridian(normally Greenwich), and an angular units type which is normally degrees. The following code initializes a geographic coordinate system on supplying all this information along with a user visible name for the geographic coordinate system.</p> <div class="fragment"><div class="line"><a class="code" href="classOGRSpatialReference.html">OGRSpatialReference</a> oSRS;</div> <div class="line"></div> <div class="line">oSRS.<a class="code" href="classOGRSpatialReference.html#a1c8d3eaf2751d9912797c75f477549fe">SetGeogCS</a>( <span class="stringliteral">"My geographic coordinate system"</span>,</div> <div class="line"> <span class="stringliteral">"WGS_1984"</span>, </div> <div class="line"> <span class="stringliteral">"My WGS84 Spheroid"</span>, </div> <div class="line"> SRS_WGS84_SEMIMAJOR, SRS_WGS84_INVFLATTENING, </div> <div class="line"> <span class="stringliteral">"Greenwich"</span>, 0.0, </div> <div class="line"> <span class="stringliteral">"degree"</span>, SRS_UA_DEGREE_CONV );</div> </div><!-- fragment --><p>Of these values, the names "My geographic coordinate system", "My WGS84 Spheroid", "Greenwich" and "degree" are not keys, but are used for display to the user. However, the datum name "WGS_1984" is used as a key to identify the datum, and there are rules on what values can be used. NOTE: Prepare writeup somewhere on valid datums!</p> <p>The <a class="el" href="classOGRSpatialReference.html">OGRSpatialReference</a> has built in support for a few well known coordinate systems, which include "NAD27", "NAD83", "WGS72" and "WGS84" which can be defined in a single call to SetWellKnownGeogCS().</p> <div class="fragment"><div class="line">oSRS.<a class="code" href="classOGRSpatialReference.html#a096b8dde4fd2eb475acd376060940b02">SetWellKnownGeogCS</a>( <span class="stringliteral">"WGS84"</span> );</div> </div><!-- fragment --><p>Furthermore, any geographic coordinate system in the EPSG database can be set by it's GCS code number if the EPSG database is available.</p> <div class="fragment"><div class="line">oSRS.<a class="code" href="classOGRSpatialReference.html#a096b8dde4fd2eb475acd376060940b02">SetWellKnownGeogCS</a>( <span class="stringliteral">"EPSG:4326"</span> );</div> </div><!-- fragment --><p>For serializization, and transmission of projection definitions to other packages, the OpenGIS Well Known Text format for coordinate systems is used. An <a class="el" href="classOGRSpatialReference.html">OGRSpatialReference</a> can be initialized from well known text, or converted back into well known text.</p> <div class="fragment"><div class="line"><span class="keywordtype">char</span> *pszWKT = NULL;</div> <div class="line"></div> <div class="line">oSRS.<a class="code" href="classOGRSpatialReference.html#a096b8dde4fd2eb475acd376060940b02">SetWellKnownGeogCS</a>( <span class="stringliteral">"WGS84"</span> );</div> <div class="line">oSRS.<a class="code" href="classOGRSpatialReference.html#a596b8e527d66a5054408159f0006fdac">exportToWkt</a>( &pszWKT );</div> <div class="line">printf( <span class="stringliteral">"%s\n"</span>, pszWKT );</div> </div><!-- fragment --><p>gives something like:</p> <pre> GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563, AUTHORITY["EPSG",7030]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG",6326]], PRIMEM["Greenwich",0,AUTHORITY["EPSG",8901]],UNIT["DMSH",0.0174532925199433, AUTHORITY["EPSG",9108]],AXIS["Lat",NORTH],AXIS["Long",EAST],AUTHORITY["EPSG", 4326]] </pre><p>or in more readable form:</p> <pre> GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.257223563, AUTHORITY["EPSG",7030]], TOWGS84[0,0,0,0,0,0,0], AUTHORITY["EPSG",6326]], PRIMEM["Greenwich",0,AUTHORITY["EPSG",8901]], UNIT["DMSH",0.0174532925199433,AUTHORITY["EPSG",9108]], AXIS["Lat",NORTH], AXIS["Long",EAST], AUTHORITY["EPSG",4326]] </pre><p>The <a class="el" href="classOGRSpatialReference.html#ab74cfc985bd05404a4c61d2d633a6343" title="Import from WKT string. ">OGRSpatialReference::importFromWkt()</a> method can be used to set an <a class="el" href="classOGRSpatialReference.html">OGRSpatialReference</a> from a WKT coordinate system definition.</p> <h1><a class="anchor" id="osr_tutorial_proj"></a> Defining a Projected Coordinate System</h1> <p>A projected coordinate system (such as UTM, Lambert Conformal Conic, etc) requires and underlying geographic coordinate system as well as a definition for the projection transform used to translate between linear positions (in meters or feet) and angular long/lat positions. The following code defines a UTM zone 17 projected coordinate system with and underlying geographic coordinate system (datum) of WGS84.</p> <div class="fragment"><div class="line"><a class="code" href="classOGRSpatialReference.html">OGRSpatialReference</a> oSRS;</div> <div class="line"></div> <div class="line">oSRS.<a class="code" href="classOGRSpatialReference.html#a208118581246feb29646acf2ea5d4237">SetProjCS</a>( <span class="stringliteral">"UTM 17 (WGS84) in northern hemisphere."</span> );</div> <div class="line">oSRS.<a class="code" href="classOGRSpatialReference.html#a096b8dde4fd2eb475acd376060940b02">SetWellKnownGeogCS</a>( <span class="stringliteral">"WGS84"</span> );</div> <div class="line">oSRS.<a class="code" href="classOGRSpatialReference.html#a0c4f6fcab663c9eb6d465787cad3833c">SetUTM</a>( 17, TRUE );</div> </div><!-- fragment --><p>Calling SetProjCS() sets a user name for the projected coordinate system and establishes that the system is projected. The SetWellKnownGeogCS() associates a geographic coordinate system, and the SetUTM() call sets detailed projection transformation parameters. At this time the above order is important in order to create a valid definition, but in the future the object will automatically reorder the internal representation as needed to remain valid. For now <b>be careful of the order of steps defining an OGRSpatialReference!</b></p> <p>The above definition would give a WKT version that looks something like the following. Note that the UTM 17 was expanded into the details transverse mercator definition of the UTM zone.</p> <pre> PROJCS["UTM 17 (WGS84) in northern hemisphere.", GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.257223563, AUTHORITY["EPSG",7030]], TOWGS84[0,0,0,0,0,0,0], AUTHORITY["EPSG",6326]], PRIMEM["Greenwich",0,AUTHORITY["EPSG",8901]], UNIT["DMSH",0.0174532925199433,AUTHORITY["EPSG",9108]], AXIS["Lat",NORTH], AXIS["Long",EAST], AUTHORITY["EPSG",4326]], PROJECTION["Transverse_Mercator"], PARAMETER["latitude_of_origin",0], PARAMETER["central_meridian",-81], PARAMETER["scale_factor",0.9996], PARAMETER["false_easting",500000], PARAMETER["false_northing",0]] </pre><p>There are methods for many projection methods including SetTM() (Transverse Mercator), SetLCC() (Lambert Conformal Conic), and SetMercator().</p> <h1><a class="anchor" id="osr_tutorial_query"></a> Querying Coordinate System</h1> <p>Once an <a class="el" href="classOGRSpatialReference.html">OGRSpatialReference</a> has been established, various information about it can be queried. It can be established if it is a projected or geographic coordinate system using the <a class="el" href="classOGRSpatialReference.html#a1186e3473d7ac2f81ec2ca5d0c4ec027" title="Check if projected coordinate system. ">OGRSpatialReference::IsProjected()</a> and <a class="el" href="classOGRSpatialReference.html#a764ba5d91530ad721d78ac629c0eaba8" title="Check if geographic coordinate system. ">OGRSpatialReference::IsGeographic()</a> methods. The <a class="el" href="classOGRSpatialReference.html#ae4a85fc76fb96e5d253897d0589aea33" title="Get spheroid semi major axis. ">OGRSpatialReference::GetSemiMajor()</a>, <a class="el" href="classOGRSpatialReference.html#ae004d56063c3dedf18bc3a8c705deacb" title="Get spheroid semi minor axis. ">OGRSpatialReference::GetSemiMinor()</a> and <a class="el" href="classOGRSpatialReference.html#ab8e5f09148eb80ea4c8242d30591ba32" title="Get spheroid inverse flattening. ">OGRSpatialReference::GetInvFlattening()</a> methods can be used to get information about the spheroid. The <a class="el" href="classOGRSpatialReference.html#acc815e7bd21c1c052304368c0eefe8be" title="Fetch indicated attribute of named node. ">OGRSpatialReference::GetAttrValue()</a> method can be used to get the PROJCS, GEOGCS, DATUM, SPHEROID, and PROJECTION names strings. The <a class="el" href="classOGRSpatialReference.html#a603c654bc0616f26c9300b3c66952cdb" title="Fetch a projection parameter value. ">OGRSpatialReference::GetProjParm()</a> method can be used to get the projection parameters. The <a class="el" href="classOGRSpatialReference.html#af2821ab555a3bb2d6bb1df49d076a198" title="Fetch linear projection units. ">OGRSpatialReference::GetLinearUnits()</a> method can be used to fetch the linear units type, and translation to meters.</p> <p>The following code (from ogr_srs_proj4.cpp) demonstrates use of GetAttrValue() to get the projection, and GetProjParm() to get projection parameters. The GetAttrValue() method searches for the first "value" node associated with the named entry in the WKT text representation. The #define'ed constants for projection parameters (such as SRS_PP_CENTRAL_MERIDIAN) should be used when fetching projection parameter with GetProjParm(). The code for the Set methods of the various projections in ogrspatialreference.cpp can be consulted to find which parameters apply to which projections.</p> <div class="fragment"><div class="line"><span class="keyword">const</span> <span class="keywordtype">char</span> *pszProjection = poSRS-><a class="code" href="classOGRSpatialReference.html#acc815e7bd21c1c052304368c0eefe8be">GetAttrValue</a>(<span class="stringliteral">"PROJECTION"</span>);</div> <div class="line"></div> <div class="line"><span class="keywordflow">if</span>( pszProjection == NULL )</div> <div class="line">{</div> <div class="line"> <span class="keywordflow">if</span>( poSRS-><a class="code" href="classOGRSpatialReference.html#a764ba5d91530ad721d78ac629c0eaba8">IsGeographic</a>() )</div> <div class="line"> sprintf( szProj4+strlen(szProj4), <span class="stringliteral">"+proj=longlat "</span> );</div> <div class="line"> <span class="keywordflow">else</span></div> <div class="line"> sprintf( szProj4+strlen(szProj4), <span class="stringliteral">"unknown "</span> );</div> <div class="line">}</div> <div class="line"><span class="keywordflow">else</span> <span class="keywordflow">if</span>( EQUAL(pszProjection,SRS_PT_CYLINDRICAL_EQUAL_AREA) )</div> <div class="line">{</div> <div class="line"> sprintf( szProj4+strlen(szProj4),</div> <div class="line"> <span class="stringliteral">"+proj=cea +lon_0=%.9f +lat_ts=%.9f +x_0=%.3f +y_0=%.3f "</span>,</div> <div class="line"> poSRS-><a class="code" href="classOGRSpatialReference.html#a603c654bc0616f26c9300b3c66952cdb">GetProjParm</a>(SRS_PP_CENTRAL_MERIDIAN,0.0),</div> <div class="line"> poSRS-><a class="code" href="classOGRSpatialReference.html#a603c654bc0616f26c9300b3c66952cdb">GetProjParm</a>(SRS_PP_STANDARD_PARALLEL_1,0.0),</div> <div class="line"> poSRS-><a class="code" href="classOGRSpatialReference.html#a603c654bc0616f26c9300b3c66952cdb">GetProjParm</a>(SRS_PP_FALSE_EASTING,0.0),</div> <div class="line"> poSRS-><a class="code" href="classOGRSpatialReference.html#a603c654bc0616f26c9300b3c66952cdb">GetProjParm</a>(SRS_PP_FALSE_NORTHING,0.0) );</div> <div class="line">}</div> <div class="line">...</div> </div><!-- fragment --><h1><a class="anchor" id="osr_tutorial_transform"></a> Coordinate Transformation</h1> <p>The <a class="el" href="classOGRCoordinateTransformation.html">OGRCoordinateTransformation</a> class is used for translating positions between different coordinate systems. New transformation objects are created using <a class="el" href="ogr__spatialref_8h.html#aae11bd08e45cdb2e71e1d9c31f1e550f">OGRCreateCoordinateTransformation()</a>, and then the <a class="el" href="classOGRCoordinateTransformation.html#abf141396940b4f7b1f8118ea025d569b">OGRCoordinateTransformation::Transform()</a> method can be used to convert points between coordinate systems.</p> <div class="fragment"><div class="line"><a class="code" href="classOGRSpatialReference.html">OGRSpatialReference</a> oSourceSRS, oTargetSRS;</div> <div class="line"><a class="code" href="classOGRCoordinateTransformation.html">OGRCoordinateTransformation</a> *poCT;</div> <div class="line"><span class="keywordtype">double</span> x, y;</div> <div class="line"> </div> <div class="line">oSourceSRS.<a class="code" href="classOGRSpatialReference.html#a8a5b8c9a205eedc6b88a14aa0c219969">importFromEPSG</a>( atoi(papszArgv[i+1]) );</div> <div class="line">oTargetSRS.<a class="code" href="classOGRSpatialReference.html#a8a5b8c9a205eedc6b88a14aa0c219969">importFromEPSG</a>( atoi(papszArgv[i+2]) );</div> <div class="line"> </div> <div class="line">poCT = <a class="code" href="ogr__spatialref_8h.html#aae11bd08e45cdb2e71e1d9c31f1e550f">OGRCreateCoordinateTransformation</a>( &oSourceSRS,</div> <div class="line"> &oTargetSRS );</div> <div class="line">x = atof( papszArgv[i+3] );</div> <div class="line">y = atof( papszArgv[i+4] );</div> <div class="line"> </div> <div class="line"><span class="keywordflow">if</span>( poCT == NULL || !poCT-><a class="code" href="classOGRCoordinateTransformation.html#abf141396940b4f7b1f8118ea025d569b">Transform</a>( 1, &x, &y ) )</div> <div class="line"> printf( <span class="stringliteral">"Transformation failed.\n"</span> );</div> <div class="line"><span class="keywordflow">else</span></div> <div class="line"> printf( <span class="stringliteral">"(%f,%f) -> (%f,%f)\n"</span>, </div> <div class="line"> atof( papszArgv[i+3] ),</div> <div class="line"> atof( papszArgv[i+4] ),</div> <div class="line"> x, y );</div> </div><!-- fragment --><p>There are a couple of points at which transformations can fail. First, <a class="el" href="ogr__spatialref_8h.html#aae11bd08e45cdb2e71e1d9c31f1e550f">OGRCreateCoordinateTransformation()</a> may fail, generally because the internals recognise that no transformation between the indicated systems can be established. This might be due to use of a projection not supported by the internal PROJ.4 library, differing datums for which no relationship is known, or one of the coordinate systems being inadequately defined. If <a class="el" href="ogr__spatialref_8h.html#aae11bd08e45cdb2e71e1d9c31f1e550f">OGRCreateCoordinateTransformation()</a> fails it will return a NULL.</p> <p>The <a class="el" href="classOGRCoordinateTransformation.html#abf141396940b4f7b1f8118ea025d569b">OGRCoordinateTransformation::Transform()</a> method itself can also fail. This may be as a delayed result of one of the above problems, or as a result of an operation being numerically undefined for one or more of the passed in points. The Transform() function will return TRUE on success, or FALSE if any of the points fail to transform. The point array is left in an indeterminate state on error.</p> <p>Though not shown above, the coordinate transformation service can take 3D points, and will adjust elevations for elevation differents in spheroids, and datums. At some point in the future shifts between different vertical datums may also be applied. If no Z is passed, it is assume that the point is on the geoide.</p> <p>The following example shows how to conveniently create a lat/long coordinate system using the same geographic coordinate system as a projected coordinate system, and using that to transform between projected coordinates and lat/long.</p> <div class="fragment"><div class="line"><a class="code" href="classOGRSpatialReference.html">OGRSpatialReference</a> oUTM, *poLatLong;</div> <div class="line"><a class="code" href="classOGRCoordinateTransformation.html">OGRCoordinateTransformation</a> *poTransform;</div> <div class="line"></div> <div class="line">oUTM.<a class="code" href="classOGRSpatialReference.html#a208118581246feb29646acf2ea5d4237">SetProjCS</a>(<span class="stringliteral">"UTM 17 / WGS84"</span>);</div> <div class="line">oUTM.<a class="code" href="classOGRSpatialReference.html#a096b8dde4fd2eb475acd376060940b02">SetWellKnownGeogCS</a>( <span class="stringliteral">"WGS84"</span> );</div> <div class="line">oUTM.<a class="code" href="classOGRSpatialReference.html#a0c4f6fcab663c9eb6d465787cad3833c">SetUTM</a>( 17 );</div> <div class="line"></div> <div class="line">poLatLong = oUTM.<a class="code" href="classOGRSpatialReference.html#a0c1e2b108255487f91ae448f5c11f67c">CloneGeogCS</a>();</div> <div class="line"></div> <div class="line">poTransform = <a class="code" href="ogr__spatialref_8h.html#aae11bd08e45cdb2e71e1d9c31f1e550f">OGRCreateCoordinateTransformation</a>( &oUTM, poLatLong );</div> <div class="line"><span class="keywordflow">if</span>( poTransform == NULL )</div> <div class="line">{</div> <div class="line"> ...</div> <div class="line">}</div> <div class="line"></div> <div class="line">...</div> <div class="line"></div> <div class="line">if( !poTransform-><a class="code" href="classOGRCoordinateTransformation.html#abf141396940b4f7b1f8118ea025d569b">Transform</a>( nPoints, x, y, z ) )</div> <div class="line">...</div> </div><!-- fragment --><h1><a class="anchor" id="osr_tutorial_apis"></a> Alternate Interfaces</h1> <p>A C interface to the coordinate system services is defined in <a class="el" href="ogr__srs__api_8h.html">ogr_srs_api.h</a>, and Python bindings are available via the osr.py module. Methods are close analogs of the C++ methods but C and Python bindings are missing for some C++ methods.</p> <h3>C Bindings</h3> <div class="fragment"><div class="line"><span class="keyword">typedef</span> <span class="keywordtype">void</span> *OGRSpatialReferenceH; </div> <div class="line"><span class="keyword">typedef</span> <span class="keywordtype">void</span> *OGRCoordinateTransformationH;</div> <div class="line"></div> <div class="line">OGRSpatialReferenceH <a class="code" href="ogr__srs__api_8h.html#a6bfe88d5f18f2a8705f9e7a9586b795e">OSRNewSpatialReference</a>( <span class="keyword">const</span> <span class="keywordtype">char</span> * );</div> <div class="line"><span class="keywordtype">void</span> <a class="code" href="ogr__srs__api_8h.html#ac33dd704ea2730dd2490b2864f333cb4">OSRDestroySpatialReference</a>( OGRSpatialReferenceH );</div> <div class="line"></div> <div class="line"><span class="keywordtype">int</span> <a class="code" href="ogr__srs__api_8h.html#a836d17c587f924446f3734f600758c6d">OSRReference</a>( OGRSpatialReferenceH );</div> <div class="line"><span class="keywordtype">int</span> <a class="code" href="ogr__srs__api_8h.html#aae579eb4bdb653ead302a2850921ac77">OSRDereference</a>( OGRSpatialReferenceH );</div> <div class="line"></div> <div class="line">OGRErr <a class="code" href="ogr__srs__api_8h.html#ab23438fe9126b3c99f7f7cd863e29fb6">OSRImportFromEPSG</a>( OGRSpatialReferenceH, <span class="keywordtype">int</span> );</div> <div class="line">OGRErr <a class="code" href="ogr__srs__api_8h.html#a37a167850021c64dfec606e24a1c1e71">OSRImportFromWkt</a>( OGRSpatialReferenceH, <span class="keywordtype">char</span> ** );</div> <div class="line">OGRErr <a class="code" href="ogr__srs__api_8h.html#a92d97dc5f5d09d76310b143f86b0f101">OSRExportToWkt</a>( OGRSpatialReferenceH, <span class="keywordtype">char</span> ** );</div> <div class="line"></div> <div class="line">OGRErr <a class="code" href="ogr__srs__api_8h.html#a40a2857dd60284586bc73518cb413ce7">OSRSetAttrValue</a>( OGRSpatialReferenceH hSRS, <span class="keyword">const</span> <span class="keywordtype">char</span> * pszNodePath,</div> <div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> * pszNewNodeValue );</div> <div class="line"><span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="ogr__srs__api_8h.html#a45e7200fc05f3793d3605873d9bf80d0">OSRGetAttrValue</a>( OGRSpatialReferenceH hSRS,</div> <div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> * pszName, <span class="keywordtype">int</span> iChild);</div> <div class="line"></div> <div class="line">OGRErr <a class="code" href="ogr__srs__api_8h.html#acc2efa6fe8385be92cd900a795332809">OSRSetLinearUnits</a>( OGRSpatialReferenceH, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keywordtype">double</span> );</div> <div class="line"><span class="keywordtype">double</span> <a class="code" href="ogr__srs__api_8h.html#a4ac8ada088020302ac565ebe00378ab9">OSRGetLinearUnits</a>( OGRSpatialReferenceH, <span class="keywordtype">char</span> ** );</div> <div class="line"></div> <div class="line"><span class="keywordtype">int</span> <a class="code" href="ogr__srs__api_8h.html#ae1f16b6ec2c99eb83352617c0082567d">OSRIsGeographic</a>( OGRSpatialReferenceH );</div> <div class="line"><span class="keywordtype">int</span> <a class="code" href="ogr__srs__api_8h.html#a7242007d0275ba5b0e2852206f31ec57">OSRIsProjected</a>( OGRSpatialReferenceH );</div> <div class="line"><span class="keywordtype">int</span> <a class="code" href="ogr__srs__api_8h.html#a8dc40ce571af8458fcb341e59a609ec6">OSRIsSameGeogCS</a>( OGRSpatialReferenceH, OGRSpatialReferenceH );</div> <div class="line"><span class="keywordtype">int</span> <a class="code" href="ogr__srs__api_8h.html#a1ed028fcf261df10fabf7369213c4fbf">OSRIsSame</a>( OGRSpatialReferenceH, OGRSpatialReferenceH );</div> <div class="line"></div> <div class="line">OGRErr <a class="code" href="ogr__srs__api_8h.html#a7b2a27d374690edb672a15fba6299102">OSRSetProjCS</a>( OGRSpatialReferenceH hSRS, <span class="keyword">const</span> <span class="keywordtype">char</span> * pszName );</div> <div class="line">OGRErr <a class="code" href="ogr__srs__api_8h.html#a2384a6dfde010f936aa7890c68cc7790">OSRSetWellKnownGeogCS</a>( OGRSpatialReferenceH hSRS,</div> <div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> * pszName );</div> <div class="line"></div> <div class="line">OGRErr <a class="code" href="ogr__srs__api_8h.html#a1ffa26c69dd884be497a71e3fb961e1c">OSRSetGeogCS</a>( OGRSpatialReferenceH hSRS,</div> <div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> * pszGeogName,</div> <div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> * pszDatumName,</div> <div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> * pszEllipsoidName,</div> <div class="line"> <span class="keywordtype">double</span> dfSemiMajor, <span class="keywordtype">double</span> dfInvFlattening,</div> <div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> * pszPMName ,</div> <div class="line"> <span class="keywordtype">double</span> dfPMOffset ,</div> <div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> * pszUnits,</div> <div class="line"> <span class="keywordtype">double</span> dfConvertToRadians );</div> <div class="line"></div> <div class="line"><span class="keywordtype">double</span> <a class="code" href="ogr__srs__api_8h.html#aa7f8b84bb6d99e04f362ae1b2590ca33">OSRGetSemiMajor</a>( OGRSpatialReferenceH, OGRErr * );</div> <div class="line"><span class="keywordtype">double</span> <a class="code" href="ogr__srs__api_8h.html#a432e4d2fb6ac0bff03d9e0777cebe258">OSRGetSemiMinor</a>( OGRSpatialReferenceH, OGRErr * );</div> <div class="line"><span class="keywordtype">double</span> <a class="code" href="ogr__srs__api_8h.html#a79746a1da88d9a7e41557df82165c08a">OSRGetInvFlattening</a>( OGRSpatialReferenceH, OGRErr * );</div> <div class="line"></div> <div class="line">OGRErr <a class="code" href="ogr__srs__api_8h.html#aca458410eee98928c4a245cdef242f6e">OSRSetAuthority</a>( OGRSpatialReferenceH hSRS,</div> <div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> * pszTargetKey,</div> <div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> * pszAuthority,</div> <div class="line"> <span class="keywordtype">int</span> nCode );</div> <div class="line">OGRErr <a class="code" href="ogr__srs__api_8h.html#a4d5e808bb57731e36da56626f48d1626">OSRSetProjParm</a>( OGRSpatialReferenceH, <span class="keyword">const</span> <span class="keywordtype">char</span> *, <span class="keywordtype">double</span> );</div> <div class="line"><span class="keywordtype">double</span> <a class="code" href="ogr__srs__api_8h.html#aee052050fbdf32fb5a1a0bfa9cad9bfc">OSRGetProjParm</a>( OGRSpatialReferenceH hSRS,</div> <div class="line"> <span class="keyword">const</span> <span class="keywordtype">char</span> * pszParmName, </div> <div class="line"> <span class="keywordtype">double</span> dfDefault,</div> <div class="line"> OGRErr * );</div> <div class="line"></div> <div class="line">OGRErr <a class="code" href="ogr__srs__api_8h.html#ad176f04d7b43e91e8aaf78d6f94082ab">OSRSetUTM</a>( OGRSpatialReferenceH hSRS, <span class="keywordtype">int</span> nZone, <span class="keywordtype">int</span> bNorth );</div> <div class="line"><span class="keywordtype">int</span> <a class="code" href="ogr__srs__api_8h.html#ad21364295012631454ff6bdbfd8cd48e">OSRGetUTMZone</a>( OGRSpatialReferenceH hSRS, <span class="keywordtype">int</span> *pbNorth );</div> <div class="line"></div> <div class="line">OGRCoordinateTransformationH</div> <div class="line"><a class="code" href="ogr__srs__api_8h.html#ad2ed8981c5017374cf9c0f9424667e3c">OCTNewCoordinateTransformation</a>( OGRSpatialReferenceH hSourceSRS,</div> <div class="line"> OGRSpatialReferenceH hTargetSRS );</div> <div class="line"><span class="keywordtype">void</span> <a class="code" href="ogr__srs__api_8h.html#a3477f1077954050ea96c028333120082">OCTDestroyCoordinateTransformation</a>( OGRCoordinateTransformationH );</div> <div class="line"></div> <div class="line"><span class="keywordtype">int</span> OCTTransform( OGRCoordinateTransformationH hCT,</div> <div class="line"> <span class="keywordtype">int</span> nCount, <span class="keywordtype">double</span> *x, <span class="keywordtype">double</span> *y, <span class="keywordtype">double</span> *z );</div> </div><!-- fragment --><h3>Python Bindings</h3> <div class="fragment"><div class="line"><span class="keyword">class </span>osr.SpatialReference</div> <div class="line"> def __init__(self,obj=None):</div> <div class="line"> def ImportFromWkt( <span class="keyword">self</span>, wkt ):</div> <div class="line"> def ExportToWkt(self):</div> <div class="line"> def ImportFromEPSG(self,code):</div> <div class="line"> def IsGeographic(self):</div> <div class="line"> def IsProjected(self):</div> <div class="line"> def GetAttrValue(self, name, child = 0):</div> <div class="line"> def SetAttrValue(self, name, value):</div> <div class="line"> def SetWellKnownGeogCS(self, name):</div> <div class="line"> def SetProjCS(self, name = <span class="stringliteral">"unnamed"</span> ):</div> <div class="line"> def IsSameGeogCS(self, other):</div> <div class="line"> def IsSame(self, other):</div> <div class="line"> def SetLinearUnits(self, units_name, to_meters ):</div> <div class="line"> def SetUTM(self, zone, is_north = 1):</div> <div class="line"></div> <div class="line">class CoordinateTransformation:</div> <div class="line"> def __init__(self,source,target):</div> <div class="line"> def TransformPoint(self, x, y, z = 0):</div> <div class="line"> def TransformPoints(self, points):</div> </div><!-- fragment --><h1><a class="anchor" id="osr_tutorial_impl"></a> Internal Implementation</h1> <p>The <a class="el" href="classOGRCoordinateTransformation.html">OGRCoordinateTransformation</a> service is implemented on top of the <a href="http://www.remotesensing.org/proj">PROJ.4</a> library originally written by Gerald Evenden of the USGS. </p> </div></div><!-- contents --> <hr> Generated for GDAL by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.8.5. </body> </html>