PROJ C++ API
Macros | Typedefs | Enumerations | Functions
proj.h File Reference
#include <stddef.h>
Include dependency graph for proj.h:

Go to the source code of this file.

Typedefs

typedef char ** PROJ_STRING_LIST
 Type representing a NULL terminated list of NUL-terminate strings.
 

Enumerations

enum  PJ_OBJ_CATEGORY { PJ_OBJ_CATEGORY_ELLIPSOID, PJ_OBJ_CATEGORY_DATUM, PJ_OBJ_CATEGORY_CRS, PJ_OBJ_CATEGORY_COORDINATE_OPERATION }
 Object category.
 
enum  PJ_OBJ_TYPE {
  PJ_OBJ_TYPE_ELLIPSOID, PJ_OBJ_TYPE_GEODETIC_REFERENCE_FRAME, PJ_OBJ_TYPE_DYNAMIC_GEODETIC_REFERENCE_FRAME, PJ_OBJ_TYPE_VERTICAL_REFERENCE_FRAME,
  PJ_OBJ_TYPE_DYNAMIC_VERTICAL_REFERENCE_FRAME, PJ_OBJ_TYPE_DATUM_ENSEMBLE, PJ_OBJ_TYPE_GEODETIC_CRS, PJ_OBJ_TYPE_GEOGRAPHIC_CRS,
  PJ_OBJ_TYPE_VERTICAL_CRS, PJ_OBJ_TYPE_PROJECTED_CRS, PJ_OBJ_TYPE_COMPOUND_CRS, PJ_OBJ_TYPE_TEMPORAL_CRS,
  PJ_OBJ_TYPE_BOUND_CRS, PJ_OBJ_TYPE_OTHER_CRS, PJ_OBJ_TYPE_CONVERSION, PJ_OBJ_TYPE_TRANSFORMATION,
  PJ_OBJ_TYPE_CONCATENATED_OPERATION, PJ_OBJ_TYPE_OTHER_COORDINATE_OPERATION, PJ_OBJ_TYPE_UNKNOWN
}
 Object type.
 
enum  PJ_WKT_TYPE {
  PJ_WKT2_2018, PJ_WKT2_2018_SIMPLIFIED, PJ_WKT2_2015, PJ_WKT2_2015_SIMPLIFIED,
  PJ_WKT1_GDAL
}
 WKT version. More...
 
enum  PJ_PROJ_STRING_TYPE { PJ_PROJ_5, PJ_PROJ_4 }
 PROJ string version. More...
 
enum  PROJ_CRS_EXTENT_USE { PJ_CRS_EXTENT_NONE, PJ_CRS_EXTENT_BOTH, PJ_CRS_EXTENT_INTERSECTION, PJ_CRS_EXTENT_SMALLEST }
 
enum  PROJ_SPATIAL_CRITERION { PROJ_SPATIAL_CRITERION_STRICT_CONTAINMENT, PROJ_SPATIAL_CRITERION_PARTIAL_INTERSECTION }
 
enum  PROJ_GRID_AVAILABILITY_USE { PROJ_GRID_AVAILABILITY_USED_FOR_SORTING, PROJ_GRID_AVAILABILITY_DISCARD_OPERATION_IF_MISSING_GRID, PROJ_GRID_AVAILABILITY_IGNORED }
 

Functions

int proj_context_set_database_path (PJ_CONTEXT *ctx, const char *dbPath, const char *const *auxDbPaths)
 Explicitly point to the main PROJ CRS and coordinate operation definition database ("proj.db"), and potentially auxiliary databases with same structure. More...
 
const char * proj_context_get_database_path (PJ_CONTEXT *ctx)
 Returns the path to the database. More...
 
PJ_OBJproj_obj_create_from_user_input (PJ_CONTEXT *ctx, const char *text)
 Instanciate an object from a WKT string, PROJ string or object code (like "EPSG:4326", "urn:ogc:def:crs:EPSG::4326", "urn:ogc:def:coordinateOperation:EPSG::1671"). More...
 
PJ_OBJproj_obj_create_from_wkt (PJ_CONTEXT *ctx, const char *wkt)
 Instanciate an object from a WKT string. More...
 
PJ_OBJproj_obj_create_from_proj_string (PJ_CONTEXT *ctx, const char *proj_string)
 Instanciate an object from a PROJ string. More...
 
PJ_OBJproj_obj_create_from_database (PJ_CONTEXT *ctx, const char *auth_name, const char *code, PJ_OBJ_CATEGORY category, int usePROJAlternativeGridNames, const char *const *options)
 Instanciate an object from a database lookup. More...
 
