[Qgis-user] Convert geocentric x, y, z to projected coordinates
Andrea Giudiceandrea
andreaerdna at libero.it
Sat Feb 28 00:43:38 PST 2026
> Roland Spielhofer rspiel at gmx.net
> Fri Feb 27 04:33:10 PST 2026
> I have a set of coordinates as geocentric x, y, z 3D-coordinates in ETRF89 (located in Austria), which should be, if I am not wrong, EPSG:7194.
> x y z
> 4080019.8005 1202964.0971 4736921.5758
Hi Roland,
according to some issue reports [1] [2], it looks like geocentric
to/from geographic transformations are not well handled in QGIS either
by the on-the-fly reprojection functionality and by the Reproject layer
processing algorithm.
Anyway, you could perform the transformation directly in QGIS using the
pyproj Python module and creating a custom function.
I suggest you to proceed in the following way:
- import the delimited text file as an attribute only table ("No geometry")
- open the Field Calculator, go to Function Editor
- create a new function file named transform_xyz_pyproj and replace the
default Python script with the following one [3]:
from qgis.core import *
from pyproj import Transformer
@qgsfunction(group='Custom', referenced_columns=[])
def transform_xyz_pyproj(x, y, z, CRS_from, CRS_to):
transformer = Transformer.from_crs(CRS_from, CRS_to, always_xy=True)
x2, y2, z2 = transformer.transform(x, y, z)
return QgsGeometry.fromPoint(QgsPoint(x2, y2, z2))
Now you can use the transform_xyz_pyproj custom function to perform the
transformation:
- open the "Geometry by expression" processing algorithm
- set the imported delimited text layer as the Input layer
- set Point as geometry output type and "output geometry has z dimension"
- set the Geometry expression:
transform_xyz_pyproj("x", "y", "z", 'EPSG:7914', 'EPSG:25833')
- execute the algorithm
- assign the CRS EPSG:25833 to the output layer.
Regards.
Andrea Giudiceandrea
[1] https://github.com/qgis/QGIS/issues/34845
[2] https://github.com/qgis/QGIS/issues/53439
[3] https://gist.github.com/agiudiceandrea/1d16762512f9d2a214bdbb4ac9666e60
More information about the QGIS-User
mailing list