ogr_srs_api.h: Spatial Reference System C API

C spatial reference system services and defines.

See also: ogr_spatialref.h

Defines

SRS_WKT_WGS84_LAT_LONG

WGS 84 geodetic (lat/long) WKT / EPSG:4326 with lat,long ordering.

SRS_PT_ALBERS_CONIC_EQUAL_AREA

Albers_Conic_Equal_Area projection.

SRS_PT_AZIMUTHAL_EQUIDISTANT

Azimuthal_Equidistant projection.

SRS_PT_CASSINI_SOLDNER

Cassini_Soldner projection.

SRS_PT_CYLINDRICAL_EQUAL_AREA

Cylindrical_Equal_Area projection.

SRS_PT_BONNE

Cylindrical_Equal_Area projection.

SRS_PT_ECKERT_I

Eckert_I projection.

SRS_PT_ECKERT_II

Eckert_II projection.

SRS_PT_ECKERT_III

Eckert_III projection.

SRS_PT_ECKERT_IV

Eckert_IV projection.

SRS_PT_ECKERT_V

Eckert_V projection.

SRS_PT_ECKERT_VI

Eckert_VI projection.

SRS_PT_EQUIDISTANT_CONIC

Equidistant_Conic projection.

SRS_PT_EQUIRECTANGULAR

Equirectangular projection.

SRS_PT_GALL_STEREOGRAPHIC

Gall_Stereographic projection.

SRS_PT_GAUSSSCHREIBERTMERCATOR

Gauss_Schreiber_Transverse_Mercator projection.

SRS_PT_GEOSTATIONARY_SATELLITE

Geostationary_Satellite projection.

SRS_PT_GOODE_HOMOLOSINE

Goode_Homolosine projection.

SRS_PT_IGH

Interrupted_Goode_Homolosine projection.

SRS_PT_GNOMONIC

Gnomonic projection.

SRS_PT_HOTINE_OBLIQUE_MERCATOR_AZIMUTH_CENTER

Hotine_Oblique_Mercator_Azimuth_Center projection.

SRS_PT_HOTINE_OBLIQUE_MERCATOR

Hotine_Oblique_Mercator projection.

SRS_PT_HOTINE_OBLIQUE_MERCATOR_TWO_POINT_NATURAL_ORIGIN

Hotine_Oblique_Mercator_Two_Point_Natural_Origin projection.

SRS_PT_LABORDE_OBLIQUE_MERCATOR

Laborde_Oblique_Mercator projection.

SRS_PT_LAMBERT_CONFORMAL_CONIC_1SP

Lambert_Conformal_Conic_1SP projection.

SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP

Lambert_Conformal_Conic_2SP projection.

SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP_BELGIUM

Lambert_Conformal_Conic_2SP_Belgium projection.

SRS_PT_LAMBERT_AZIMUTHAL_EQUAL_AREA

Lambert_Azimuthal_Equal_Area projection.

SRS_PT_MERCATOR_1SP

Mercator_1SP projection.

SRS_PT_MERCATOR_2SP

Mercator_2SP projection.

SRS_PT_MERCATOR_AUXILIARY_SPHERE

Mercator_Auxiliary_Sphere is used used by ESRI to mean EPSG:3875.

SRS_PT_MILLER_CYLINDRICAL

Miller_Cylindrical projection.

SRS_PT_MOLLWEIDE

Mollweide projection.

SRS_PT_NEW_ZEALAND_MAP_GRID

New_Zealand_Map_Grid projection.

SRS_PT_OBLIQUE_STEREOGRAPHIC

Oblique_Stereographic projection.

SRS_PT_ORTHOGRAPHIC

Orthographic projection.

SRS_PT_POLAR_STEREOGRAPHIC

Polar_Stereographic projection.

SRS_PT_POLYCONIC

Polyconic projection.

SRS_PT_ROBINSON

Robinson projection.

SRS_PT_SINUSOIDAL

Sinusoidal projection.

SRS_PT_STEREOGRAPHIC

Stereographic projection.

SRS_PT_SWISS_OBLIQUE_CYLINDRICAL

Swiss_Oblique_Cylindrical projection.

SRS_PT_TRANSVERSE_MERCATOR

Transverse_Mercator projection.

SRS_PT_TRANSVERSE_MERCATOR_SOUTH_ORIENTED

Transverse_Mercator_South_Orientated projection.

SRS_PT_TRANSVERSE_MERCATOR_MI_21

Transverse_Mercator_MapInfo_21 projection.

SRS_PT_TRANSVERSE_MERCATOR_MI_22

Transverse_Mercator_MapInfo_22 projection.

SRS_PT_TRANSVERSE_MERCATOR_MI_23

Transverse_Mercator_MapInfo_23 projection.

SRS_PT_TRANSVERSE_MERCATOR_MI_24

Transverse_Mercator_MapInfo_24 projection.

SRS_PT_TRANSVERSE_MERCATOR_MI_25

Transverse_Mercator_MapInfo_25 projection.

SRS_PT_TUNISIA_MINING_GRID

Tunisia_Mining_Grid projection.

SRS_PT_TWO_POINT_EQUIDISTANT

Two_Point_Equidistant projection.

SRS_PT_VANDERGRINTEN

VanDerGrinten projection.

SRS_PT_KROVAK

Krovak projection.

SRS_PT_IMW_POLYCONIC

International_Map_of_the_World_Polyconic projection.

SRS_PT_WAGNER_I

Wagner_I projection.

SRS_PT_WAGNER_II

Wagner_II projection.

SRS_PT_WAGNER_III

Wagner_III projection.

SRS_PT_WAGNER_IV

Wagner_IV projection.

SRS_PT_WAGNER_V

Wagner_V projection.

SRS_PT_WAGNER_VI

Wagner_VI projection.

SRS_PT_WAGNER_VII

Wagner_VII projection.

SRS_PT_QSC

Quadrilateralized_Spherical_Cube projection.

SRS_PT_AITOFF

Aitoff projection.

SRS_PT_WINKEL_I

Winkel_I projection.

SRS_PT_WINKEL_II

Winkel_II projection.

SRS_PT_WINKEL_TRIPEL

Winkel_Tripel projection.

SRS_PT_CRASTER_PARABOLIC

Craster_Parabolic projection.

SRS_PT_LOXIMUTHAL

Loximuthal projection.

SRS_PT_QUARTIC_AUTHALIC

Quartic_Authalic projection.

SRS_PT_SCH

Spherical_Cross_Track_Height projection.

SRS_PP_CENTRAL_MERIDIAN

central_meridian projection parameter

SRS_PP_SCALE_FACTOR

scale_factor projection parameter

SRS_PP_STANDARD_PARALLEL_1

standard_parallel_1 projection parameter

SRS_PP_STANDARD_PARALLEL_2

standard_parallel_2 projection parameter

SRS_PP_PSEUDO_STD_PARALLEL_1

pseudo_standard_parallel_1 projection parameter

SRS_PP_LONGITUDE_OF_CENTER

longitude_of_center projection parameter

SRS_PP_LATITUDE_OF_CENTER

latitude_of_center projection parameter

SRS_PP_LONGITUDE_OF_ORIGIN

longitude_of_origin projection parameter

SRS_PP_LATITUDE_OF_ORIGIN

latitude_of_origin projection parameter

SRS_PP_FALSE_EASTING

false_easting projection parameter

SRS_PP_FALSE_NORTHING

false_northing projection parameter

SRS_PP_AZIMUTH

azimuth projection parameter

