Class: QgsDatumTransform

Contains methods and classes relating the datum transformations.

Static Methods

datumTransformInfo

Returns detailed information about the specified datumTransformId.

datumTransformToProj

Returns a proj string representing the specified datumTransformId datum transform ID.

datumTransformations

Returns a list of datum transformations which are available for the given source and destination CRS.

operations

Returns a list of coordinate operations available for transforming coordinates from the source to destination CRS.

projStringToDatumTransformId

Returns the datum transform ID corresponding to a specified proj string.

class qgis.core.QgsDatumTransform[source]

Bases: object

class GridDetails

Bases: object

Contains information about a projection transformation grid file.

Added in version 3.8.

directDownload: bool

True if direct download of grid is possible

fullName: str

Full name of transform grid

isAvailable: bool

True if grid is currently available for use

openLicense: bool

True if grid is available under an open license

packageName: str

Name of package the grid is included within

shortName: str

Short name of transform grid

url: str

Url to download grid from

class SingleOperationDetails

Bases: object

Contains information about a single coordinate operation.

Note

Only used in builds based on on Proj >= 6.2

Added in version 3.10.

areaOfUse: str

Area of use, from EPSG registry database

authority: str

Authority name, e.g. EPSG.

code: str

Authority code, e.g. “8447” (for EPSG:8447).

remarks: str

Remarks for operation, from EPSG registry database

scope: str

Scope of operation, from EPSG registry database

class TransformDetails

Bases: object

Contains information about a coordinate transformation operation.

Note

Only used in builds based on on Proj >= 6.0

Added in version 3.8.

accuracy: float

Transformation accuracy (in meters)

areaOfUse: str

Area of use string.

This is only available for single step coordinate operations. For multi-step operations, check operationDetails instead.

See also

bounds()

authority: str

Authority name, e.g. EPSG.

This is only available for single step coordinate operations. For multi-step operations, check operationDetails instead.

bounds: QgsRectangle

Valid bounds for the coordinate operation.

See also

areaOfUse()

code: str

Identification code, e.g. “8447” (For EPSG:8447).

This is only available for single step coordinate operations. For multi-step operations, check operationDetails instead.

grids: List[QgsDatumTransform.GridDetails]

Contains a list of transform grids used by the operation.

isAvailable: bool

True if operation is available.

If False, it likely means a transform grid is required which is not available.

name: str

Display name of transform operation

operationDetails: List[QgsDatumTransform.SingleOperationDetails]

Contains information about the single operation steps used in the transform operation.

Note

Only used in builds based on on Proj >= 6.2

Added in version 3.10.

proj: str

Proj representation of transform operation

remarks: str

Remarks for operation, from EPSG registry database.

This is only available for single step coordinate operations. For multi-step operations, check operationDetails instead.

scope: str

Scope of operation, from EPSG registry database.

This is only available for single step coordinate operations. For multi-step operations, check operationDetails instead.

class TransformInfo

Bases: object

Contains datum transform information.

Deprecated since version 3.40: Not used on builds based on Proj >= 6.0.

datumTransformId: int

Datum transform ID

deprecated: bool

True if transform is deprecated

destinationCrsAuthId: str

Destination CRS auth ID

destinationCrsDescription: str

Destination CRS description

epsgCode: int

EPSG code for the transform, or 0 if not found in EPSG database

preferred: bool

True if transform is the preferred transform to use for the source/destination CRS combination

remarks: str

Transform remarks

scope: str

Scope of transform

sourceCrsAuthId: str

Source CRS auth ID

sourceCrsDescription: str

Source CRS description

class TransformPair

Bases: object

Contains datum transform information.

Deprecated since version 3.40: Not used for builds based on Proj >= 6.0.

destinationTransformId: int

ID for the datum transform to use when projecting to the destination CRS.

See also

QgsCoordinateTransform.datumTransformCrsInfo()

sourceTransformId: int

ID for the datum transform to use when projecting from the source CRS.

See also

QgsCoordinateTransform.datumTransformCrsInfo()

static datumTransformInfo(datumTransformId: int) QgsDatumTransform.TransformInfo[source]

Returns detailed information about the specified datumTransformId. If datumTransformId was not a valid transform ID, a TransformInfo with TransformInfo.datumTransformId of -1 will be returned.

Deprecated since version 3.40: Not used for builds based on Proj >= 6.0.

Parameters:

datumTransformId (int)

Return type:

QgsDatumTransform.TransformInfo

static datumTransformToProj(datumTransformId: int) str[source]

Returns a proj string representing the specified datumTransformId datum transform ID.

Deprecated since version 3.40: Not used for builds based on Proj >= 6.0.

Parameters:

datumTransformId (int)

Return type:

str

static datumTransformations(source: QgsCoordinateReferenceSystem, destination: QgsCoordinateReferenceSystem) List[QgsDatumTransform.TransformPair]

Returns a list of datum transformations which are available for the given source and destination CRS.

Deprecated since version 3.40: Not used for builds based on Proj >= 6.0.

Parameters:
Return type:

List[QgsDatumTransform.TransformPair]

static operations(source: QgsCoordinateReferenceSystem, destination: QgsCoordinateReferenceSystem, includeSuperseded: bool = False) List[QgsDatumTransform.TransformDetails]

Returns a list of coordinate operations available for transforming coordinates from the source to destination CRS.

This list is sorted in order of preference, with the most preferable operation listed first.

Not all operations may be available for use. Check QgsDatumTransform.TransformDetails.isAvailable first. Operations may require grid shift files which are not available on the local install.

If includeSuperseded is True, superseded (but not deprecated) transforms will be included in the results. This requires Proj >= 6.2.

Note

Requires Proj 6.0 or later. Builds based on earlier Proj versions will always return an empty list, and the deprecated API from QgsDatumTransform must be used instead.

Added in version 3.8.

Parameters:
Return type:

List[QgsDatumTransform.TransformDetails]

static projStringToDatumTransformId(string: str | None) int[source]

Returns the datum transform ID corresponding to a specified proj string. Returns -1 if matching datum ID was not found.

Deprecated since version 3.40: Not used for builds based on Proj >= 6.0.

Parameters:

string (Optional[str])

Return type:

int