ogr_spatialref.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633
  1. /******************************************************************************
  2. * $Id: ogr_spatialref.h 28972 2015-04-22 10:39:11Z rouault $
  3. *
  4. * Project: OpenGIS Simple Features Reference Implementation
  5. * Purpose: Classes for manipulating spatial reference systems in a
  6. * platform non-specific manner.
  7. * Author: Frank Warmerdam, warmerdam@pobox.com
  8. *
  9. ******************************************************************************
  10. * Copyright (c) 1999, Les Technologies SoftMap Inc.
  11. * Copyright (c) 2008-2013, Even Rouault <even dot rouault at mines-paris dot org>
  12. *
  13. * Permission is hereby granted, free of charge, to any person obtaining a
  14. * copy of this software and associated documentation files (the "Software"),
  15. * to deal in the Software without restriction, including without limitation
  16. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  17. * and/or sell copies of the Software, and to permit persons to whom the
  18. * Software is furnished to do so, subject to the following conditions:
  19. *
  20. * The above copyright notice and this permission notice shall be included
  21. * in all copies or substantial portions of the Software.
  22. *
  23. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  24. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  25. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  26. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  27. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  28. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  29. * DEALINGS IN THE SOFTWARE.
  30. ****************************************************************************/
  31. #ifndef _OGR_SPATIALREF_H_INCLUDED
  32. #define _OGR_SPATIALREF_H_INCLUDED
  33. #include "ogr_srs_api.h"
  34. /**
  35. * \file ogr_spatialref.h
  36. *
  37. * Coordinate systems services.
  38. */
  39. /************************************************************************/
  40. /* OGR_SRSNode */
  41. /************************************************************************/
  42. /**
  43. * Objects of this class are used to represent value nodes in the parsed
  44. * representation of the WKT SRS format. For instance UNIT["METER",1]
  45. * would be rendered into three OGR_SRSNodes. The root node would have a
  46. * value of UNIT, and two children, the first with a value of METER, and the
  47. * second with a value of 1.
  48. *
  49. * Normally application code just interacts with the OGRSpatialReference
  50. * object, which uses the OGR_SRSNode to implement it's data structure;
  51. * however, this class is user accessable for detailed access to components
  52. * of an SRS definition.
  53. */
  54. class CPL_DLL OGR_SRSNode
  55. {
  56. char *pszValue;
  57. OGR_SRSNode **papoChildNodes;
  58. OGR_SRSNode *poParent;
  59. int nChildren;
  60. int NeedsQuoting() const;
  61. OGRErr importFromWkt( char **, int nRecLevel, int* pnNodes );
  62. public:
  63. OGR_SRSNode(const char * = NULL);
  64. ~OGR_SRSNode();
  65. int IsLeafNode() const { return nChildren == 0; }
  66. int GetChildCount() const { return nChildren; }
  67. OGR_SRSNode *GetChild( int );
  68. const OGR_SRSNode *GetChild( int ) const;
  69. OGR_SRSNode *GetNode( const char * );
  70. const OGR_SRSNode *GetNode( const char * ) const;
  71. void InsertChild( OGR_SRSNode *, int );
  72. void AddChild( OGR_SRSNode * );
  73. int FindChild( const char * ) const;
  74. void DestroyChild( int );
  75. void ClearChildren();
  76. void StripNodes( const char * );
  77. const char *GetValue() const { return pszValue; }
  78. void SetValue( const char * );
  79. void MakeValueSafe();
  80. OGRErr FixupOrdering();
  81. OGR_SRSNode *Clone() const;
  82. OGRErr importFromWkt( char ** );
  83. OGRErr exportToWkt( char ** ) const;
  84. OGRErr exportToPrettyWkt( char **, int = 1) const;
  85. OGRErr applyRemapper( const char *pszNode,
  86. char **papszSrcValues,
  87. char **papszDstValues,
  88. int nStepSize = 1,
  89. int bChildOfHit = FALSE );
  90. };
  91. /************************************************************************/
  92. /* OGRSpatialReference */
  93. /************************************************************************/
  94. /**
  95. * This class respresents a OpenGIS Spatial Reference System, and contains
  96. * methods for converting between this object organization and well known
  97. * text (WKT) format. This object is reference counted as one instance of
  98. * the object is normally shared between many OGRGeometry objects.
  99. *
  100. * Normally application code can fetch needed parameter values for this
  101. * SRS using GetAttrValue(), but in special cases the underlying parse tree
  102. * (or OGR_SRSNode objects) can be accessed more directly.
  103. *
  104. * See <a href="osr_tutorial.html">the tutorial</a> for more information on
  105. * how to use this class.
  106. */
  107. class CPL_DLL OGRSpatialReference
  108. {
  109. double dfFromGreenwich;
  110. double dfToMeter;
  111. double dfToDegrees;
  112. OGR_SRSNode *poRoot;
  113. int nRefCount;
  114. int bNormInfoSet;
  115. static OGRErr Validate(OGR_SRSNode *poRoot);
  116. static OGRErr ValidateAuthority(OGR_SRSNode *poRoot);
  117. static OGRErr ValidateAxis(OGR_SRSNode *poRoot);
  118. static OGRErr ValidateUnit(OGR_SRSNode *poRoot);
  119. static OGRErr ValidateVertDatum(OGR_SRSNode *poRoot);
  120. static OGRErr ValidateProjection( OGR_SRSNode* poRoot );
  121. static int IsAliasFor( const char *, const char * );
  122. void GetNormInfo() const;
  123. OGRErr importFromURNPart(const char* pszAuthority,
  124. const char* pszCode,
  125. const char* pszURN);
  126. public:
  127. OGRSpatialReference(const OGRSpatialReference&);
  128. OGRSpatialReference(const char * = NULL);
  129. virtual ~OGRSpatialReference();
  130. static void DestroySpatialReference(OGRSpatialReference* poSRS);
  131. OGRSpatialReference &operator=(const OGRSpatialReference&);
  132. int Reference();
  133. int Dereference();
  134. int GetReferenceCount() const { return nRefCount; }
  135. void Release();
  136. OGRSpatialReference *Clone() const;
  137. OGRSpatialReference *CloneGeogCS() const;
  138. void dumpReadable();
  139. OGRErr exportToWkt( char ** ) const;
  140. OGRErr exportToPrettyWkt( char **, int = FALSE) const;
  141. OGRErr exportToProj4( char ** ) const;
  142. OGRErr exportToPCI( char **, char **, double ** ) const;
  143. OGRErr exportToUSGS( long *, long *, double **, long * ) const;
  144. OGRErr exportToXML( char **, const char * = NULL ) const;
  145. OGRErr exportToPanorama( long *, long *, long *, long *,
  146. double * ) const;
  147. OGRErr exportToERM( char *pszProj, char *pszDatum, char *pszUnits );
  148. OGRErr exportToMICoordSys( char ** ) const;
  149. OGRErr importFromWkt( char ** );
  150. OGRErr importFromProj4( const char * );
  151. OGRErr importFromEPSG( int );
  152. OGRErr importFromEPSGA( int );
  153. OGRErr importFromESRI( char ** );
  154. OGRErr importFromPCI( const char *, const char * = NULL,
  155. double * = NULL );
  156. #define USGS_ANGLE_DECIMALDEGREES 0
  157. #define USGS_ANGLE_PACKEDDMS TRUE /* 1 */
  158. #define USGS_ANGLE_RADIANS 2
  159. OGRErr importFromUSGS( long iProjSys, long iZone,
  160. double *padfPrjParams, long iDatum,
  161. int nUSGSAngleFormat = USGS_ANGLE_PACKEDDMS );
  162. OGRErr importFromPanorama( long, long, long, double* );
  163. OGRErr importFromOzi( const char * const* papszLines );
  164. OGRErr importFromWMSAUTO( const char *pszAutoDef );
  165. OGRErr importFromXML( const char * );
  166. OGRErr importFromDict( const char *pszDict, const char *pszCode );
  167. OGRErr importFromURN( const char * );
  168. OGRErr importFromCRSURL( const char * );
  169. OGRErr importFromERM( const char *pszProj, const char *pszDatum,
  170. const char *pszUnits );
  171. OGRErr importFromUrl( const char * );
  172. OGRErr importFromMICoordSys( const char * );
  173. OGRErr morphToESRI();
  174. OGRErr morphFromESRI();
  175. OGRErr Validate();
  176. OGRErr StripCTParms( OGR_SRSNode * = NULL );
  177. OGRErr StripVertical();
  178. OGRErr FixupOrdering();
  179. OGRErr Fixup();
  180. int EPSGTreatsAsLatLong();
  181. int EPSGTreatsAsNorthingEasting();
  182. const char *GetAxis( const char *pszTargetKey, int iAxis,
  183. OGRAxisOrientation *peOrientation ) const;
  184. OGRErr SetAxes( const char *pszTargetKey,
  185. const char *pszXAxisName,
  186. OGRAxisOrientation eXAxisOrientation,
  187. const char *pszYAxisName,
  188. OGRAxisOrientation eYAxisOrientation );
  189. // Machinary for accessing parse nodes
  190. OGR_SRSNode *GetRoot() { return poRoot; }
  191. const OGR_SRSNode *GetRoot() const { return poRoot; }
  192. void SetRoot( OGR_SRSNode * );
  193. OGR_SRSNode *GetAttrNode(const char *);
  194. const OGR_SRSNode *GetAttrNode(const char *) const;
  195. const char *GetAttrValue(const char *, int = 0) const;
  196. OGRErr SetNode( const char *, const char * );
  197. OGRErr SetNode( const char *, double );
  198. OGRErr SetLinearUnitsAndUpdateParameters( const char *pszName,
  199. double dfInMeters );
  200. OGRErr SetLinearUnits( const char *pszName, double dfInMeters );
  201. OGRErr SetTargetLinearUnits( const char *pszTargetKey,
  202. const char *pszName, double dfInMeters );
  203. double GetLinearUnits( char ** = NULL ) const;
  204. double GetTargetLinearUnits( const char *pszTargetKey,
  205. char ** ppszRetName = NULL ) const;
  206. OGRErr SetAngularUnits( const char *pszName, double dfInRadians );
  207. double GetAngularUnits( char ** = NULL ) const;
  208. double GetPrimeMeridian( char ** = NULL ) const;
  209. int IsGeographic() const;
  210. int IsProjected() const;
  211. int IsGeocentric() const;
  212. int IsLocal() const;
  213. int IsVertical() const;
  214. int IsCompound() const;
  215. int IsSameGeogCS( const OGRSpatialReference * ) const;
  216. int IsSameVertCS( const OGRSpatialReference * ) const;
  217. int IsSame( const OGRSpatialReference * ) const;
  218. void Clear();
  219. OGRErr SetLocalCS( const char * );
  220. OGRErr SetProjCS( const char * );
  221. OGRErr SetProjection( const char * );
  222. OGRErr SetGeocCS( const char * pszGeocName );
  223. OGRErr SetGeogCS( const char * pszGeogName,
  224. const char * pszDatumName,
  225. const char * pszEllipsoidName,
  226. double dfSemiMajor, double dfInvFlattening,
  227. const char * pszPMName = NULL,
  228. double dfPMOffset = 0.0,
  229. const char * pszUnits = NULL,
  230. double dfConvertToRadians = 0.0 );
  231. OGRErr SetWellKnownGeogCS( const char * );
  232. OGRErr CopyGeogCSFrom( const OGRSpatialReference * poSrcSRS );
  233. OGRErr SetVertCS( const char *pszVertCSName,
  234. const char *pszVertDatumName,
  235. int nVertDatumClass = 2005 );
  236. OGRErr SetCompoundCS( const char *pszName,
  237. const OGRSpatialReference *poHorizSRS,
  238. const OGRSpatialReference *poVertSRS );
  239. OGRErr SetFromUserInput( const char * );
  240. OGRErr SetTOWGS84( double, double, double,
  241. double = 0.0, double = 0.0, double = 0.0,
  242. double = 0.0 );
  243. OGRErr GetTOWGS84( double *padfCoef, int nCoeff = 7 ) const;
  244. double GetSemiMajor( OGRErr * = NULL ) const;
  245. double GetSemiMinor( OGRErr * = NULL ) const;
  246. double GetInvFlattening( OGRErr * = NULL ) const;
  247. OGRErr SetAuthority( const char * pszTargetKey,
  248. const char * pszAuthority,
  249. int nCode );
  250. OGRErr AutoIdentifyEPSG();
  251. int GetEPSGGeogCS();
  252. const char *GetAuthorityCode( const char * pszTargetKey ) const;
  253. const char *GetAuthorityName( const char * pszTargetKey ) const;
  254. const char *GetExtension( const char *pszTargetKey,
  255. const char *pszName,
  256. const char *pszDefault = NULL ) const;
  257. OGRErr SetExtension( const char *pszTargetKey,
  258. const char *pszName,
  259. const char *pszValue );
  260. int FindProjParm( const char *pszParameter,
  261. const OGR_SRSNode *poPROJCS=NULL ) const;
  262. OGRErr SetProjParm( const char *, double );
  263. double GetProjParm( const char *, double =0.0, OGRErr* = NULL ) const;
  264. OGRErr SetNormProjParm( const char *, double );
  265. double GetNormProjParm( const char *, double=0.0, OGRErr* =NULL)const;
  266. static int IsAngularParameter( const char * );
  267. static int IsLongitudeParameter( const char * );
  268. static int IsLinearParameter( const char * );
  269. /** Albers Conic Equal Area */
  270. OGRErr SetACEA( double dfStdP1, double dfStdP2,
  271. double dfCenterLat, double dfCenterLong,
  272. double dfFalseEasting, double dfFalseNorthing );
  273. /** Azimuthal Equidistant */
  274. OGRErr SetAE( double dfCenterLat, double dfCenterLong,
  275. double dfFalseEasting, double dfFalseNorthing );
  276. /** Bonne */
  277. OGRErr SetBonne( double dfStdP1, double dfCentralMeridian,
  278. double dfFalseEasting, double dfFalseNorthing );
  279. /** Cylindrical Equal Area */
  280. OGRErr SetCEA( double dfStdP1, double dfCentralMeridian,
  281. double dfFalseEasting, double dfFalseNorthing );
  282. /** Cassini-Soldner */
  283. OGRErr SetCS( double dfCenterLat, double dfCenterLong,
  284. double dfFalseEasting, double dfFalseNorthing );
  285. /** Equidistant Conic */
  286. OGRErr SetEC( double dfStdP1, double dfStdP2,
  287. double dfCenterLat, double dfCenterLong,
  288. double dfFalseEasting, double dfFalseNorthing );
  289. /** Eckert I-VI */
  290. OGRErr SetEckert( int nVariation, double dfCentralMeridian,
  291. double dfFalseEasting, double dfFalseNorthing );
  292. OGRErr SetEckertIV( double dfCentralMeridian,
  293. double dfFalseEasting, double dfFalseNorthing );
  294. OGRErr SetEckertVI( double dfCentralMeridian,
  295. double dfFalseEasting, double dfFalseNorthing );
  296. /** Equirectangular */
  297. OGRErr SetEquirectangular(double dfCenterLat, double dfCenterLong,
  298. double dfFalseEasting, double dfFalseNorthing );
  299. /** Equirectangular generalized form : */
  300. OGRErr SetEquirectangular2( double dfCenterLat, double dfCenterLong,
  301. double dfPseudoStdParallel1,
  302. double dfFalseEasting, double dfFalseNorthing );
  303. /** Geostationary Satellite */
  304. OGRErr SetGEOS( double dfCentralMeridian, double dfSatelliteHeight,
  305. double dfFalseEasting, double dfFalseNorthing );
  306. /** Goode Homolosine */
  307. OGRErr SetGH( double dfCentralMeridian,
  308. double dfFalseEasting, double dfFalseNorthing );
  309. /** Interrupted Goode Homolosine */
  310. OGRErr SetIGH();
  311. /** Gall Stereograpic */
  312. OGRErr SetGS( double dfCentralMeridian,
  313. double dfFalseEasting, double dfFalseNorthing );
  314. /** Gauss Schreiber Transverse Mercator */
  315. OGRErr SetGaussSchreiberTMercator(double dfCenterLat, double dfCenterLong,
  316. double dfScale,
  317. double dfFalseEasting, double dfFalseNorthing );
  318. /** Gnomonic */
  319. OGRErr SetGnomonic(double dfCenterLat, double dfCenterLong,
  320. double dfFalseEasting, double dfFalseNorthing );
  321. /** Hotine Oblique Mercator */
  322. OGRErr SetHOM( double dfCenterLat, double dfCenterLong,
  323. double dfAzimuth, double dfRectToSkew,
  324. double dfScale,
  325. double dfFalseEasting, double dfFalseNorthing );
  326. OGRErr SetHOM2PNO( double dfCenterLat,
  327. double dfLat1, double dfLong1,
  328. double dfLat2, double dfLong2,
  329. double dfScale,
  330. double dfFalseEasting, double dfFalseNorthing );
  331. OGRErr SetOM( double dfCenterLat, double dfCenterLong,
  332. double dfAzimuth, double dfRectToSkew,
  333. double dfScale,
  334. double dfFalseEasting, double dfFalseNorthing );
  335. /** Hotine Oblique Mercator Azimuth Center / Variant B */
  336. OGRErr SetHOMAC( double dfCenterLat, double dfCenterLong,
  337. double dfAzimuth, double dfRectToSkew,
  338. double dfScale,
  339. double dfFalseEasting, double dfFalseNorthing );
  340. /** International Map of the World Polyconic */
  341. OGRErr SetIWMPolyconic( double dfLat1, double dfLat2,
  342. double dfCenterLong,
  343. double dfFalseEasting,
  344. double dfFalseNorthing );
  345. /** Krovak Oblique Conic Conformal */
  346. OGRErr SetKrovak( double dfCenterLat, double dfCenterLong,
  347. double dfAzimuth, double dfPseudoStdParallelLat,
  348. double dfScale,
  349. double dfFalseEasting, double dfFalseNorthing );
  350. /** Lambert Azimuthal Equal-Area */
  351. OGRErr SetLAEA( double dfCenterLat, double dfCenterLong,
  352. double dfFalseEasting, double dfFalseNorthing );
  353. /** Lambert Conformal Conic */
  354. OGRErr SetLCC( double dfStdP1, double dfStdP2,
  355. double dfCenterLat, double dfCenterLong,
  356. double dfFalseEasting, double dfFalseNorthing );
  357. /** Lambert Conformal Conic 1SP */
  358. OGRErr SetLCC1SP( double dfCenterLat, double dfCenterLong,
  359. double dfScale,
  360. double dfFalseEasting, double dfFalseNorthing );
  361. /** Lambert Conformal Conic (Belgium) */
  362. OGRErr SetLCCB( double dfStdP1, double dfStdP2,
  363. double dfCenterLat, double dfCenterLong,
  364. double dfFalseEasting, double dfFalseNorthing );
  365. /** Miller Cylindrical */
  366. OGRErr SetMC( double dfCenterLat, double dfCenterLong,
  367. double dfFalseEasting, double dfFalseNorthing );
  368. /** Mercator */
  369. OGRErr SetMercator( double dfCenterLat, double dfCenterLong,
  370. double dfScale,
  371. double dfFalseEasting, double dfFalseNorthing );
  372. OGRErr SetMercator2SP( double dfStdP1,
  373. double dfCenterLat, double dfCenterLong,
  374. double dfFalseEasting, double dfFalseNorthing );
  375. /** Mollweide */
  376. OGRErr SetMollweide( double dfCentralMeridian,
  377. double dfFalseEasting, double dfFalseNorthing );
  378. /** New Zealand Map Grid */
  379. OGRErr SetNZMG( double dfCenterLat, double dfCenterLong,
  380. double dfFalseEasting, double dfFalseNorthing );
  381. /** Oblique Stereographic */
  382. OGRErr SetOS( double dfOriginLat, double dfCMeridian,
  383. double dfScale,
  384. double dfFalseEasting,double dfFalseNorthing);
  385. /** Orthographic */
  386. OGRErr SetOrthographic( double dfCenterLat, double dfCenterLong,
  387. double dfFalseEasting,double dfFalseNorthing);
  388. /** Polyconic */
  389. OGRErr SetPolyconic( double dfCenterLat, double dfCenterLong,
  390. double dfFalseEasting, double dfFalseNorthing );
  391. /** Polar Stereographic */
  392. OGRErr SetPS( double dfCenterLat, double dfCenterLong,
  393. double dfScale,
  394. double dfFalseEasting, double dfFalseNorthing);
  395. /** Robinson */
  396. OGRErr SetRobinson( double dfCenterLong,
  397. double dfFalseEasting, double dfFalseNorthing );
  398. /** Sinusoidal */
  399. OGRErr SetSinusoidal( double dfCenterLong,
  400. double dfFalseEasting, double dfFalseNorthing );
  401. /** Stereographic */
  402. OGRErr SetStereographic( double dfCenterLat, double dfCenterLong,
  403. double dfScale,
  404. double dfFalseEasting,double dfFalseNorthing);
  405. /** Swiss Oblique Cylindrical */
  406. OGRErr SetSOC( double dfLatitudeOfOrigin, double dfCentralMeridian,
  407. double dfFalseEasting, double dfFalseNorthing );
  408. /** Transverse Mercator */
  409. OGRErr SetTM( double dfCenterLat, double dfCenterLong,
  410. double dfScale,
  411. double dfFalseEasting, double dfFalseNorthing );
  412. /** Transverse Mercator variants. */
  413. OGRErr SetTMVariant( const char *pszVariantName,
  414. double dfCenterLat, double dfCenterLong,
  415. double dfScale,
  416. double dfFalseEasting, double dfFalseNorthing );
  417. /** Tunesia Mining Grid */
  418. OGRErr SetTMG( double dfCenterLat, double dfCenterLong,
  419. double dfFalseEasting, double dfFalseNorthing );
  420. /** Transverse Mercator (South Oriented) */
  421. OGRErr SetTMSO( double dfCenterLat, double dfCenterLong,
  422. double dfScale,
  423. double dfFalseEasting, double dfFalseNorthing );
  424. /** Two Point Equidistant */
  425. OGRErr SetTPED( double dfLat1, double dfLong1,
  426. double dfLat2, double dfLong2,
  427. double dfFalseEasting, double dfFalseNorthing );
  428. /** VanDerGrinten */
  429. OGRErr SetVDG( double dfCenterLong,
  430. double dfFalseEasting, double dfFalseNorthing );
  431. /** Universal Transverse Mercator */
  432. OGRErr SetUTM( int nZone, int bNorth = TRUE );
  433. int GetUTMZone( int *pbNorth = NULL ) const;
  434. /** Wagner I -- VII */
  435. OGRErr SetWagner( int nVariation, double dfCenterLat,
  436. double dfFalseEasting, double dfFalseNorthing );
  437. /** Quadrilateralized Spherical Cube */
  438. OGRErr SetQSC(double dfCenterLat, double dfCenterLong);
  439. /** State Plane */
  440. OGRErr SetStatePlane( int nZone, int bNAD83 = TRUE,
  441. const char *pszOverrideUnitName = NULL,
  442. double dfOverrideUnit = 0.0 );
  443. OGRErr ImportFromESRIStatePlaneWKT(
  444. int nCode, const char* pszDatumName, const char* pszUnitsName,
  445. int nPCSCode, const char* pszCSName = 0 );
  446. OGRErr ImportFromESRIWisconsinWKT(
  447. const char* pszPrjName, double dfCentralMeridian, double dfLatOfOrigin,
  448. const char* pszUnitsName, const char* pszCSName = 0 );
  449. static OGRSpatialReference* GetWGS84SRS();
  450. };
  451. /************************************************************************/
  452. /* OGRCoordinateTransformation */
  453. /* */
  454. /* This is really just used as a base class for a private */
  455. /* implementation. */
  456. /************************************************************************/
  457. /**
  458. * Interface for transforming between coordinate systems.
  459. *
  460. * Currently, the only implementation within OGR is OGRProj4CT, which
  461. * requires the PROJ.4 library to be available at run-time.
  462. *
  463. * Also, see OGRCreateCoordinateTransformation() for creating transformations.
  464. */
  465. class CPL_DLL OGRCoordinateTransformation
  466. {
  467. public:
  468. virtual ~OGRCoordinateTransformation() {}
  469. static void DestroyCT(OGRCoordinateTransformation* poCT);
  470. // From CT_CoordinateTransformation
  471. /** Fetch internal source coordinate system. */
  472. virtual OGRSpatialReference *GetSourceCS() = 0;
  473. /** Fetch internal target coordinate system. */
  474. virtual OGRSpatialReference *GetTargetCS() = 0;
  475. // From CT_MathTransform
  476. /**
  477. * Transform points from source to destination space.
  478. *
  479. * This method is the same as the C function OCTTransform().
  480. *
  481. * The method TransformEx() allows extended success information to
  482. * be captured indicating which points failed to transform.
  483. *
  484. * @param nCount number of points to transform.
  485. * @param x array of nCount X vertices, modified in place.
  486. * @param y array of nCount Y vertices, modified in place.
  487. * @param z array of nCount Z vertices, modified in place.
  488. * @return TRUE on success, or FALSE if some or all points fail to
  489. * transform.
  490. */
  491. virtual int Transform( int nCount,
  492. double *x, double *y, double *z = NULL ) = 0;
  493. /**
  494. * Transform points from source to destination space.
  495. *
  496. * This method is the same as the C function OCTTransformEx().
  497. *
  498. * @param nCount number of points to transform.
  499. * @param x array of nCount X vertices, modified in place.
  500. * @param y array of nCount Y vertices, modified in place.
  501. * @param z array of nCount Z vertices, modified in place.
  502. * @param pabSuccess array of per-point flags set to TRUE if that point
  503. * transforms, or FALSE if it does not.
  504. *
  505. * @return TRUE if some or all points transform successfully, or FALSE if
  506. * if none transform.
  507. */
  508. virtual int TransformEx( int nCount,
  509. double *x, double *y, double *z = NULL,
  510. int *pabSuccess = NULL ) = 0;
  511. };
  512. OGRCoordinateTransformation CPL_DLL *
  513. OGRCreateCoordinateTransformation( OGRSpatialReference *poSource,
  514. OGRSpatialReference *poTarget );
  515. #endif /* ndef _OGR_SPATIALREF_H_INCLUDED */