SRS_PP_LONGITUDE_OF_POINT_1

longitude_of_point_1 projection parameter

SRS_PP_LATITUDE_OF_POINT_1

latitude_of_point_1 projection parameter

SRS_PP_LONGITUDE_OF_POINT_2

longitude_of_point_2 projection parameter

SRS_PP_LATITUDE_OF_POINT_2

latitude_of_point_2 projection parameter

SRS_PP_LONGITUDE_OF_POINT_3

longitude_of_point_3 projection parameter

SRS_PP_LATITUDE_OF_POINT_3

latitude_of_point_3 projection parameter

SRS_PP_RECTIFIED_GRID_ANGLE

rectified_grid_angle projection parameter

SRS_PP_LANDSAT_NUMBER

landsat_number projection parameter

SRS_PP_PATH_NUMBER

path_number projection parameter

SRS_PP_PERSPECTIVE_POINT_HEIGHT

perspective_point_height projection parameter

SRS_PP_SATELLITE_HEIGHT

satellite_height projection parameter

SRS_PP_FIPSZONE

fipszone projection parameter

SRS_PP_ZONE

zone projection parameter

SRS_PP_LATITUDE_OF_1ST_POINT

Latitude_Of_1st_Point projection parameter.

SRS_PP_LONGITUDE_OF_1ST_POINT

Longitude_Of_1st_Point projection parameter.

SRS_PP_LATITUDE_OF_2ND_POINT

Latitude_Of_2nd_Point projection parameter.

SRS_PP_LONGITUDE_OF_2ND_POINT

Longitude_Of_2nd_Point projection parameter.

SRS_PP_PEG_POINT_LATITUDE

peg_point_latitude projection parameter

SRS_PP_PEG_POINT_LONGITUDE

peg_point_longitude projection parameter

SRS_PP_PEG_POINT_HEADING

peg_point_heading projection parameter

SRS_PP_PEG_POINT_HEIGHT

peg_point_height projection parameter

SRS_UL_METER

Linear unit Meter.

SRS_UL_FOOT

Linear unit Foot (International)

SRS_UL_FOOT_CONV

Linear unit Foot (International) conversion factor to meter.

SRS_UL_US_FOOT

Linear unit Foot.

SRS_UL_US_FOOT_CONV

Linear unit Foot conversion factor to meter.

SRS_UL_NAUTICAL_MILE

Linear unit Nautical Mile.

SRS_UL_NAUTICAL_MILE_CONV

Linear unit Nautical Mile conversion factor to meter.

Linear unit Link.

Linear unit Link conversion factor to meter.

SRS_UL_CHAIN

Linear unit Chain.

SRS_UL_CHAIN_CONV

Linear unit Chain conversion factor to meter.

SRS_UL_ROD

Linear unit Rod.

SRS_UL_ROD_CONV

Linear unit Rod conversion factor to meter.

Linear unit Link_Clarke.

Linear unit Link_Clarke conversion factor to meter.

SRS_UL_KILOMETER

Linear unit Kilometer.

SRS_UL_KILOMETER_CONV

Linear unit Kilometer conversion factor to meter.

SRS_UL_DECIMETER

Linear unit Decimeter.

SRS_UL_DECIMETER_CONV

Linear unit Decimeter conversion factor to meter.

SRS_UL_CENTIMETER

Linear unit Decimeter.

SRS_UL_CENTIMETER_CONV

Linear unit Decimeter conversion factor to meter.

SRS_UL_MILLIMETER

Linear unit Millimeter.

SRS_UL_MILLIMETER_CONV

Linear unit Millimeter conversion factor to meter.

SRS_UL_INTL_NAUT_MILE

Linear unit Nautical_Mile_International.

SRS_UL_INTL_NAUT_MILE_CONV

Linear unit Nautical_Mile_International conversion factor to meter.

SRS_UL_INTL_INCH

Linear unit Inch_International.

SRS_UL_INTL_INCH_CONV

Linear unit Inch_International conversion factor to meter.

SRS_UL_INTL_FOOT

Linear unit Foot_International.

SRS_UL_INTL_FOOT_CONV

Linear unit Foot_International conversion factor to meter.

SRS_UL_INTL_YARD

Linear unit Yard_International.

SRS_UL_INTL_YARD_CONV

Linear unit Yard_International conversion factor to meter.

SRS_UL_INTL_STAT_MILE

Linear unit Statute_Mile_International.

SRS_UL_INTL_STAT_MILE_CONV

Linear unit Statute_Mile_Internationalconversion factor to meter.

SRS_UL_INTL_FATHOM

Linear unit Fathom_International.

SRS_UL_INTL_FATHOM_CONV

Linear unit Fathom_International conversion factor to meter.

SRS_UL_INTL_CHAIN

Linear unit Chain_International.

SRS_UL_INTL_CHAIN_CONV

Linear unit Chain_International conversion factor to meter.

Linear unit Link_International.

Linear unit Link_International conversion factor to meter.

SRS_UL_US_INCH

Linear unit Inch_US_Surveyor.

SRS_UL_US_INCH_CONV

Linear unit Inch_US_Surveyor conversion factor to meter.

SRS_UL_US_YARD

Linear unit Yard_US_Surveyor.

SRS_UL_US_YARD_CONV

Linear unit Yard_US_Surveyor conversion factor to meter.

SRS_UL_US_CHAIN

Linear unit Chain_US_Surveyor.

SRS_UL_US_CHAIN_CONV

Linear unit Chain_US_Surveyor conversion factor to meter.

SRS_UL_US_STAT_MILE

Linear unit Statute_Mile_US_Surveyor.

SRS_UL_US_STAT_MILE_CONV

Linear unit Statute_Mile_US_Surveyor conversion factor to meter.

SRS_UL_INDIAN_YARD

Linear unit Yard_Indian.

SRS_UL_INDIAN_YARD_CONV

Linear unit Yard_Indian conversion factor to meter.

SRS_UL_INDIAN_FOOT

Linear unit Foot_Indian.

SRS_UL_INDIAN_FOOT_CONV

Linear unit Foot_Indian conversion factor to meter.

SRS_UL_INDIAN_CHAIN

Linear unit Chain_Indian.

SRS_UL_INDIAN_CHAIN_CONV

Linear unit Chain_Indian conversion factor to meter.

SRS_UA_DEGREE

Angular unit degree.

SRS_UA_DEGREE_CONV

Angular unit degree conversion factor to radians.

SRS_UA_RADIAN

Angular unit radian.

SRS_PM_GREENWICH

Prime meridian Greenwich.

SRS_DN_NAD27

North_American_Datum_1927 datum name.

SRS_DN_NAD83

North_American_Datum_1983 datum name.

SRS_DN_WGS72

WGS_1972 datum name.

SRS_DN_WGS84

WGS_1984 datum name.

SRS_WGS84_SEMIMAJOR

Semi-major axis of the WGS84 ellipsoid.

SRS_WGS84_INVFLATTENING

Inverse flattening of the WGS84 ellipsoid.

Typedefs

typedef void *OGRSpatialReferenceH

Opaque type for a Spatial Reference object.

typedef void *OGRCoordinateTransformationH

Opaque type for a coordinate transformation object.

typedef struct OSRCRSListParameters OSRCRSListParameters

Structure to describe optional parameters to OSRGetCRSInfoListFromDatabase()

Unused for now.

typedef struct OGRCoordinateTransformationOptions *OGRCoordinateTransformationOptionsH

Coordinate transformation options.

Enums

enum OGRAxisOrientation