void proj_obj_unref (PJ_OBJ *obj)
 Drops a reference on an object. More...
 
PJ_OBJ_TYPE proj_obj_get_type (PJ_OBJ *obj)
 Return the type of an object. More...
 
PROJ_STRING_LIST proj_get_authorities_from_database (PJ_CONTEXT *ctx)
 Return the list of authorities used in the database. More...
 
PROJ_STRING_LIST proj_get_codes_from_database (PJ_CONTEXT *ctx, const char *auth_name, PJ_OBJ_TYPE type, int allow_deprecated)
 Returns the set of authority codes of the given object type. More...
 
void proj_free_string_list (PROJ_STRING_LIST list)
 
int proj_obj_is_crs (PJ_OBJ *obj)
 Return whether an object is a CRS. More...
 
const char * proj_obj_get_name (PJ_OBJ *obj)
 Get the name of an object. More...
 
const char * proj_obj_get_id_auth_name (PJ_OBJ *obj, int index)
 Get the authority name / codespace of an identifier of an object. More...
 
const char * proj_obj_get_id_code (PJ_OBJ *obj, int index)
 Get the code of an identifier of an object. More...
 
const char * proj_obj_as_wkt (PJ_OBJ *obj, PJ_WKT_TYPE type, const char *const *options)
 Get a WKT representation of an object. More...
 
const char * proj_obj_as_proj_string (PJ_OBJ *obj, PJ_PROJ_STRING_TYPE type, const char *const *options)
 Get a PROJ string representation of an object. More...
 
PJ_OBJproj_obj_get_source_crs (PJ_OBJ *obj)
 Return the base CRS of a BoundCRS or the source CRS of a CoordinateOperation. More...
 
PJ_OBJproj_obj_get_target_crs (PJ_OBJ *obj)
 Return the hub CRS of a BoundCRS or the target CRS of a CoordinateOperation. More...
 
PJ_OPERATION_FACTORY_CONTEXTproj_create_operation_factory_context (PJ_CONTEXT *ctx, const char *authority)
 Instanciate a context for building coordinate operations between two CRS. More...
 
void proj_operation_factory_context_unref (PJ_OPERATION_FACTORY_CONTEXT *ctxt)
 Drops a reference on an object. More...
 
void proj_operation_factory_context_set_desired_accuracy (PJ_OPERATION_FACTORY_CONTEXT *ctxt, double accuracy)
 Set the desired accuracy of the resulting coordinate transformations. More...
 
void proj_operation_factory_context_set_area_of_interest (PJ_OPERATION_FACTORY_CONTEXT *ctxt, double west_lon, double south_lat, double east_lon, double north_lat)
 Set the desired area of interest for the resulting coordinate transformations. More...
 
void proj_operation_factory_context_set_crs_extent_use (PJ_OPERATION_FACTORY_CONTEXT *ctxt, PROJ_CRS_EXTENT_USE use)
 Set how source and target CRS extent should be used when considering if a transformation can be used (only takes effect if no area of interest is explicitly defined). More...
 
void proj_operation_factory_context_set_spatial_criterion (PJ_OPERATION_FACTORY_CONTEXT *ctxt, PROJ_SPATIAL_CRITERION criterion)
 Set the spatial criterion to use when comparing the area of validity of coordinate operations with the area of interest / area of validity of source and target CRS. More...
 
void proj_operation_factory_context_set_grid_availability_use (PJ_OPERATION_FACTORY_CONTEXT *ctxt, PROJ_GRID_AVAILABILITY_USE use)
 Set how grid availability is used. More...
 
void proj_operation_factory_context_set_use_proj_alternative_grid_names (PJ_OPERATION_FACTORY_CONTEXT *ctxt, int usePROJNames)
 Set whether PROJ alternative grid names should be substituted to the official authority names. More...
 
void proj_operation_factory_context_set_allow_use_intermediate_crs (PJ_OPERATION_FACTORY_CONTEXT *ctxt, int allow)
 Set whether an intermediate pivot CRS can be used for researching coordinate operations between a source and target CRS. More...
 
void proj_operation_factory_context_set_allowed_intermediate_crs (PJ_OPERATION_FACTORY_CONTEXT *ctxt, const char *const *list_of_auth_name_codes)
 Restrict the potential pivot CRSs that can be used when trying to build a coordinate operation between two CRS that have no direct operation. More...
 
PJ_OPERATION_RESULTproj_obj_create_operations (PJ_OBJ *source_crs, PJ_OBJ *target_crs, PJ_OPERATION_FACTORY_CONTEXT *operationContext)
 Find a list of CoordinateOperation from source_crs to target_crs. More...
 
