[Qgis-user] Problems with transformation including height values

Bo Victor Thomsen bo.victor.thomsen at gmail.com
Tue Mar 21 03:51:47 PDT 2023


Hi list -

Thanks to all for the prompt (and correct) responses.

Using ogr2ogr (and some fiddling with the csv file including a header 
row..) :

ogr2ogr -dim XYZ -oo X_POSSIBLE_NAMES=x -oo Y_POSSIBLE_NAMES=y -oo 
Z_POSSIBLE_NAMES=z -s_srs EPSG:4979 -t_srs EPSG:7416 -f GeoJSON 
d:\temp\data_7416.json d:\temp\data_4979.csv

did the trick.

And just for the fun of it: I tried changing the input projection to 
EPSG:4326:

ogr2ogr -dim XYZ -oo X_POSSIBLE_NAMES=x -oo Y_POSSIBLE_NAMES=y -oo 
Z_POSSIBLE_NAMES=z -s_srs *EPSG:4326* -t_srs EPSG:7416 -f GeoJSON 
d:\temp\data_7416.json d:\temp\data_4979.csv

And that didn't work. So "they" were serious about EPSG:4326 not 
handling z coordinates

Med venlig hilsen / Best regards

Bo Victor Thomsen

Den 21-03-2023 kl. 11:41 skrev Nyall Dawson:
>
>
> On Tue, 21 Mar 2023, 8:21 pm Richard McDonnell, 
> <richard.mcdonnell at opw.ie> wrote:
>
>     Hi,
>
>     Just to add to what Nyall said.
>
>     See link below, which suggests a way using OGR to carry out the
>     process you require.
>
>     https://gis.stackexchange.com/questions/324848/transform-datum-csv-csv-using-ogr2ogr
>
>     It suggests you preform your horizontal transformation first, this
>     can be done in QGIS, then carry out the Vertical Transformation.
>     This can be done in command line, if you are on windows, the best
>     option is to use the *OSGeo4w Shell*, as all the needed
>     environmental settings are applied.
>
>     I hope the above helps.
>
>     Maybe there is an opportunity to have QGIS preform Vertical
>     translations, even if these are a separate step? It’s something
>     that would be useful for both Raster and Vector Data.
>
>
> It's definitely on the radar -- especially for transformation of point 
> clouds. It's just a very involved task with a high degree of 
> complexity, and will need funding to happen.
>
> Nyall
>
>     Regards,
>
>
>     Richard
>
>
>     ——
>     Richard McDonnell MSc GIS, FME Certified Professional
>     /FRM Data Management/
>
>     ——
>     Oifig na nOibreacha Poiblí
>     Office of Public Works
>
>     Sráid Jonathan Swift, Baile Átha Troim, Co na Mí, C15 NX36
>     Jonathan Swift Street, Trim, Co Meath, C15 NX36
>     ——
>     M +353 87 688 5964 T +353 46 942 2409
>     https://gov.ie/opw
>
>     ——
>     To send me files larger than 30MB, please use the link below
>     https://filetransfer.opw.ie/filedrop/richard.mcdonnell@opw.ie
>
>     Email Disclaimer:
>     https://www.gov.ie/en/organisation-information/439daf-email-disclaimer/
>
>
>
>     ——
>     MSc GIS, FME Certified Professional
>
>     ——
>     Oifig na nOibreacha Poiblí
>     Office of Public Works
>
>     Sráid Jonathan Swift, Baile Átha Troim, Co na Mí, C15 NX36
>     Jonathan Swift Street, Trim, Co Meath, C15 NX36
>     ——
>     M +353 87 688 5964 T +353 46 942 2409
>     https://https://gov.ie/opw <https://www.opw.ie>
>
>     ——
>     Email Disclaimer:
>     https://www.gov.ie/en/organisation-information/439daf-email-disclaimer/
>     <https://www.opw.ie/en/disclaimer/>
>
>     *From:*QGIS-User <qgis-user-bounces at lists.osgeo.org> *On Behalf Of
>     *Nyall Dawson via QGIS-User
>     *Sent:* 21 March 2023 10:14
>     *To:* Bo Victor Thomsen <bo.victor.thomsen at gmail.com>
>     *Cc:* qgis-user <qgis-user at lists.osgeo.org>
>     *Subject:* Re: [Qgis-user] Problems with transformation including
>     height values
>
>     On Tue, 21 Mar 2023, 8:06 pm Bo Victor Thomsen via QGIS-User,
>     <qgis-user at lists.osgeo.org> wrote:
>
>         Hi list -
>
>         I have a problem with transforming a csv file containing x,y
>         /and /z values from EPSG:4326 to EPSG:7416, i.e I want to
>         transform the height value from LongLat/ WGS84 ellipsoid
>         height to UTM32/Etrs89 with vertical reference DVR90.
>
>         The file look like this:
>
>         *== data.csv, EPSG:4326 id: col1, x: col3, y: col2, z: col4 ==
>         *a;55.0;12.0;42.0
>         b;55.05;12.0;43.0
>         c;55.10;12.0;44.0
>         d;55.15;12.0;45.0
>         e;55.20;12.0;46.0
>         *=======================*
>
>         *Step 1*: I import the file into QGIS using the Data Source
>         Manager --> "Delimited Text" and define the projection to be
>         EPSG:4326 /and/ to include z values. This works and the points
>         are shown on my map where I expect them to be (Somewhere in
>         the middle of Zealand, Denmark)
>
>         *Step 2*: I export the layer as a geojson file using "Export"
>         --> "Save features as.." from the layer manager and choose
>         EPSG:7416 (UTM32/ETRS89 with DVR90 as vertical reference. And
>         to include z-values
>
>         The resulting file looks like this:
>
>         *== data.geojson, EPSG:7416 ==
>         *{
>         "type": "FeatureCollection",
>         "name": "data",
>         "crs": { "type": "name", "properties": { "name":
>         "urn:ogc:def:crs:EPSG::4979" } },
>         "features": [
>         { "type": "Feature", "properties": { "field_1": "a",
>         "field_2": 55.0, "field_3": 12.0, "field_4": 42.0 },
>         "geometry": { "type": "Point", "coordinates": [ 12.0, 55.0,
>         42.0 ] } },
>         { "type": "Feature", "properties": { "field_1": "b",
>         "field_2": 55.05, "field_3": 12.0, "field_4": 43.0 },
>         "geometry": { "type": "Point", "coordinates": [ 12.0, 55.05,
>         43.0 ] } },
>         { "type": "Feature", "properties": { "field_1": "c",
>         "field_2": 55.1, "field_3": 12.0, "field_4": 44.0 },
>         "geometry": { "type": "Point", "coordinates": [ 12.0, 55.1,
>         44.0 ] } },
>         { "type": "Feature", "properties": { "field_1": "d",
>         "field_2": 55.15, "field_3": 12.0, "field_4": 45.0 },
>         "geometry": { "type": "Point", "coordinates": [ 12.0, 55.15,
>         45.0 ] } },
>         { "type": "Feature", "properties": { "field_1": "e",
>         "field_2": 55.2, "field_3": 12.0, "field_4": 46.0 },
>         "geometry": { "type": "Point", "coordinates": [ 12.0, 55.2,
>         46.0 ] } }
>         ]
>         }
>         *=======================*
>
>         The new file is shown in my map exactly on top of the original
>         point layer, meaning the horizontal projection is accurate.
>         However, my z coordinates are not reprojected to the new
>         vertical reference. All the z-values are exactly the same as
>         the values in the .csv - file.
>
>         After some digging through Google and other places, I discover
>         that EPSG:4326 /doesn't/ have a z component. Surprise ! You
>         have to use EPSG:4979, which is the same as EPSG:4326 with
>         ellipsoid height.
>
>         But, /after /repeating *step 1*, /but/ using EPSG:4979 as CRS
>         during import, and subsequently repeating *step 2*, I get the
>         exact same result: No transformation of height values.
>
>         So, what is not working ? Am I doing something wrong ?? Or is
>         QGIS incapable of transforming z values ???
>
>     The second -- qgis currently doesn't handle vertical crs at all.
>     My recommendation is to use gdal utilities to do a transform
>     respecting vertical datums.
>
>     Nyall
>
>         -- 
>
>         Med venlig hilsen / Best regards
>
>           
>
>         Bo Victor Thomsen
>
>         _______________________________________________
>         QGIS-User mailing list
>         QGIS-User at lists.osgeo.org
>         List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>         Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20230321/514e8813/attachment-0001.htm>


More information about the QGIS-User mailing list