Data types¶
This section describes the numerous data types in use in PROJ.4. As a rule
of thumb PROJ.4 data types are prefixed with PJ_
, or in one particular case,
is simply called PJ
. A few notable exceptions can be traced
back to the very early days of PROJ.4 when the PJ_
prefix was not
consistently used.
Transformation objects¶
-
PJ
¶ Object containing everything related to a given projection or transformation. As a user of the PROJ.4 library you are only exposed to pointers to this object and the contents is hidden behind the public API.
PJ
objects are created withproj_create()
and destroyed withproj_destroy()
.
-
PJ_DIRECTION
¶ Enumeration that is used to convey in which direction a given transformation should be performed. Used in transformation function call as described in the section on transformation functions.
Forward transformations are defined with the :c:
typedef enum proj_direction { PJ_FWD = 1, /* Forward */ PJ_IDENT = 0, /* Do nothing */ PJ_INV = -1 /* Inverse */ } PJ_DIRECTION;
-
PJ_FWD
¶ Perform transformation in the forward direction.
-
PJ_IDENT
¶ Identity. Do nothing.
-
PJ_INV
¶ Perform transformation in the inverse direction.
-
-
PJ_CONTEXT
¶ Context objects enable safe multi-threaded usage of PROJ.4. Each
PJ
object is connected to a context (if not specified, the default context is used). All operations within a context should be performed in the same thread.PJ_CONTEXT
objects are created withproj_context_create()
and destroyed withproj_context_destroy()
.
-
PJ_AREA
¶ New in version 6.0.0.
Opaque object describing an area in which a transformation is performed.
It is used with
proj_create_crs_to_crs()
to select the best transformation between the two input coordinate reference systems.
2 dimensional coordinates¶
Various 2-dimensional coordinate data types.
-
PJ_LP
¶ Geodetic coordinate, latitude and longitude. Usually in radians.
typedef struct { double lam, phi; } PJ_LP;
-
double
PJ_LP.lam
¶ Longitude. Lambda.
-
double
PJ_LP.phi
¶ Latitude. Phi.
-
double
3 dimensional coordinates¶
The following data types are the 3-dimensional equivalents to the data types above.
-
PJ_LPZ
¶ 3-dimensional version of
PJ_LP
. Holds longitude, latitude and a vertical component.typedef struct { double lam, phi, z; } PJ_LPZ;
-
double
PJ_LPZ.lam
¶ Longitude. Lambda.
-
double
PJ_LPZ.phi
¶ Latitude. Phi.
-
double
PJ_LPZ.z
¶ Vertical component.
-
double
-
PJ_XYZ
¶ Cartesian coordinate in 3 dimensions. Extension of
PJ_XY
.typedef struct { double x, y, z; } PJ_XYZ;
-
double
PJ_XYZ.x
¶ Easting or the X component of a 3D cartesian system.
-
double
PJ_XYZ.y
¶ Northing or the Y component of a 3D cartesian system.
-
double
PJ_XYZ.z
¶ Vertical component or the Z component of a 3D cartesian system.
-
double
Spatiotemporal coordinate types¶
The following data types are extensions of the triplets above into the time domain.
-
PJ_LPZT
¶ Spatiotemporal version of
PJ_LPZ
.typedef struct { double lam; double phi; double z; double t; } PJ_LPZT;
-
double
PJ_LPZT.lam
¶ Longitude.
-
double
PJ_LPZT.phi
¶ Latitude
-
double
PJ_LPZT.z
¶ Vertical component.
-
double
PJ_LPZT.t
¶ Time component.
-
double
-
PJ_XYZT
¶ Generic spatiotemporal coordinate. Useful for e.g. cartesian coordinates with an attached time-stamp.
typedef struct { double x; double y; double z; double t; } PJ_XYZT;
-
double
PJ_XYZT.x
¶ Easting or the X component of a 3D cartesian system.
-
double
PJ_XYZT.y
¶ Northing or the Y component of a 3D cartesian system.
-
double
PJ_XYZT.z
¶ Vertical or the Z component of a 3D cartesian system.
-
double
PJ_XYZT.t
¶ Time component.
-
double
Ancillary types for geodetic computations¶
Complex coordinate types¶
-
PJ_COORD
¶ General purpose coordinate union type, applicable in two, three and four dimensions. This is the default coordinate datatype used in PROJ.
typedef union { double v[4]; PJ_XYZT xyzt; PJ_UVWT uvwt; PJ_LPZT lpzt; PJ_XYZ xyz; PJ_UVW uvw; PJ_LPZ lpz; PJ_XY xy; PJ_UV uv; PJ_LP lp; } PJ_COORD ;
-
double v[4]
Generic four-dimensional vector.
-
Projection derivatives¶
-
PJ_FACTORS
¶ Various cartographic properties, such as scale factors, angular distortion and meridian convergence. Calculated with
proj_factors()
.typedef struct { double meridional_scale; double parallel_scale; double areal_scale; double angular_distortion; double meridian_parallel_angle; double meridian_convergence; double tissot_semimajor; double tissot_semiminor; double dx_dlam; double dx_dphi; double dy_dlam; double dy_dphi; } PJ_FACTORS;
-
double
PJ_FACTORS.meridional_scale
¶ Meridional scale at coordinate \(\left(\lambda,\phi\right)\).
-
double
PJ_FACTORS.parallel_scale
¶ Parallel scale at coordinate \(\left(\lambda,\phi\right)\).
-
double
PJ_FACTORS.areal_scale
¶ Areal scale factor at coordinate \(\left(\lambda,\phi\right)\).
-
double
PJ_FACTORS.angular_distortion
¶ Angular distortion at coordinate \(\left(\lambda,\phi\right)\).
-
double
PJ_FACTORS.meridian_parallel_angle
¶ Meridian/parallel angle, \(\theta^\prime\), at coordinate \(\left(\lambda,\phi\right)\).
-
double
PJ_FACTORS.meridian_convergence
¶ Meridian convergence at coordinate \(\left(\lambda,\phi\right)\). Sometimes also described as grid declination.
-
double
-
double
PJ_FACTORS.tissot_semimajor
¶ Maximum scale factor.
-
double
PJ_FACTORS.tissot_semiminor
¶ Minimum scale factor.
-
double
PJ_FACTORS.dx_dlam
¶ Partial derivative \(\frac{\partial x}{\partial \lambda}\) of coordinate \(\left(\lambda,\phi\right)\).
-
double
PJ_FACTORS.dy_dlam
¶ Partial derivative \(\frac{\partial y}{\partial \lambda}\) of coordinate \(\left(\lambda,\phi\right)\).
-
double
PJ_FACTORS.dx_dphi
¶ Partial derivative \(\frac{\partial x}{\partial \phi}\) of coordinate \(\left(\lambda,\phi\right)\).
-
double
PJ_FACTORS.dy_dphi
¶ Partial derivative \(\frac{\partial y}{\partial \phi}\) of coordinate \(\left(\lambda,\phi\right)\).
-
double
List structures¶
-
PJ_OPERATIONS
¶ Description a PROJ.4 operation
struct PJ_OPERATIONS { const char *id; /* operation keyword */ PJ *(*proj)(PJ *); /* operation entry point */ char * const *descr; /* description text */ };
-
const char *
id
¶ Operation keyword.
-
char * const *
Description of operation.
-
const char *
-
PJ_ELLPS
¶ Description of ellipsoids defined in PROJ.4
struct PJ_ELLPS { const char *id; const char *major; const char *ell; const char *name; };
-
const char *
id
¶ Keyword name of the ellipsoid.
-
const char *
major
¶ Semi-major axis of the ellipsoid, or radius in case of a sphere.
-
const char *
ell
¶ Elliptical parameter, e.g. rf=298.257 or b=6356772.2.
-
const char *
name
¶ Name of the ellipsoid
-
const char *
-
PJ_UNITS
¶ Distance units defined in PROJ.
struct PJ_UNITS { const char *id; /* units keyword */ const char *to_meter; /* multiply by value to get meters */ const char *name; /* comments */ double factor; /* to_meter factor in actual numbers */ };
-
const char *
id
¶ Keyword for the unit.
-
const char *
to_meter
¶ Text representation of the factor that converts a given unit to meters
-
const char *
name
¶ Name of the unit.
-
double
factor
¶ Conversion factor that converts the unit to meters.
-
const char *
Info structures¶
-
PJ_INFO
¶ Struct holding information about the current instance of PROJ. Struct is populated by
proj_info()
.typedef struct { int major; int minor; int patch; const char *release; const char *version; const char *searchpath; } PJ_INFO;
-
const char *
PJ_INFO.release
¶ Release info. Version number and release date, e.g. “Rel. 4.9.3, 15 August 2016”.
-
const char *
PJ_INFO.version
¶ Text representation of the full version number, e.g. “4.9.3”.
-
int
PJ_INFO.major
¶ Major version number.
-
int
PJ_INFO.minor
¶ Minor version number.
-
int
PJ_INFO.patch
¶ Patch level of release.
-
const char
PJ_INFO.searchpath
¶ Search path for PROJ. List of directories separated by semicolons (Windows) or colons (non-Windows), e.g. “C:\Users\doctorwho;C:\OSGeo4W64\share\proj”. Grids and init files are looked for in directories in the search path.
-
const char *
-
PJ_PROJ_INFO
¶ Struct holding information about a
PJ
object. Populated byproj_pj_info()
. ThePJ_PROJ_INFO
object provides a view into the internals of aPJ
, so once thePJ
is destroyed or otherwise becomes invalid, so does thePJ_PROJ_INFO
typedef struct { const char *id; const char *description; const char *definition; int has_inverse; double accuracy; } PJ_PROJ_INFO;
-
const char *
PJ_PROJ_INFO.id
¶ Short ID of the operation the
PJ
object is based on, that is, what comes afther the+proj=
in a proj-string, e.g. “merc”.
-
const char *
PJ_PROJ_INFO.description
¶ Long describes of the operation the
PJ
object is based on, e.g. “Mercator Cyl, Sph&Ell lat_ts=”.
-
const char *
PJ_PROJ_INFO.definition
¶ The proj-string that was used to create the
PJ
object with, e.g. “+proj=merc +lat_0=24 +lon_0=53 +ellps=WGS84”.
-
int
PJ_PROJ_INFO.has_inverse
¶ 1 if an inverse mapping of the defined operation exists, otherwise 0.
-
double
PJ_PROJ_INFO.accuracy
¶ Expected accuracy of the transformation. -1 if unknown.
-
const char *
-
PJ_GRID_INFO
¶ Struct holding information about a specific grid in the search path of PROJ. Populated with the function
proj_grid_info()
.typedef struct { char gridname[32]; char filename[260]; char format[8]; LP lowerleft; LP upperright; int n_lon, n_lat; double cs_lon, cs_lat; } PJ_GRID_INFO;
-
char PJ_GRID_INFO.gridname[32]
Name of grid, e.g. “BETA2007.gsb”.
-
char
PJ_GRID_INFO
¶ Full path of grid file, e.g. “C:\OSGeo4W64\share\proj\BETA2007.gsb”
-
char PJ_GRID_INFO.format[8]
File format of grid file, e.g. “ntv2”
-
LP
PJ_GRID_INFO.lowerleft
¶ Geodetic coordinate of lower left corner of grid.
-
LP
PJ_GRID_INFO.upperright
¶ Geodetic coordinate of upper right corner of grid.
-
int
PJ_GRID_INFO.n_lon
¶ Number of grid cells in the longitudinal direction.
-
int
PJ_GRID_INFO.n_lat
¶ Number of grid cells in the latitudianl direction.
-
double
PJ_GRID_INFO.cs_lon
¶ Cell size in the longitudinal direction. In radians.
-
double
PJ_GRID_INFO.cs_lat
¶ Cell size in the latitudinal direction. In radians.
-
-
PJ_INIT_INFO
¶ Struct holding information about a specific init file in the search path of PROJ. Populated with the function
proj_init_info()
.typedef struct { char name[32]; char filename[260]; char version[32]; char origin[32]; char lastupdate[16]; } PJ_INIT_INFO;
-
char PJ_INIT_INFO.name[32]
Name of init file, e.g. “epsg”.
-
char PJ_INIT_INFO.filename[260]
Full path of init file, e.g. “C:\OSGeo4W64\share\proj\epsg”
-
char PJ_INIT_INFO.version[32]
Version number of init-file, e.g. “9.0.0”
-
char PJ_INIT_INFO.origin[32]
Originating entity of the init file, e.g. “EPSG”
-
char
PJ_INIT_INFO.lastupdate
¶ Date of last update of the init-file.
-
Logging¶
-
PJ_LOG_LEVEL
¶ Enum of logging levels in PROJ. Used to set the logging level in PROJ. Usually using
proj_log_level()
.-
PJ_LOG_NONE
¶ Don’t log anything.
-
PJ_LOG_ERROR
¶ Log only errors.
-
PJ_LOG_DEBUG
¶ Log errors and additional debug information.
-
PJ_LOG_TRACE
¶ Highest logging level. Log everything including very detailed debug information.
-
PJ_LOG_TELL
¶ Special logging level that when used in
proj_log_level()
will return the current logging level set in PROJ.
New in version 5.1.0.
-
-
PJ_LOG_FUNC
¶ Function prototype for the logging function used by PROJ. Defined as
typedef void (*PJ_LOG_FUNCTION)(void *, int, const char *);
where the
void
pointer references a data structure used by the calling application, theint
is used to set the logging level and theconst char
pointer is the string that will be logged by the function.New in version 5.1.0.
C API for ISO-19111 functionality¶
-
enum
iso19111_types
::
PJ_GUESSED_WKT_DIALECT
¶ Guessed WKT “dialect”.
Values:
-
PJ_GUESSED_WKT2_2018
= PJ_GUESSED_WKT2_2019¶ Deprecated alias for PJ_GUESSED_WKT2_2019
-
PJ_GUESSED_NOT_WKT
¶ Not WKT / unrecognized
-
-
enum
iso19111_types
::
PJ_CATEGORY
¶ Object category.
Values:
-
PJ_CATEGORY_ELLIPSOID
¶
-
PJ_CATEGORY_PRIME_MERIDIAN
¶
-
PJ_CATEGORY_DATUM
¶
-
PJ_CATEGORY_CRS
¶
-
PJ_CATEGORY_COORDINATE_OPERATION
¶
-
-
enum
iso19111_types
::
PJ_TYPE
¶ Object type.
Values:
-
PJ_TYPE_UNKNOWN
¶
-
PJ_TYPE_ELLIPSOID
¶
-
PJ_TYPE_PRIME_MERIDIAN
¶
-
PJ_TYPE_GEODETIC_REFERENCE_FRAME
¶
-
PJ_TYPE_DYNAMIC_GEODETIC_REFERENCE_FRAME
¶
-
PJ_TYPE_VERTICAL_REFERENCE_FRAME
¶
-
PJ_TYPE_DYNAMIC_VERTICAL_REFERENCE_FRAME
¶
-
PJ_TYPE_DATUM_ENSEMBLE
¶
-
PJ_TYPE_CRS
¶ Abstract type, not returned by proj_get_type()
-
PJ_TYPE_GEODETIC_CRS
¶
-
PJ_TYPE_GEOCENTRIC_CRS
¶
-
PJ_TYPE_GEOGRAPHIC_CRS
¶ proj_get_type() will never return that type, but PJ_TYPE_GEOGRAPHIC_2D_CRS or PJ_TYPE_GEOGRAPHIC_3D_CRS.
-
PJ_TYPE_GEOGRAPHIC_2D_CRS
¶
-
PJ_TYPE_GEOGRAPHIC_3D_CRS
¶
-
PJ_TYPE_VERTICAL_CRS
¶
-
PJ_TYPE_PROJECTED_CRS
¶
-
PJ_TYPE_COMPOUND_CRS
¶
-
PJ_TYPE_TEMPORAL_CRS
¶
-
PJ_TYPE_ENGINEERING_CRS
¶
-
PJ_TYPE_BOUND_CRS
¶
-
PJ_TYPE_OTHER_CRS
¶
-
PJ_TYPE_CONVERSION
¶
-
PJ_TYPE_TRANSFORMATION
¶
-
PJ_TYPE_CONCATENATED_OPERATION
¶
-
PJ_TYPE_OTHER_COORDINATE_OPERATION
¶
-
-
enum
iso19111_types
::
PJ_COMPARISON_CRITERION
¶ Comparison criterion.
Values:
-
PJ_COMP_STRICT
¶ All properties are identical.
-
PJ_COMP_EQUIVALENT
¶ The objects are equivalent for the purpose of coordinate operations. They can differ by the name of their objects, identifiers, other metadata. Parameters may be expressed in different units, provided that the value is (with some tolerance) the same once expressed in a common unit.
-
PJ_COMP_EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS
¶ Same as EQUIVALENT, relaxed with an exception that the axis order of the base CRS of a DerivedCRS/ProjectedCRS or the axis order of a GeographicCRS is ignored. Only to be used with DerivedCRS/ProjectedCRS/GeographicCRS
-
-
enum
iso19111_types
::
PJ_WKT_TYPE
¶ WKT version.
Values:
-
PJ_WKT2_2015
¶
-
PJ_WKT2_2015_SIMPLIFIED
¶ cf osgeo::proj::io::WKTFormatter::Convention::WKT2_SIMPLIFIED
-
PJ_WKT2_2019
¶
-
PJ_WKT2_2018
= PJ_WKT2_2019¶ Deprecated alias for PJ_WKT2_2019
-
PJ_WKT2_2019_SIMPLIFIED
¶ cf osgeo::proj::io::WKTFormatter::Convention::WKT2_2019_SIMPLIFIED
-
PJ_WKT2_2018_SIMPLIFIED
= PJ_WKT2_2019_SIMPLIFIED¶ Deprecated alias for PJ_WKT2_2019
-
PJ_WKT1_GDAL
¶
-
PJ_WKT1_ESRI
¶
-
-
enum
iso19111_types
::
PROJ_CRS_EXTENT_USE
¶ 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.
Values:
-
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.
-
-
enum
iso19111_types
::
PROJ_GRID_AVAILABILITY_USE
¶ Describe how grid availability is used.
Values:
-
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.
-
-
enum
iso19111_types
::
PJ_PROJ_STRING_TYPE
¶ PROJ string version.
Values:
-
enum
iso19111_types
::
PROJ_SPATIAL_CRITERION
¶ Spatial criterion to restrict candidate operations.
Values:
-
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.
-
-
enum
iso19111_types
::
PROJ_INTERMEDIATE_CRS_USE
¶ Describe if and how intermediate CRS should be used
Values:
-
PROJ_INTERMEDIATE_CRS_USE_ALWAYS
¶ Always search for intermediate CRS.
-
PROJ_INTERMEDIATE_CRS_USE_IF_NO_DIRECT_TRANSFORMATION
¶ Only attempt looking for intermediate CRS if there is no direct transformation available.
-
PROJ_INTERMEDIATE_CRS_USE_NEVER
¶
-
-
enum
iso19111_types
::
PJ_COORDINATE_SYSTEM_TYPE
¶ Type of coordinate system.
Values:
-
PJ_CS_TYPE_UNKNOWN
¶
-
PJ_CS_TYPE_CARTESIAN
¶
-
PJ_CS_TYPE_ELLIPSOIDAL
¶
-
PJ_CS_TYPE_VERTICAL
¶
-
PJ_CS_TYPE_SPHERICAL
¶
-
PJ_CS_TYPE_ORDINAL
¶
-
PJ_CS_TYPE_PARAMETRIC
¶
-
PJ_CS_TYPE_DATETIMETEMPORAL
¶
-
PJ_CS_TYPE_TEMPORALCOUNT
¶
-
PJ_CS_TYPE_TEMPORALMEASURE
¶
-
-
typedef char **
PROJ_STRING_LIST
¶ Type representing a NULL terminated list of NULL-terminate strings.
-
struct
PROJ_CRS_INFO
¶ - #include <proj.h>
Structure given overall description of a CRS.
This structure may grow over time, and should not be directly allocated by client code.
-
struct
PROJ_CRS_LIST_PARAMETERS
¶ - #include <proj.h>
Structure describing optional parameters for proj_get_crs_list();.
This structure may grow over time, and should not be directly allocated by client code.