int proj_operation_result_get_count (PJ_OPERATION_RESULT *result)
 Return the number of CoordinateOperation in the result set. More...
 
PJ_OBJproj_operation_result_get (PJ_OPERATION_RESULT *result, int index)
 Return a CoordinateOperation in the result set. More...
 
void proj_operation_result_unref (PJ_OPERATION_RESULT *result)
 Drops a reference on an object. More...
 
PJ_OBJproj_obj_crs_get_geodetic_crs (PJ_OBJ *crs)
 Get the geodeticCRS / geographicCRS from a CRS. More...
 
PJ_OBJproj_obj_crs_get_horizontal_datum (PJ_OBJ *crs)
 Get the horizontal datum from a CRS. More...
 
PJ_OBJproj_obj_crs_get_sub_crs (PJ_OBJ *crs, int index)
 Get a CRS component from a CompoundCRS. More...
 
PJ_OBJproj_obj_crs_create_bound_crs_to_WGS84 (PJ_OBJ *crs)
 Returns potentially a BoundCRS, with a transformation to EPSG:4326, wrapping this CRS. More...
 
PJ_OBJproj_obj_get_ellipsoid (PJ_OBJ *obj)
 Get the ellipsoid from a CRS or a GeodeticReferenceFrame. More...
 
int proj_obj_ellipsoid_get_parameters (PJ_OBJ *ellipsoid, double *pSemiMajorMetre, double *pSemiMinorMetre, int *pIsSemiMinorComputed, double *pInverseFlattening)
 Return ellipsoid parameters. More...
 
PJ_OBJproj_obj_get_prime_meridian (PJ_OBJ *obj)
 Get the prime meridian of a CRS or a GeodeticReferenceFrame. More...
 
int proj_obj_prime_meridian_get_parameters (PJ_OBJ *prime_meridian, double *pLongitude, double *pLongitudeUnitConvFactor, const char **pLongitudeUnitName)
 Return prime meridian parameters. More...
 
PJ_OBJproj_obj_crs_get_coordoperation (PJ_OBJ *crs, const char **pMethodName, const char **pMethodAuthorityName, const char **pMethodCode)
 Return the Conversion of a DerivedCRS (such as a ProjectedCRS), or the Transformation from the baseCRS to the hubCRS of a BoundCRS. More...
 
int proj_coordoperation_is_instanciable (PJ_OBJ *coordoperation)
 Return whether a coordinate operation can be instanciated as a PROJ pipeline, checking in particular that referenced grids are available. More...
 
int proj_coordoperation_get_param_count (PJ_OBJ *coordoperation)
 Return the number of parameters of a SingleOperation. More...
 
int proj_coordoperation_get_param_index (PJ_OBJ *coordoperation, const char *name)
 Return the index of a parameter of a SingleOperation. More...
 
int proj_coordoperation_get_param (PJ_OBJ *coordoperation, int index, const char **pName, const char **pNameAuthorityName, const char **pNameCode, double *pValue, const char **pValueString, double *pValueUnitConvFactor, const char **pValueUnitName)
 Return a parameter of a SingleOperation. More...
 
int proj_coordoperation_get_grid_used_count (PJ_OBJ *coordoperation)
 Return the number of grids used by a CoordinateOperation. More...
 
int proj_coordoperation_get_grid_used (PJ_OBJ *coordoperation, int index, const char **pShortName, const char **pFullName, const char **pPackageName, const char **pURL, int *pDirectDownload, int *pOpenLicense, int *pAvailable)
 Return a parameter of a SingleOperation. More...
 

Detailed Description

C API new generation

Enumeration Type Documentation