Axis orientations (corresponds to CS_AxisOrientationEnum).

Values:

OAO_Other = 0

Other.

OAO_North = 1

North.

OAO_South = 2

South.

OAO_East = 3

East.

OAO_West = 4

West.

OAO_Up = 5

Up (to space)

OAO_Down = 6

Down (to Earth center)

enum OSRAxisMappingStrategy

Data axis to CRS axis mapping strategy.

Values:

OAMS_TRADITIONAL_GIS_ORDER

Traditional GIS order.

OAMS_AUTHORITY_COMPLIANT

Compliant with the order mandated by the CRS authority.

OAMS_CUSTOM

Custom.

enum OSRCRSType

Type of Coordinate Reference System (CRS).

Values:

OSR_CRS_TYPE_GEOGRAPHIC_2D

Geographic 2D CRS.

OSR_CRS_TYPE_GEOGRAPHIC_3D

Geographic 3D CRS.

OSR_CRS_TYPE_GEOCENTRIC

Geocentric CRS.

OSR_CRS_TYPE_PROJECTED

Projected CRS.

OSR_CRS_TYPE_VERTICAL

Vertical CRS.

OSR_CRS_TYPE_COMPOUND

Compound CRS.

OSR_CRS_TYPE_OTHER

Other.

Functions

const char *OSRAxisEnumToName(OGRAxisOrientation eOrientation)

Return the string representation for the OGRAxisOrientation enumeration.

For example “NORTH” for OAO_North.

Return

an internal string

void OSRSetPROJSearchPaths(const char *const *papszPaths)

Set the search path(s) for PROJ resource files.

Since

GDAL 3.0

Parameters
  • papszPaths: NULL terminated list of directory paths.

void OSRGetPROJVersion(int *pnMajor, int *pnMinor, int *pnPatch)

Get the PROJ version.

Since

GDAL 3.0.1

Parameters
  • pnMajor: Pointer to major version number, or NULL

  • pnMinor: Pointer to minor version number, or NULL

  • pnPatch: Pointer to patch version number, or NULL

OGRSpatialReferenceH OSRNewSpatialReference(const char *pszWKT)

Constructor.

This function is the same as OGRSpatialReference::OGRSpatialReference()

OGRSpatialReferenceH OSRCloneGeogCS(OGRSpatialReferenceH hSource)

Make a duplicate of the GEOGCS node of this OGRSpatialReference object.

This function is the same as OGRSpatialReference::CloneGeogCS().

OGRSpatialReferenceH OSRClone(OGRSpatialReferenceH hSRS)

Make a duplicate of this OGRSpatialReference.

This function is the same as OGRSpatialReference::Clone()

void OSRDestroySpatialReference(OGRSpatialReferenceH hSRS)

OGRSpatialReference destructor.

This function is the same as OGRSpatialReference::~OGRSpatialReference() and OGRSpatialReference::DestroySpatialReference()

Parameters
  • hSRS: the object to delete

int OSRReference(OGRSpatialReferenceH hSRS)

Increments the reference count by one.

This function is the same as OGRSpatialReference::Reference()

int OSRDereference(OGRSpatialReferenceH hSRS)

Decrements the reference count by one.

This function is the same as OGRSpatialReference::Dereference()

void OSRRelease(OGRSpatialReferenceH hSRS)

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

This function is the same as OGRSpatialReference::Release()

OGRErr OSRValidate(OGRSpatialReferenceH hSRS)

Validate SRS tokens.

This function is the same as the C++ method OGRSpatialReference::Validate().

OGRErr OSRImportFromEPSG(OGRSpatialReferenceH hSRS, int nCode)

Initialize SRS based on EPSG GCS or PCS code.

This function is the same as OGRSpatialReference::importFromEPSG().

OGRErr OSRImportFromEPSGA(OGRSpatialReferenceH hSRS, int nCode)

Initialize SRS based on EPSG CRS code.

This function is the same as OGRSpatialReference::importFromEPSGA().

OGRErr OSRImportFromWkt(OGRSpatialReferenceH hSRS, char **ppszInput)

Import from WKT string.

Consult also the OGC WKT Coordinate System Issues page for implementation details of WKT in OGR.

This function is the same as OGRSpatialReference::importFromWkt().

OGRErr OSRImportFromProj4(OGRSpatialReferenceH hSRS, const char *pszProj4)

Import PROJ coordinate string.

This function is the same as OGRSpatialReference::importFromProj4().

OGRErr OSRImportFromESRI(OGRSpatialReferenceH hSRS, char **papszPrj)

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

This function is the same as the C++ method OGRSpatialReference::importFromESRI().

OGRErr OSRImportFromPCI(OGRSpatialReferenceH hSRS, const char *pszProj, const char *pszUnits, double *padfPrjParams)

Import coordinate system from PCI projection definition.

This function is the same as OGRSpatialReference::importFromPCI().

OGRErr OSRImportFromUSGS(OGRSpatialReferenceH hSRS, long iProjsys, long iZone, double *padfPrjParams, long iDatum)

Import coordinate system from USGS projection definition.

This function is the same as OGRSpatialReference::importFromUSGS().

OGRErr OSRImportFromXML(OGRSpatialReferenceH hSRS, const char *pszXML)

Import coordinate system from XML format (GML only currently).

This function is the same as OGRSpatialReference::importFromXML().