Specify how source and target CRS extent should be used to restrict candidate operations (only taken into account if no explicit area of interest is specified.

Enumerator
PJ_CRS_EXTENT_NONE 

Ignore CRS extent

PJ_CRS_EXTENT_BOTH 

Test coordinate operation extent against both CRS extent.

PJ_CRS_EXTENT_INTERSECTION 

Test coordinate operation extent against the intersection of both CRS extent.

PJ_CRS_EXTENT_SMALLEST 

Test coordinate operation against the smallest of both CRS extent.

Describe how grid availability is used.

Enumerator
PROJ_GRID_AVAILABILITY_USED_FOR_SORTING 

Grid availability is only used for sorting results. Operations where some grids are missing will be sorted last.

PROJ_GRID_AVAILABILITY_DISCARD_OPERATION_IF_MISSING_GRID 

Completely discard an operation if a required grid is missing.

PROJ_GRID_AVAILABILITY_IGNORED 

Ignore grid availability at all. Results will be presented as if all grids were available.

Spatial criterion to restrict candiate operations.

Enumerator
PROJ_SPATIAL_CRITERION_STRICT_CONTAINMENT 

The area of validity of transforms should strictly contain the are of interest.

PROJ_SPATIAL_CRITERION_PARTIAL_INTERSECTION 

The area of validity of transforms should at least intersect the area of interest.

Function Documentation

const char* proj_context_get_database_path ( PJ_CONTEXT *  ctx)

Returns the path to the database.

The returned pointer remains valid while ctx is valid, and until proj_context_set_database_path() is called.

Parameters
ctxPROJ context, or NULL for default context
Returns
path, or nullptr
int proj_context_set_database_path ( PJ_CONTEXT *  ctx,
const char *  dbPath,
const char *const *  auxDbPaths 
)

Explicitly point to the main PROJ CRS and coordinate operation definition database ("proj.db"), and potentially auxiliary databases with same structure.

Parameters
ctxPROJ context, or NULL for default context
dbPathPath to main database, or NULL for default.
auxDbPathsNULL-terminated list of auxiliary database filenames, or NULL.
Returns
TRUE in case of success
int proj_coordoperation_get_grid_used ( PJ_OBJ coordoperation,
int  index,
const char **  pShortName,
const char **  pFullName,
const char **  pPackageName,
const char **  pURL,
int *  pDirectDownload,
int *  pOpenLicense,
int *  pAvailable 
)

Return a parameter of a SingleOperation.

Parameters
coordoperationObjet of type SingleOperation or derived classes (must not be NULL)
indexParameter index.
pShortNamePointer to a string value to store the grid short name. or NULL
pFullNamePointer to a string value to store the grid full filename. or NULL
pPackageNamePointer to a string value to store the package name where the grid might be found. or NULL
pURLPointer to a string value to store the grid URL or the package URL where the grid might be found. or NULL
pDirectDownloadPointer to a int (boolean) value to store whether *pURL can be downloaded directly. or NULL
pOpenLicensePointer to a int (boolean) value to store whether the grid is released with an open license. or NULL
pAvailablePointer to a int (boolean) value to store whether the grid is available at runtime. or NULL
Returns
TRUE in case of success.
int proj_coordoperation_get_grid_used_count ( PJ_OBJ coordoperation)

Return the number of grids used by a CoordinateOperation.

Parameters
coordoperationObjet of type CoordinateOperation or derived classes (must not be NULL)
int proj_coordoperation_get_param ( PJ_OBJ coordoperation,
int  index,
const char **  pName,
const char **  pNameAuthorityName,
const char **  pNameCode,
double *  pValue,
const char **  pValueString,
double *  pValueUnitConvFactor,
const char **  pValueUnitName 
)

Return a parameter of a SingleOperation.

Parameters
coordoperationObjet of type SingleOperation or derived classes (must not be NULL)
indexParameter index.
pNamePointer to a string value to store the parameter name. or NULL
pNameAuthorityNamePointer to a string value to store the parameter authority name. or NULL
pNameCodePointer to a string value to store the parameter code. or NULL
pValuePointer to a double value to store the parameter value (if numeric). or NULL
pValueStringPointer to a string value to store the parameter value (if of type string). or NULL
pValueUnitConvFactorPointer to a double value to store the parameter unit conversion factor. or NULL
pValueUnitNamePointer to a string value to store the parameter unit name. or NULL
Returns
TRUE in case of success.
int proj_coordoperation_get_param_count ( PJ_OBJ coordoperation)

Return the number of parameters of a SingleOperation.

Parameters
coordoperationObjet of type SingleOperation or derived classes (must not be NULL)
int proj_coordoperation_get_param_index ( PJ_OBJ coordoperation,
const char *  name 
)

Return the index of a parameter of a SingleOperation.

Parameters
coordoperationObjet of type SingleOperation or derived classes (must not be NULL)
nameParameter name. Must not be NULL
Returns
index (>=0), or -1 in case of error.
int proj_coordoperation_is_instanciable ( PJ_OBJ coordoperation)

Return whether a coordinate operation can be instanciated as a PROJ pipeline, checking in particular that referenced grids are available.

Parameters
coordoperationObjet of type CoordinateOperation or derived classes (must not be NULL)
Returns
TRUE or FALSE.
PJ_OPERATION_FACTORY_CONTEXT* proj_create_operation_factory_context ( PJ_CONTEXT *  ctx,
const char *  authority 
)

Instanciate a context for building coordinate operations between two CRS.

The returned object must be unreferenced with proj_operation_factory_context_unref() after use.

Parameters
ctxContext, or NULL for default context.
authorityName of authority to which to restrict the search of canidate operations. Or NULL to allow any authority.
Returns
Object that must be unreferenced with proj_operation_factory_context_unref(), or NULL in case of error.
void proj_free_string_list ( PROJ_STRING_LIST  list)

Free a list of NULL terminated strings.

PROJ_STRING_LIST proj_get_authorities_from_database ( PJ_CONTEXT *  ctx)

Return the list of authorities used in the database.

The returned list is NULL terminated and must be freed with proj_free_string_list().

Parameters
ctxPROJ context, or NULL for default context
Returns
a NULL terminated list of NUL-terminated strings that must be freed with proj_free_string_list(), or NULL in case of error.
PROJ_STRING_LIST proj_get_codes_from_database ( PJ_CONTEXT *  ctx,
const char *  auth_name,
PJ_OBJ_TYPE  type,
int  allow_deprecated 
)

Returns the set of authority codes of the given object type.

The returned list is NULL terminated and must be freed with proj_free_string_list().

Parameters
ctxPROJ context, or NULL for default context.
auth_nameAuthority name (must not be NULL)
typeObject type.
allow_deprecatedwhether we should return deprecated objects as well.
Returns
a NULL terminated list of NUL-terminated strings that must be freed with proj_free_string_list(), or NULL in case of error.
const char* proj_obj_as_proj_string ( PJ_OBJ obj,
PJ_PROJ_STRING_TYPE  type,
const char *const *  options 
)

Get a PROJ string representation of an object.

The lifetime of the returned string is the same as the input obj parameter.

This function calls osgeo::proj::io::IPROJStringExportable::exportToPROJString().

This function may return NULL if the object is not compatible with an export to the requested type.

Parameters
objObject (must not be NULL)
typePROJ String version.
optionsNULL-terminated list of strings with "KEY=VALUE" format. or NULL. The currently recognized option is USE_ETMERC=YES to use +proj=etmerc instead of +proj=tmerc
Returns
a string, or NULL in case of error.
const char* proj_obj_as_wkt ( PJ_OBJ obj,
PJ_WKT_TYPE  type,
const char *const *  options 
)

Get a WKT representation of an object.

The lifetime of the returned string is the same as the input obj parameter.

This function calls osgeo::proj::io::IWKTExportable::exportToWKT().

This function may return NULL if the object is not compatible with an export to the requested type.

Parameters
objObject (must not be NULL)
typeWKT version.
optionsshould be set to NULL for now
Returns
a string, or NULL in case of error.
PJ_OBJ* proj_obj_create_from_database ( PJ_CONTEXT *  ctx,
const char *  auth_name,
const char *  code,
PJ_OBJ_CATEGORY  category,
int  usePROJAlternativeGridNames,
const char *const *  options 
)

Instanciate an object from a database lookup.

The returned object must be unreferenced with proj_obj_unref() after use. It should be used by at most one thread at a time.

Parameters
ctxContext, or NULL for default context.
auth_nameAuthority name (must not be NULL)
codeObject code (must not be NULL)
categoryObject category
usePROJAlternativeGridNamesWhether PROJ alternative grid names should be substituted to the official grid names. Only used on transformations
optionsshould be set to NULL for now
Returns
Object that must be unreferenced with proj_obj_unref(), or NULL in case of error.
PJ_OBJ* proj_obj_create_from_proj_string ( PJ_CONTEXT *  ctx,
const char *  proj_string 
)

Instanciate an object from a PROJ string.

This function calls osgeo::proj::io::PROJStringParser::createFromPROJString()

The returned object must be unreferenced with proj_obj_unref() after use. It should be used by at most one thread at a time.

Parameters
ctxPROJ context, or NULL for default context
proj_stringPROJ string (must not be NULL)
Returns
Object that must be unreferenced with proj_obj_unref(), or NULL in case of error.
PJ_OBJ* proj_obj_create_from_user_input ( PJ_CONTEXT *  ctx,
const char *  text 
)

Instanciate an object from a WKT string, PROJ string or object code (like "EPSG:4326", "urn:ogc:def:crs:EPSG::4326", "urn:ogc:def:coordinateOperation:EPSG::1671").

This function calls osgeo::proj::io::createFromUserInput()

The returned object must be unreferenced with proj_obj_unref() after use. It should be used by at most one thread at a time.

Parameters
ctxPROJ context, or NULL for default context
textString (must not be NULL)
Returns
Object that must be unreferenced with proj_obj_unref(), or NULL in case of error.
PJ_OBJ* proj_obj_create_from_wkt ( PJ_CONTEXT *  ctx,
const char *  wkt 
)

Instanciate an object from a WKT string.

This function calls osgeo::proj::io::WKTParser::createFromWKT()

The returned object must be unreferenced with proj_obj_unref() after use. It should be used by at most one thread at a time.

Parameters
ctxPROJ context, or NULL for default context
wktWKT string (must not be NULL)
Returns
Object that must be unreferenced with proj_obj_unref(), or NULL in case of error.
PJ_OPERATION_RESULT* proj_obj_create_operations ( PJ_OBJ source_crs,
PJ_OBJ target_crs,
PJ_OPERATION_FACTORY_CONTEXT operationContext 
)

Find a list of CoordinateOperation from source_crs to target_crs.

The operations are sorted with the most relevant ones first: by descending area (intersection of the transformation area with the area of interest, or intersection of the transformation with the area of use of the CRS), and by increasing accuracy. Operations with unknown accuracy are sorted last, whatever their area.

Parameters
source_crssource CRS. Must not be NULL.
target_crssource CRS. Must not be NULL.
operationContextSearch context. Must not be NULL.
Returns
a result set that must be unreferenced with proj_operation_result_unref(), or NULL in case of error.
PJ_OBJ* proj_obj_crs_create_bound_crs_to_WGS84 ( PJ_OBJ crs)

Returns potentially a BoundCRS, with a transformation to EPSG:4326, wrapping this CRS.

The returned object must be unreferenced with proj_obj_unref() after use. It should be used by at most one thread at a time.

This is the same as method osgeo::proj::crs::CRS::createBoundCRSToWGS84IfPossible()

Parameters
crsObjet of type CRS (must not be NULL)
Returns
Object that must be unreferenced with proj_obj_unref(), or NULL in case of error.
PJ_OBJ* proj_obj_crs_get_coordoperation ( PJ_OBJ crs,
const char **  pMethodName,
const char **  pMethodAuthorityName,
const char **  pMethodCode 
)

Return the Conversion of a DerivedCRS (such as a ProjectedCRS), or the Transformation from the baseCRS to the hubCRS of a BoundCRS.

The returned object must be unreferenced with proj_obj_unref() after use. It should be used by at most one thread at a time.

Parameters
crsObjet of type DerivedCRS or BoundCRSs (must not be NULL)
pMethodNamePointer to a string value to store the method (projection) name. or NULL
pMethodAuthorityNamePointer to a string value to store the method authority name. or NULL
pMethodCodePointer to a string value to store the method code. or NULL
Returns
Object of type SingleOperation that must be unreferenced with proj_obj_unref(), or NULL in case of error.
PJ_OBJ* proj_obj_crs_get_geodetic_crs ( PJ_OBJ crs)

Get the geodeticCRS / geographicCRS from a CRS.

The returned object must be unreferenced with proj_obj_unref() after use. It should be used by at most one thread at a time.

Parameters
crsObjet of type CRS (must not be NULL)
Returns
Object that must be unreferenced with proj_obj_unref(), or NULL in case of error.
PJ_OBJ* proj_obj_crs_get_horizontal_datum ( PJ_OBJ crs)

Get the horizontal datum from a CRS.

The returned object must be unreferenced with proj_obj_unref() after use. It should be used by at most one thread at a time.

Parameters
crsObjet of type CRS (must not be NULL)
Returns
Object that must be unreferenced with proj_obj_unref(), or NULL in case of error.
PJ_OBJ* proj_obj_crs_get_sub_crs ( PJ_OBJ crs,
int  index 
)

Get a CRS component from a CompoundCRS.

The returned object must be unreferenced with proj_obj_unref() after use. It should be used by at most one thread at a time.

Parameters
crsObjet of type CRS (must not be NULL)
indexIndex of the CRS component (typically 0 = horizontal, 1 = vertical)
Returns
Object that must be unreferenced with proj_obj_unref(), or NULL in case of error.
int proj_obj_ellipsoid_get_parameters ( PJ_OBJ ellipsoid,
double *  pSemiMajorMetre,
double *  pSemiMinorMetre,
int *  pIsSemiMinorComputed,
double *  pInverseFlattening 
)

Return ellipsoid parameters.

Parameters
ellipsoidObject of type Ellipsoid (must not be NULL)
pSemiMajorMetrePointer to a value to store the semi-major axis in metre. or NULL
pSemiMinorMetrePointer to a value to store the semi-minor axis in metre. or NULL
pIsSemiMinorComputedPointer to a boolean value to indicate if the semi-minor value was computed. If FALSE, its value comes from the definition. or NULL
pInverseFlatteningPointer to a value to store the inverse flattening. or NULL
Returns
TRUE in case of success.
PJ_OBJ* proj_obj_get_ellipsoid ( PJ_OBJ obj)

Get the ellipsoid from a CRS or a GeodeticReferenceFrame.

The returned object must be unreferenced with proj_obj_unref() after use. It should be used by at most one thread at a time.

Parameters
objObjet of type CRS or GeodeticReferenceFrame (must not be NULL)
Returns
Object that must be unreferenced with proj_obj_unref(), or NULL in case of error.
const char* proj_obj_get_id_auth_name ( PJ_OBJ obj,
int  index 
)

Get the authority name / codespace of an identifier of an object.

The lifetime of the returned string is the same as the input obj parameter.

Parameters
objObject (must not be NULL)
indexIndex of the identifier. 0 = first identifier
Returns
a string, or NULL in case of error or missing name.
const char* proj_obj_get_id_code ( PJ_OBJ obj,
int  index 
)

Get the code of an identifier of an object.

The lifetime of the returned string is the same as the input obj parameter.

Parameters
objObject (must not be NULL)
indexIndex of the identifier. 0 = first identifier
Returns
a string, or NULL in case of error or missing name.
const char* proj_obj_get_name ( PJ_OBJ obj)

Get the name of an object.

The lifetime of the returned string is the same as the input obj parameter.

Parameters
objObject (must not be NULL)
Returns
a string, or NULL in case of error or missing name.
PJ_OBJ* proj_obj_get_prime_meridian ( PJ_OBJ obj)

Get the prime meridian of a CRS or a GeodeticReferenceFrame.

The returned object must be unreferenced with proj_obj_unref() after use. It should be used by at most one thread at a time.

Parameters
objObjet of type CRS or GeodeticReferenceFrame (must not be NULL)
Returns
Object that must be unreferenced with proj_obj_unref(), or NULL in case of error.
PJ_OBJ* proj_obj_get_source_crs ( PJ_OBJ obj)

Return the base CRS of a BoundCRS or the source CRS of a CoordinateOperation.

The returned object must be unreferenced with proj_obj_unref() after use. It should be used by at most one thread at a time.

Parameters
objObjet of type BoundCRS or CoordinateOperation (must not be NULL)
Returns
Object that must be unreferenced with proj_obj_unref(), or NULL in case of error, or missing source CRS.
PJ_OBJ* proj_obj_get_target_crs ( PJ_OBJ obj)

Return the hub CRS of a BoundCRS or the target CRS of a CoordinateOperation.

The returned object must be unreferenced with proj_obj_unref() after use. It should be used by at most one thread at a time.

Parameters
objObjet of type BoundCRS or CoordinateOperation (must not be NULL)
Returns
Object that must be unreferenced with proj_obj_unref(), or NULL in case of error, or missing target CRS.
PJ_OBJ_TYPE proj_obj_get_type ( PJ_OBJ obj)

Return the type of an object.

Parameters
objObject (must not be NULL)
Returns
its type.
int proj_obj_is_crs ( PJ_OBJ obj)

Return whether an object is a CRS.

Parameters
objObject (must not be NULL)
int proj_obj_prime_meridian_get_parameters ( PJ_OBJ prime_meridian,
double *  pLongitude,
double *  pLongitudeUnitConvFactor,
const char **  pLongitudeUnitName 
)

Return prime meridian parameters.

Parameters
prime_meridianObject of type PrimeMeridian (must not be NULL)
pLongitudePointer to a value to store the longitude of the prime meridian, in its native unit. or NULL
pLongitudeUnitConvFactorPointer to a value to store the conversion factor of the prime meridian longitude unit to radian. or NULL
pLongitudeUnitNamePointer to a string value to store the unit name. or NULL
Returns
TRUE in case of success.
void proj_obj_unref ( PJ_OBJ obj)

Drops a reference on an object.

This method should be called one and exactly one for each function returning a PJ_OBJ*

Parameters
objObject, or NULL.
void proj_operation_factory_context_set_allow_use_intermediate_crs ( PJ_OPERATION_FACTORY_CONTEXT ctxt,
int  allow 
)

Set whether an intermediate pivot CRS can be used for researching coordinate operations between a source and target CRS.

Concretely if in the database there is an operation from A to C (or C to A), and another one from C to B (or B to C), but no direct operation between A and B, setting this parameter to true, allow chaining both operations.

The current implementation is limited to researching one intermediate step.

By default, all potential C candidates will be used. proj_operation_factory_context_set_allowed_intermediate_crs() can be used to restrict them.

The default is true.

Parameters
ctxtOperation factory context. must not be NULL
allowwhether intermediate CRS may be used.
void proj_operation_factory_context_set_allowed_intermediate_crs ( PJ_OPERATION_FACTORY_CONTEXT ctxt,
const char *const *  list_of_auth_name_codes 
)

Restrict the potential pivot CRSs that can be used when trying to build a coordinate operation between two CRS that have no direct operation.

Parameters
ctxtOperation factory context. must not be NULL
list_of_auth_name_codesan array of strings NLL terminated, with the format { "auth_name1", "code1", "auth_name2", "code2", ... NULL }
void proj_operation_factory_context_set_area_of_interest ( PJ_OPERATION_FACTORY_CONTEXT ctxt,
double  west_lon,
double  south_lat,
double  east_lon,
double  north_lat 
)

Set the desired area of interest for the resulting coordinate transformations.

For an area of interest crossing the anti-meridian, west_lon will be greater than east_lon.

Parameters
ctxtOperation factory context. must not be NULL
west_lonWest longitude (in degrees).
south_latSouth latitude (in degrees).
east_lonEast longitude (in degrees).
north_latNorth latitude (in degrees).
void proj_operation_factory_context_set_crs_extent_use ( PJ_OPERATION_FACTORY_CONTEXT ctxt,
PROJ_CRS_EXTENT_USE  use 
)

Set how source and target CRS extent should be used when considering if a transformation can be used (only takes effect if no area of interest is explicitly defined).

The default is PJ_CRS_EXTENT_SMALLEST.

Parameters
ctxtOperation factory context. must not be NULL
useHow source and target CRS extent should be used.
void proj_operation_factory_context_set_desired_accuracy ( PJ_OPERATION_FACTORY_CONTEXT ctxt,
double  accuracy 
)

Set the desired accuracy of the resulting coordinate transformations.

Parameters
ctxtOperation factory context. must not be NULL
accuracyAccuracy in meter (or 0 to disable the filter).
void proj_operation_factory_context_set_grid_availability_use ( PJ_OPERATION_FACTORY_CONTEXT ctxt,
PROJ_GRID_AVAILABILITY_USE  use 
)

Set how grid availability is used.

The default is USE_FOR_SORTING.

Parameters
ctxtOperation factory context. must not be NULL
usehow grid availability is used.
void proj_operation_factory_context_set_spatial_criterion ( PJ_OPERATION_FACTORY_CONTEXT ctxt,
PROJ_SPATIAL_CRITERION  criterion 
)

Set the spatial criterion to use when comparing the area of validity of coordinate operations with the area of interest / area of validity of source and target CRS.

The default is PROJ_SPATIAL_CRITERION_STRICT_CONTAINMENT.

Parameters
ctxtOperation factory context. must not be NULL
criterionpatial criterion to use
void proj_operation_factory_context_set_use_proj_alternative_grid_names ( PJ_OPERATION_FACTORY_CONTEXT ctxt,
int  usePROJNames 
)

Set whether PROJ alternative grid names should be substituted to the official authority names.

The default is true.

Parameters
ctxtOperation factory context. must not be NULL
usePROJNameswhether PROJ alternative grid names should be used
void proj_operation_factory_context_unref ( PJ_OPERATION_FACTORY_CONTEXT ctxt)

Drops a reference on an object.

This method should be called one and exactly one for each function returning a PJ_OPERATION_FACTORY_CONTEXT*

Parameters
ctxtObject, or NULL.
PJ_OBJ* proj_operation_result_get ( PJ_OPERATION_RESULT result,
int  index 
)

Return a CoordinateOperation in the result set.

The returned object must be unreferenced with proj_obj_unref() after use. It should be used by at most one thread at a time.

Parameters
resultObjet of type PJ_OPERATION_RESULT (must not be NULL)
indexIndex
Returns
a new object that must be unreferenced with proj_obj_unref(), or nullptr in case of error.
int proj_operation_result_get_count ( PJ_OPERATION_RESULT result)

Return the number of CoordinateOperation in the result set.

Parameters
resultObjet of type PJ_OPERATION_RESULT (must not be NULL)
void proj_operation_result_unref ( PJ_OPERATION_RESULT result)

Drops a reference on an object.

This method should be called one and exactly one for each function returning a PJ_OPERATION_RESULT*

Parameters
resultObject, or NULL.