OGRErr OSRImportFromDict(OGRSpatialReferenceH hSRS, 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++ method OGRSpatialReference::importFromDict().

Return

OGRERR_NONE on success, or OGRERR_SRS_UNSUPPORTED if the code isn’t found, and OGRERR_SRS_FAILURE if something more dramatic goes wrong.

Parameters
  • hSRS: spatial reference system handle.

  • pszDictFile: the name of the dictionary file to load.

  • pszCode: the code to lookup in the dictionary.

OGRErr OSRImportFromPanorama(OGRSpatialReferenceH hSRS, long iProjSys, long iDatum, long iEllips, double *padfPrjParams)

Import coordinate system from “Panorama” GIS projection definition.

See OGRSpatialReference::importFromPanorama()

OGRErr OSRImportFromOzi(OGRSpatialReferenceH hSRS, const char *const *papszLines)

Import coordinate system from OziExplorer projection definition.

This function will import projection definition in style, used by OziExplorer software.

Note: another version of this function with a different signature existed in GDAL 1.X.

Return

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

Since

OGR 2.0

Parameters
  • hSRS: spatial reference object.

  • papszLines: Map file lines. This is an array of strings containing the whole OziExplorer .MAP file. The array is terminated by a NULL pointer.

OGRErr OSRImportFromMICoordSys(OGRSpatialReferenceH hSRS, const char *pszCoordSys)

Import Mapinfo style CoordSys definition.

This method is the equivalent of the C++ method OGRSpatialReference::importFromMICoordSys

OGRErr OSRImportFromERM(OGRSpatialReferenceH hSRS, const char *pszProj, const char *pszDatum, const char *pszUnits)

Create OGR WKT from ERMapper projection definitions.

This function is the same as OGRSpatialReference::importFromERM().

OGRErr OSRImportFromUrl(OGRSpatialReferenceH hSRS, const char *pszUrl)

Set spatial reference from a URL.

This function is the same as OGRSpatialReference::importFromUrl()

OGRErr OSRExportToWkt(OGRSpatialReferenceH hSRS, char **ppszReturn)

Convert this SRS into WKT 1 format.

Consult also the OGC WKT Coordinate System Issues page for implementation details of WKT in OGR.

The WKT version can be overridden by using the OSR_WKT_FORMAT configuration option. Valid values are the one of the FORMAT option of exportToWkt( char ** ppszResult, const char* const* papszOptions ) const

This function is the same as OGRSpatialReference::exportToWkt().

OGRErr OSRExportToWktEx(OGRSpatialReferenceH hSRS, char **ppszResult, const char *const *papszOptions)

Convert this SRS into WKT format.

This function is the same as OGRSpatialReference::exportToWkt(char ** ppszResult,const char* const* papszOptions ) const

Since

GDAL 3.0

OGRErr OSRExportToPrettyWkt(OGRSpatialReferenceH hSRS, char **ppszReturn, int bSimplify)

Convert this SRS into a nicely formatted WKT 1 string for display to a person.

The WKT version can be overridden by using the OSR_WKT_FORMAT configuration option. Valid values are the one of the FORMAT option of exportToWkt( char ** ppszResult, const char* const* papszOptions ) const

This function is the same as OGRSpatialReference::exportToPrettyWkt().

OGRErr OSRExportToPROJJSON(OGRSpatialReferenceH hSRS, char **ppszReturn, const char *const *papszOptions)

Convert this SRS into PROJJSON format.

This function is the same as OGRSpatialReference::exportToPROJJSON() const

Since

GDAL 3.1 and PROJ 6.2

OGRErr OSRExportToProj4(OGRSpatialReferenceH hSRS, char **ppszReturn)

Export coordinate system in PROJ format.

This function is the same as OGRSpatialReference::exportToProj4().

OGRErr OSRExportToPCI(OGRSpatialReferenceH hSRS, char **ppszProj, char **ppszUnits, double **ppadfPrjParams)

Export coordinate system in PCI projection definition.

This function is the same as OGRSpatialReference::exportToPCI().

OGRErr OSRExportToUSGS(OGRSpatialReferenceH hSRS, long *piProjSys, long *piZone, double **ppadfPrjParams, long *piDatum)

Export coordinate system in USGS GCTP projection definition.

This function is the same as OGRSpatialReference::exportToUSGS().

OGRErr OSRExportToXML(OGRSpatialReferenceH hSRS, char **ppszRawXML, const char *pszDialect)

Export coordinate system in XML format.

This function is the same as OGRSpatialReference::exportToXML().

OGRErr OSRExportToPanorama(OGRSpatialReferenceH hSRS, long *piProjSys, long *piDatum, long *piEllips, long *piZone, double *padfPrjParams)

Export coordinate system in “Panorama” GIS projection definition.

See OGRSpatialReference::exportToPanorama()

OGRErr OSRExportToMICoordSys(OGRSpatialReferenceH hSRS, char **ppszReturn)

Export coordinate system in Mapinfo style CoordSys format.

This method is the equivalent of the C++ method OGRSpatialReference::exportToMICoordSys

OGRErr OSRExportToERM(OGRSpatialReferenceH hSRS, char *pszProj, char *pszDatum, char *pszUnits)

Convert coordinate system to ERMapper format.

This function is the same as OGRSpatialReference::exportToERM().

OGRErr OSRMorphToESRI(OGRSpatialReferenceH hSRS)

Convert in place to ESRI WKT format.

This function is the same as the C++ method OGRSpatialReference::morphToESRI().

OGRErr OSRMorphFromESRI(OGRSpatialReferenceH hSRS)

Convert in place from ESRI WKT format.

This function is the same as the C++ method OGRSpatialReference::morphFromESRI().

OGRSpatialReferenceH OSRConvertToOtherProjection(OGRSpatialReferenceH hSRS, const char *pszTargetProjection, const char *const *papszOptions)

Convert to another equivalent projection.

Currently implemented:

  • SRS_PT_MERCATOR_1SP to SRS_PT_MERCATOR_2SP

  • SRS_PT_MERCATOR_2SP to SRS_PT_MERCATOR_1SP

  • SRS_PT_LAMBERT_CONFORMAL_CONIC_1SP to SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP

  • SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP to SRS_PT_LAMBERT_CONFORMAL_CONIC_1SP

Return

a new SRS, or NULL in case of error.

Since

GDAL 2.3

Parameters
  • hSRS: source SRS

  • pszTargetProjection: target projection.

  • papszOptions: lists of options. None supported currently.

const char *OSRGetName(OGRSpatialReferenceH hSRS)

Return the CRS name.

The returned value is only short lived and should not be used after other calls to methods on this object.

Since

GDAL 3.0

OGRErr OSRSetAttrValue(OGRSpatialReferenceH hSRS, const char *pszNodePath, const char *pszNewNodeValue)

Set attribute value in spatial reference.

This function is the same as OGRSpatialReference::SetNode()

const char *OSRGetAttrValue(OGRSpatialReferenceH hSRS, const char *pszName, int iChild)

Fetch indicated attribute of named node.

This function is the same as OGRSpatialReference::GetAttrValue()

OGRErr OSRSetAngularUnits(OGRSpatialReferenceH hSRS, const char *pszUnits, double dfInRadians)

Set the angular units for the geographic coordinate system.

This function is the same as OGRSpatialReference::SetAngularUnits()

double OSRGetAngularUnits(OGRSpatialReferenceH hSRS, char **ppszName)

Fetch angular geographic coordinate system units.

This function is the same as OGRSpatialReference::GetAngularUnits()

OGRErr OSRSetLinearUnits(OGRSpatialReferenceH hSRS, const char *pszUnits, double dfInMeters)

Set the linear units for the projection.

This function is the same as OGRSpatialReference::SetLinearUnits()

OGRErr OSRSetTargetLinearUnits(OGRSpatialReferenceH hSRS, const char *pszTargetKey, const char *pszUnits, double dfInMeters)

Set the linear units for the target node.

This function is the same as OGRSpatialReference::SetTargetLinearUnits()

Since

OGR 1.9.0

OGRErr OSRSetLinearUnitsAndUpdateParameters(OGRSpatialReferenceH hSRS, const char *pszUnits, double dfInMeters)

Set the linear units for the projection.

This function is the same as OGRSpatialReference::SetLinearUnitsAndUpdateParameters()

double OSRGetLinearUnits(OGRSpatialReferenceH hSRS, char **ppszName)

Fetch linear projection units.

This function is the same as OGRSpatialReference::GetLinearUnits()

double OSRGetTargetLinearUnits(OGRSpatialReferenceH hSRS, const char *pszTargetKey, char **ppszName)

Fetch linear projection units.

This function is the same as OGRSpatialReference::GetTargetLinearUnits()

Since

OGR 1.9.0

double OSRGetPrimeMeridian(OGRSpatialReferenceH hSRS, char **ppszName)

Fetch prime meridian info.

This function is the same as OGRSpatialReference::GetPrimeMeridian()

int OSRIsGeographic(OGRSpatialReferenceH hSRS)

Check if geographic coordinate system.

This function is the same as OGRSpatialReference::IsGeographic().

int OSRIsLocal(OGRSpatialReferenceH hSRS)

Check if local coordinate system.

This function is the same as OGRSpatialReference::IsLocal().

int OSRIsProjected(OGRSpatialReferenceH hSRS)

Check if projected coordinate system.

This function is the same as OGRSpatialReference::IsProjected().

int OSRIsCompound(OGRSpatialReferenceH hSRS)

Check if the coordinate system is compound.

This function is the same as OGRSpatialReference::IsCompound().

int OSRIsGeocentric(OGRSpatialReferenceH hSRS)

Check if geocentric coordinate system.

This function is the same as OGRSpatialReference::IsGeocentric().

Since

OGR 1.9.0

int OSRIsVertical(OGRSpatialReferenceH hSRS)

Check if vertical coordinate system.

This function is the same as OGRSpatialReference::IsVertical().

Since

OGR 1.8.0

int OSRIsSameGeogCS(OGRSpatialReferenceH hSRS1, OGRSpatialReferenceH hSRS2)

Do the GeogCS’es match?

This function is the same as OGRSpatialReference::IsSameGeogCS().

int OSRIsSameVertCS(OGRSpatialReferenceH hSRS1, OGRSpatialReferenceH hSRS2)

Do the VertCS’es match?

This function is the same as OGRSpatialReference::IsSameVertCS().

int OSRIsSame(OGRSpatialReferenceH hSRS1, OGRSpatialReferenceH hSRS2)

Do these two spatial references describe the same system ?

This function is the same as OGRSpatialReference::IsSame().

int OSRIsSameEx(OGRSpatialReferenceH hSRS1, OGRSpatialReferenceH hSRS2, const char *const *papszOptions)

Do these two spatial references describe the same system ?

This function is the same as OGRSpatialReference::IsSame().

OGRErr OSRSetLocalCS(OGRSpatialReferenceH hSRS, const char *pszName)

Set the user visible LOCAL_CS name.

This function is the same as OGRSpatialReference::SetLocalCS()

OGRErr OSRSetProjCS(OGRSpatialReferenceH hSRS, const char *pszName)

Set the user visible PROJCS name.

This function is the same as OGRSpatialReference::SetProjCS()

OGRErr OSRSetGeocCS(OGRSpatialReferenceH hSRS, const char *pszName)

Set the user visible PROJCS name.

This function is the same as OGRSpatialReference::SetGeocCS()

Since

OGR 1.9.0

OGRErr OSRSetWellKnownGeogCS(OGRSpatialReferenceH hSRS, const char *pszName)

Set a GeogCS based on well known name.

This function is the same as OGRSpatialReference::SetWellKnownGeogCS()

OGRErr OSRSetFromUserInput(OGRSpatialReferenceH hSRS, const char *pszDef)

Set spatial reference from various text formats.

This function is the same as OGRSpatialReference::SetFromUserInput()

OGRErr OSRCopyGeogCSFrom(OGRSpatialReferenceH hSRS, const OGRSpatialReferenceH hSrcSRS)

Copy GEOGCS from another OGRSpatialReference.

This function is the same as OGRSpatialReference::CopyGeogCSFrom()

OGRErr OSRSetTOWGS84(OGRSpatialReferenceH hSRS, double dfDX, double dfDY, double dfDZ, double dfEX, double dfEY, double dfEZ, double dfPPM)

Set the Bursa-Wolf conversion to WGS84.

This function is the same as OGRSpatialReference::SetTOWGS84().

OGRErr OSRGetTOWGS84(OGRSpatialReferenceH hSRS, double *padfCoeff, int nCoeffCount)

Fetch TOWGS84 parameters, if available.

This function is the same as OGRSpatialReference::GetTOWGS84().

OGRErr OSRSetCompoundCS(OGRSpatialReferenceH hSRS, const char *pszName, OGRSpatialReferenceH hHorizSRS, OGRSpatialReferenceH hVertSRS)

Setup a compound coordinate system.

This function is the same as OGRSpatialReference::SetCompoundCS()

OGRErr OSRPromoteTo3D(OGRSpatialReferenceH hSRS, const char *pszName)

“Promotes” a 2D CRS to a 3D CRS one.

See OGRSpatialReference::PromoteTo3D()

Since

GDAL 3.1 and PROJ 7.0

OGRErr OSRSetGeogCS(OGRSpatialReferenceH hSRS, const char *pszGeogName, const char *pszDatumName, const char *pszEllipsoidName, double dfSemiMajor, double dfInvFlattening, const char *pszPMName, double dfPMOffset, const char *pszUnits, double dfConvertToRadians)

Set geographic coordinate system.

This function is the same as OGRSpatialReference::SetGeogCS()

OGRErr OSRSetVertCS(OGRSpatialReferenceH hSRS, const char *pszVertCSName, const char *pszVertDatumName, int nVertDatumType)

Setup the vertical coordinate system.

This function is the same as OGRSpatialReference::SetVertCS()

Since

OGR 1.9.0

double OSRGetSemiMajor(OGRSpatialReferenceH hSRS, OGRErr *pnErr)

Get spheroid semi major axis.

This function is the same as OGRSpatialReference::GetSemiMajor()

double OSRGetSemiMinor(OGRSpatialReferenceH hSRS, OGRErr *pnErr)

Get spheroid semi minor axis.

This function is the same as OGRSpatialReference::GetSemiMinor()

double OSRGetInvFlattening(OGRSpatialReferenceH hSRS, OGRErr *pnErr)

Get spheroid inverse flattening.

This function is the same as OGRSpatialReference::GetInvFlattening()

OGRErr OSRSetAuthority(OGRSpatialReferenceH hSRS, const char *pszTargetKey, const char *pszAuthority, int nCode)

Set the authority for a node.

This function is the same as OGRSpatialReference::SetAuthority().

const char *OSRGetAuthorityCode(OGRSpatialReferenceH hSRS, const char *pszTargetKey)

Get the authority code for a node.

This function is the same as OGRSpatialReference::GetAuthorityCode().

const char *OSRGetAuthorityName(OGRSpatialReferenceH hSRS, const char *pszTargetKey)

Get the authority name for a node.

This function is the same as OGRSpatialReference::GetAuthorityName().

int OSRGetAreaOfUse(OGRSpatialReferenceH hSRS, double *pdfWestLongitudeDeg, double *pdfSouthLatitudeDeg, double *pdfEastLongitudeDeg, double *pdfNorthLatitudeDeg, const char **ppszAreaName)

Return the area of use of the CRS.

This function is the same as the OGRSpatialReference::GetAreaOfUse() method.

Since

GDAL 3.0

OGRErr OSRSetProjection(OGRSpatialReferenceH hSRS, const char *pszProjection)

Set a projection name.

This function is the same as OGRSpatialReference::SetProjection()

OGRErr OSRSetProjParm(OGRSpatialReferenceH hSRS, const char *pszParmName, double dfValue)

Set a projection parameter value.

This function is the same as OGRSpatialReference::SetProjParm()

double OSRGetProjParm(OGRSpatialReferenceH hSRS, const char *pszParmName, double dfDefault, OGRErr *pnErr)

Fetch a projection parameter value.

This function is the same as OGRSpatialReference::GetProjParm()

OGRErr OSRSetNormProjParm(OGRSpatialReferenceH hSRS, const char *pszParmName, double dfValue)

Set a projection parameter with a normalized value.

This function is the same as OGRSpatialReference::SetNormProjParm()

double OSRGetNormProjParm(OGRSpatialReferenceH hSRS, const char *pszParmName, double dfDefault, OGRErr *pnErr)

This function is the same as OGRSpatialReference::

This function is the same as OGRSpatialReference::GetNormProjParm()

OGRErr OSRSetUTM(OGRSpatialReferenceH hSRS, int nZone, int bNorth)

Set UTM projection definition.

This is the same as the C++ method OGRSpatialReference::SetUTM()

int OSRGetUTMZone(OGRSpatialReferenceH hSRS, int *pbNorth)

Get utm zone information.

This is the same as the C++ method OGRSpatialReference::GetUTMZone()

OGRErr OSRSetStatePlane(OGRSpatialReferenceH hSRS, int nZone, int bNAD83)

Set State Plane projection definition.

This function is the same as OGRSpatialReference::SetStatePlane().

OGRErr OSRSetStatePlaneWithUnits(OGRSpatialReferenceH hSRS, int nZone, int bNAD83, const char *pszOverrideUnitName, double dfOverrideUnit)

Set State Plane projection definition.

This function is the same as OGRSpatialReference::SetStatePlane().

OGRErr OSRAutoIdentifyEPSG(OGRSpatialReferenceH hSRS)

Set EPSG authority info if possible.

This function is the same as OGRSpatialReference::AutoIdentifyEPSG().

Since GDAL 2.3, the OSRFindMatches() function can also be used for improved matching by researching the EPSG catalog.

OGRSpatialReferenceH *OSRFindMatches(OGRSpatialReferenceH hSRS, char **papszOptions, int *pnEntries, int **ppanMatchConfidence)

Try to identify a match between the passed SRS and a related SRS in a catalog (currently EPSG only)

Matching may be partial, or may fail. Returned entries will be sorted by decreasing match confidence (first entry has the highest match confidence).

The exact way matching is done may change in future versions.

The current algorithm is:

  • try first AutoIdentifyEPSG(). If it succeeds, return the corresponding SRS

  • otherwise iterate over all SRS from the EPSG catalog (as found in GDAL pcs.csv and gcs.csv files+esri_extra.wkt), and find those that match the input SRS using the IsSame() function (ignoring TOWGS84 clauses)

  • if there is a single match using IsSame() or one of the matches has the same SRS name, return it with 100% confidence

  • if a SRS has the same SRS name, but does not pass the IsSame() criteria, return it with 50% confidence.

  • otherwise return all candidate SRS that pass the IsSame() criteria with a 90% confidence.

A pre-built SRS cache in ~/.gdal/X.Y/srs_cache will be used if existing, otherwise it will be built at the first run of this function.

This function is the same as OGRSpatialReference::FindMatches().

Return

an array of SRS that match the passed SRS, or NULL. Must be freed with OSRFreeSRSArray()

Since

GDAL 2.3

Parameters
  • hSRS: SRS to match

  • papszOptions: NULL terminated list of options or NULL

  • pnEntries: Output parameter. Number of values in the returned array.

  • ppanMatchConfidence: Output parameter (or NULL). *ppanMatchConfidence will be allocated to an array of *pnEntries whose values between 0 and 100 indicate the confidence in the match. 100 is the highest confidence level. The array must be freed with CPLFree().

void OSRFreeSRSArray(OGRSpatialReferenceH *pahSRS)

Free return of OSRIdentifyMatches()

Since

GDAL 2.3

Parameters
  • pahSRS: array of SRS (must be NULL terminated)

int OSREPSGTreatsAsLatLong(OGRSpatialReferenceH hSRS)

This function returns TRUE if EPSG feels this geographic coordinate system should be treated as having lat/long coordinate ordering.

This function is the same as OGRSpatialReference::OSREPSGTreatsAsLatLong().

int OSREPSGTreatsAsNorthingEasting(OGRSpatialReferenceH hSRS)

This function returns TRUE if EPSG feels this geographic coordinate system should be treated as having northing/easting coordinate ordering.

This function is the same as OGRSpatialReference::EPSGTreatsAsNorthingEasting().

Since

OGR 1.10.0

const char *OSRGetAxis(OGRSpatialReferenceH hSRS, const char *pszTargetKey, int iAxis, OGRAxisOrientation *peOrientation)

Fetch the orientation of one axis.

This method is the equivalent of the C++ method OGRSpatialReference::GetAxis

int OSRGetAxesCount(OGRSpatialReferenceH hSRS)

Return the number of axis of the coordinate system of the CRS.

This method is the equivalent of the C++ method OGRSpatialReference::GetAxesCount()

Since

GDAL 3.1

OGRErr OSRSetAxes(OGRSpatialReferenceH hSRS, const char *pszTargetKey, const char *pszXAxisName, OGRAxisOrientation eXAxisOrientation, const char *pszYAxisName, OGRAxisOrientation eYAxisOrientation)

Set the axes for a coordinate system.

This method is the equivalent of the C++ method OGRSpatialReference::SetAxes

OSRAxisMappingStrategy OSRGetAxisMappingStrategy(OGRSpatialReferenceH hSRS)

Retun the data axis to CRS axis mapping strategy.

See OGRSpatialReference::GetAxisMappingStrategy()

Since

GDAL 3.0

void OSRSetAxisMappingStrategy(OGRSpatialReferenceH hSRS, OSRAxisMappingStrategy strategy)

Set the data axis to CRS axis mapping strategy.

See OGRSpatialReference::SetAxisMappingStrategy()

Since

GDAL 3.0

const int *OSRGetDataAxisToSRSAxisMapping(OGRSpatialReferenceH hSRS, int *pnCount)

Return the data axis to SRS axis mapping.

See OGRSpatialReference::GetDataAxisToSRSAxisMapping()

Since

GDAL 3.0

OGRErr OSRSetDataAxisToSRSAxisMapping(OGRSpatialReferenceH hSRS, int nMappingSize, const int *panMapping)

Set a custom data axis to CRS axis mapping.

s Automatically implies SetAxisMappingStrategy(OAMS_CUSTOM)

See OGRSpatialReference::SetDataAxisToSRSAxisMapping()

Since

GDAL 3.1

OGRErr OSRSetACEA(OGRSpatialReferenceH hSRS, double dfStdP1, double dfStdP2, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

Albers Conic Equal Area.

OGRErr OSRSetAE(OGRSpatialReferenceH hSRS, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

Azimuthal Equidistant.

OGRErr OSRSetBonne(OGRSpatialReferenceH hSRS, double dfStandardParallel, double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)

Bonne.

OGRErr OSRSetCEA(OGRSpatialReferenceH hSRS, double dfStdP1, double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)

Cylindrical Equal Area.

OGRErr OSRSetCS(OGRSpatialReferenceH hSRS, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

Cassini-Soldner.

OGRErr OSRSetEC(OGRSpatialReferenceH hSRS, double dfStdP1, double dfStdP2, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

Equidistant Conic.

OGRErr OSRSetEckert(OGRSpatialReferenceH hSRS, int nVariation, double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)

Eckert I-VI.

OGRErr OSRSetEckertIV(OGRSpatialReferenceH hSRS, double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)

Eckert IV.

OGRErr OSRSetEckertVI(OGRSpatialReferenceH hSRS, double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)

Eckert VI.

OGRErr OSRSetEquirectangular(OGRSpatialReferenceH hSRS, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

Equirectangular.

OGRErr OSRSetEquirectangular2(OGRSpatialReferenceH hSRS, double dfCenterLat, double dfCenterLong, double dfPseudoStdParallel1, double dfFalseEasting, double dfFalseNorthing)

Equirectangular generalized form.

OGRErr OSRSetGS(OGRSpatialReferenceH hSRS, double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)

Gall Stereograpic.

OGRErr OSRSetGH(OGRSpatialReferenceH hSRS, double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)

Goode Homolosine.

OGRErr OSRSetIGH(OGRSpatialReferenceH hSRS)

Interrupted Goode Homolosine.

OGRErr OSRSetGEOS(OGRSpatialReferenceH hSRS, double dfCentralMeridian, double dfSatelliteHeight, double dfFalseEasting, double dfFalseNorthing)

GEOS - Geostationary Satellite View.

OGRErr OSRSetGaussSchreiberTMercator(OGRSpatialReferenceH hSRS, double dfCenterLat, double dfCenterLong, double dfScale, double dfFalseEasting, double dfFalseNorthing)

Gauss Schreiber Transverse Mercator.

OGRErr OSRSetGnomonic(OGRSpatialReferenceH hSRS, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

Gnomonic.

OGRErr OSRSetHOM(OGRSpatialReferenceH hSRS, double dfCenterLat, double dfCenterLong, double dfAzimuth, double dfRectToSkew, double dfScale, double dfFalseEasting, double dfFalseNorthing)

Hotine Oblique Mercator using azimuth angle.

Hotine Oblique Mercator using azimuth angle.

This is the same as the C++ method OGRSpatialReference::SetHOM()

OGRErr OSRSetHOMAC(OGRSpatialReferenceH hSRS, double dfCenterLat, double dfCenterLong, double dfAzimuth, double dfRectToSkew, double dfScale, double dfFalseEasting, double dfFalseNorthing)

Set an Oblique Mercator projection using azimuth angle.

This is the same as the C++ method OGRSpatialReference::SetHOMAC()

OGRErr OSRSetHOM2PNO(OGRSpatialReferenceH hSRS, double dfCenterLat, double dfLat1, double dfLong1, double dfLat2, double dfLong2, double dfScale, double dfFalseEasting, double dfFalseNorthing)

Hotine Oblique Mercator using two points on centerline.

Hotine Oblique Mercator using two points on centerline.

This is the same as the C++ method OGRSpatialReference::SetHOM2PNO()

OGRErr OSRSetIWMPolyconic(OGRSpatialReferenceH hSRS, double dfLat1, double dfLat2, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

International Map of the World Polyconic.

OGRErr OSRSetKrovak(OGRSpatialReferenceH hSRS, double dfCenterLat, double dfCenterLong, double dfAzimuth, double dfPseudoStdParallelLat, double dfScale, double dfFalseEasting, double dfFalseNorthing)

Krovak Oblique Conic Conformal.

OGRErr OSRSetLAEA(OGRSpatialReferenceH hSRS, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

Lambert Azimuthal Equal-Area.

OGRErr OSRSetLCC(OGRSpatialReferenceH hSRS, double dfStdP1, double dfStdP2, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

Lambert Conformal Conic.

OGRErr OSRSetLCC1SP(OGRSpatialReferenceH hSRS, double dfCenterLat, double dfCenterLong, double dfScale, double dfFalseEasting, double dfFalseNorthing)

Lambert Conformal Conic 1SP.

OGRErr OSRSetLCCB(OGRSpatialReferenceH hSRS, double dfStdP1, double dfStdP2, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

Lambert Conformal Conic (Belgium)

OGRErr OSRSetMC(OGRSpatialReferenceH hSRS, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

Miller Cylindrical.

OGRErr OSRSetMercator(OGRSpatialReferenceH hSRS, double dfCenterLat, double dfCenterLong, double dfScale, double dfFalseEasting, double dfFalseNorthing)

Mercator.

OGRErr OSRSetMercator2SP(OGRSpatialReferenceH hSRS, double dfStdP1, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

Mercator 2SP.

OGRErr OSRSetMollweide(OGRSpatialReferenceH hSRS, double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)

Mollweide.

OGRErr OSRSetNZMG(OGRSpatialReferenceH hSRS, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

New Zealand Map Grid.

OGRErr OSRSetOS(OGRSpatialReferenceH hSRS, double dfOriginLat, double dfCMeridian, double dfScale, double dfFalseEasting, double dfFalseNorthing)

Oblique Stereographic.

OGRErr OSRSetOrthographic(OGRSpatialReferenceH hSRS, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

Orthographic.

OGRErr OSRSetPolyconic(OGRSpatialReferenceH hSRS, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

Polyconic.

OGRErr OSRSetPS(OGRSpatialReferenceH hSRS, double dfCenterLat, double dfCenterLong, double dfScale, double dfFalseEasting, double dfFalseNorthing)

Polar Stereographic.

OGRErr OSRSetRobinson(OGRSpatialReferenceH hSRS, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

Robinson.

OGRErr OSRSetSinusoidal(OGRSpatialReferenceH hSRS, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

Sinusoidal.

OGRErr OSRSetStereographic(OGRSpatialReferenceH hSRS, double dfCenterLat, double dfCenterLong, double dfScale, double dfFalseEasting, double dfFalseNorthing)

Stereographic.

OGRErr OSRSetSOC(OGRSpatialReferenceH hSRS, double dfLatitudeOfOrigin, double dfCentralMeridian, double dfFalseEasting, double dfFalseNorthing)

Swiss Oblique Cylindrical.

OGRErr OSRSetTM(OGRSpatialReferenceH hSRS, double dfCenterLat, double dfCenterLong, double dfScale, double dfFalseEasting, double dfFalseNorthing)

Transverse Mercator.

Special processing available for Transverse Mercator with GDAL >= 1.10 and PROJ >= 4.8 : see OGRSpatialReference::exportToProj4().

OGRErr OSRSetTMVariant(OGRSpatialReferenceH hSRS, const char *pszVariantName, double dfCenterLat, double dfCenterLong, double dfScale, double dfFalseEasting, double dfFalseNorthing)

Transverse Mercator variant.

OGRErr OSRSetTMG(OGRSpatialReferenceH hSRS, double dfCenterLat, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

Tunesia Mining Grid.

OGRErr OSRSetTMSO(OGRSpatialReferenceH hSRS, double dfCenterLat, double dfCenterLong, double dfScale, double dfFalseEasting, double dfFalseNorthing)

Transverse Mercator (South Oriented)

OGRErr OSRSetTPED(OGRSpatialReferenceH hSRS, double dfLat1, double dfLong1, double dfLat2, double dfLong2, double dfFalseEasting, double dfFalseNorthing)

TPED (Two Point Equi Distant)

OGRErr OSRSetVDG(OGRSpatialReferenceH hSRS, double dfCenterLong, double dfFalseEasting, double dfFalseNorthing)

VanDerGrinten.

OGRErr OSRSetWagner(OGRSpatialReferenceH hSRS, int nVariation, double dfCenterLat, double dfFalseEasting, double dfFalseNorthing)

Wagner I VII.

OGRErr OSRSetQSC(OGRSpatialReferenceH hSRS, double dfCenterLat, double dfCenterLong)

Quadrilateralized Spherical Cube.

OGRErr OSRSetSCH(OGRSpatialReferenceH hSRS, double dfPegLat, double dfPegLong, double dfPegHeading, double dfPegHgt)

Spherical, Cross-track, Height.

OGRErr OSRSetVerticalPerspective(OGRSpatialReferenceH hSRS, double dfTopoOriginLat, double dfTopoOriginLon, double dfTopoOriginHeight, double dfViewPointHeight, double dfFalseEasting, double dfFalseNorthing)

Vertical Perspective / Near-sided Perspective.

double OSRCalcInvFlattening(double dfSemiMajor, double dfSemiMinor)

Compute inverse flattening from semi-major and semi-minor axis.

Return

inverse flattening, or 0 if both axis are equal.

Since

GDAL 2.0

Parameters
  • dfSemiMajor: Semi-major axis length.

  • dfSemiMinor: Semi-minor axis length.

double OSRCalcSemiMinorFromInvFlattening(double dfSemiMajor, double dfInvFlattening)

Compute semi-minor axis from semi-major axis and inverse flattening.

Return

semi-minor axis

Since

GDAL 2.0

Parameters
  • dfSemiMajor: Semi-major axis length.

  • dfInvFlattening: Inverse flattening or 0 for sphere.

void OSRCleanup(void)

Cleanup cached SRS related memory.

This function will attempt to cleanup any cache spatial reference related information, such as cached tables of coordinate systems.

OSRCRSInfo **OSRGetCRSInfoListFromDatabase(const char *pszAuthName, const OSRCRSListParameters *params, int *pnOutResultCount)

Enumerate CRS objects from the database.

The returned object is an array of OSRCRSInfo* pointers, whose last entry is NULL. This array should be freed with OSRDestroyCRSInfoList()

Return

an array of OSRCRSInfo* pointers to be freed with OSRDestroyCRSInfoList(), or NULL in case of error.

Since

GDAL 3.0

Parameters
  • pszAuthName: Authority name, used to restrict the search. Or NULL for all authorities.

  • params: Additional criteria. Must be set to NULL for now.

  • pnOutResultCount: Output parameter pointing to an integer to receive the size of the result list. Might be NULL

void OSRDestroyCRSInfoList(OSRCRSInfo **list)

Destroy the result returned by OSRGetCRSInfoListFromDatabase().

Since

GDAL 3.0

OGRCoordinateTransformationH OCTNewCoordinateTransformation(OGRSpatialReferenceH hSourceSRS, OGRSpatialReferenceH hTargetSRS)

Create transformation object.

This is the same as the C++ function OGRCreateCoordinateTransformation(const OGRSpatialReference *, const OGRSpatialReference *)

Input spatial reference system objects are assigned by copy (calling clone() method) and no ownership transfer occurs.

OCTDestroyCoordinateTransformation() should be used to destroy transformation objects.

This will honour the axis order advertized by the source and target SRS, as well as their “data axis to SRS axis mapping”. To have a behaviour similar to GDAL < 3.0, the OGR_CT_FORCE_TRADITIONAL_GIS_ORDER configuration option can be set to YES.

Return

NULL on failure or a ready to use transformation object.

Parameters
  • hSourceSRS: source spatial reference system.

  • hTargetSRS: target spatial reference system.

OGRCoordinateTransformationOptionsH OCTNewCoordinateTransformationOptions(void)

Create coordinate transformation options.

To be freed with OCTDestroyCoordinateTransformationOptions()

Since

GDAL 3.0

int OCTCoordinateTransformationOptionsSetOperation(OGRCoordinateTransformationOptionsH hOptions, const char *pszCO, int bReverseCO)

Sets a coordinate operation.

See OGRCoordinateTransformationOptions::SetCoordinateTransformation()

Since

GDAL 3.0

int OCTCoordinateTransformationOptionsSetAreaOfInterest(OGRCoordinateTransformationOptionsH hOptions, double dfWestLongitudeDeg, double dfSouthLatitudeDeg, double dfEastLongitudeDeg, double dfNorthLatitudeDeg)

Sets an area of interest.

See OGRCoordinateTransformationOptions::SetAreaOfInterest()

Since

GDAL 3.0

void OCTDestroyCoordinateTransformationOptions(OGRCoordinateTransformationOptionsH hOptions)

Destroy coordinate transformation options.

Since

GDAL 3.0

OGRCoordinateTransformationH OCTNewCoordinateTransformationEx(OGRSpatialReferenceH hSourceSRS, OGRSpatialReferenceH hTargetSRS, OGRCoordinateTransformationOptionsH hOptions)

Create transformation object.

This is the same as the C++ function OGRCreateCoordinateTransformation(const OGRSpatialReference *, const OGRSpatialReference *, const OGRCoordinateTransformationOptions& )

Input spatial reference system objects are assigned by copy (calling clone() method) and no ownership transfer occurs.

OCTDestroyCoordinateTransformation() should be used to destroy transformation objects.

The source SRS and target SRS should generally not be NULL. This is only allowed if a custom coordinate operation is set through the hOptions argument.

This will honour the axis order advertized by the source and target SRS, as well as their “data axis to SRS axis mapping”. To have a behaviour similar to GDAL < 3.0, the OGR_CT_FORCE_TRADITIONAL_GIS_ORDER configuration option can be set to YES.

If options contains a user defined coordinate transformation pipeline, it will be unconditionally used. If options has an area of interest defined, it will be used to research the best fitting coordinate transformation (which will be used for all coordinate transformations, even if they don’t fall into the declared area of interest) If no options are set, then a list of candidate coordinate operations will be reseached, and at each call to Transform(), the best of those candidate regarding the centroid of the coordinate set will be dynamically selected.

Return

NULL on failure or a ready to use transformation object.

Since

GDAL 3.0

Parameters
  • hSourceSRS: source spatial reference system.

  • hTargetSRS: target spatial reference system.

  • hOptions: Coordinate transformation options.

void OCTDestroyCoordinateTransformation(OGRCoordinateTransformationH hCT)

OGRCoordinateTransformation destructor.

This function is the same as OGRCoordinateTransformation::DestroyCT()

Parameters
  • hCT: the object to delete

int OCTTransform(OGRCoordinateTransformationH hCT, int nCount, double *x, double *y, double *z)

Transform an array of points.

Return

TRUE or FALSE

Parameters
  • hTransform: Transformation object

  • nCount: Number of points

  • x: Array of nCount x values.

  • y: Array of nCount y values.

  • z: Array of nCount z values.

int OCTTransformEx(OGRCoordinateTransformationH hCT, int nCount, double *x, double *y, double *z, int *pabSuccess)

Transform an array of points.

Return

TRUE or FALSE

Parameters
  • hTransform: Transformation object

  • nCount: Number of points

  • x: Array of nCount x values.

  • y: Array of nCount y values.

  • z: Array of nCount z values.

  • pabSuccess: Output array of nCount value that will be set to TRUE/FALSE

int OCTTransform4D(OGRCoordinateTransformationH hCT, int nCount, double *x, double *y, double *z, double *t, int *pabSuccess)

Transform an array of points.

Since

GDAL 3.0

Return

TRUE or FALSE

Parameters
  • hTransform: Transformation object

  • nCount: Number of points

  • x: Array of nCount x values. Should not be NULL

  • y: Array of nCount y values. Should not be NULL

  • z: Array of nCount z values. Might be NULL

  • t: Array of nCount time values. Might be NULL

  • pabSuccess: Output array of nCount value that will be set to TRUE/FALSE. Might be NULL.

struct OSRCRSInfo
#include <ogr_srs_api.h>

Structure given overall description of a CRS.

This structure may grow over time, and should not be directly allocated by client code.

Public Members

char *pszAuthName

Authority name.

char *pszCode

Object code.

char *pszName

Object name.

OSRCRSType eType

Object type.

int bDeprecated

Whether the object is deprecated.

int bBboxValid

Whereas the west_lon_degree, south_lat_degree, east_lon_degree and north_lat_degree fields are valid.

double dfWestLongitudeDeg

Western-most longitude of the area of use, in degrees.

double dfSouthLatitudeDeg

Southern-most latitude of the area of use, in degrees.

double dfEastLongitudeDeg

Eastern-most longitude of the area of use, in degrees.

double dfNorthLatitudeDeg

Northern-most latitude of the area of use, in degrees.

char *pszAreaName

Name of the area of use.

char *pszProjectionMethod

Name of the projection method for a projected CRS.

Might be NULL even for projected CRS in some cases.