-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specifying exact reprojection with proj pipeline in gdalwarp #3
Comments
Thanks for detailed question! The short answer is that explicitly defining your PROJ pipeline is the safest approach, but it can be cumbersome. If your t_srs and s_srs definitions are unambiguous, then your results should be identical to those obtained with the pipeline. If your EPSG codes unambiguously define your CRS, then you can use those for convenience. But in this case, your EPSG codes are only 2D CRS, with no definition of specific ITRF/WGS84 realizations. You can explicitly define your 3D CRS using well-known text (WKT2), adding explicit information about which WGS84 you're using with your UTM projection. The 2m uncertainty is due to the ambiguity of the WGS84 realization with the EPSG:326XX codes. See the output for the ENSEMBLE.
Note the ENSEMBLEACCURACY. The way around this is to explicitly define the WGS84/ITRF realization of your dataset. I don't think there are existing EPSG codes for UTM projection with specific realiztion (like Hopefully that makes sense. There are some good discussions of the WGS84 Ensemble issues in the GDAL and PROJ mailing list archives. |
Need to add some text on this WGS84 Ensemble issue to the notes: https://github.com/ICESAT-2HackWeek/3D_CRS_Transformation_Resources/issues/2 |
Woah! Not the answer I was expecting here. Thanks for the detailed response. WGS84 is not WGS84 indeed... |
My approach
Let's say I have a tif in UTM Zone 3N (EPSG:32603) and I want to reproject into NAD83(2011) / Alaska Albers (EPSG:6393). It's a trivial example because I could easily enough just:
But, let's say I was interested in the gory, technical details and wanted a PROJ pipeline to do the conversion:
There's only one pipeline to choose from, and I would like to use that fully qualified pipeline (despite the 2 m uncertainty.. yikes) to do the reprojection.
I then run:
gdalwarp -ct "+proj=pipeline +step +inv +proj=utm +zone=3 +ellps=WGS84 +step +proj=aea +lat_0=50 +lon_0=-154 +lat_1=55 +lat_2=65 +x_0=0 +y_0=0 +ellps=GRS80" source_epsg32603.tif dest_epsg6393.tif
That works and produces the same result as the shorter gdalwarp comand with EPSG codes. But the benefit of this second approach is that I can (a) see the uncertainty associated with the conversion and potentially factor that into an analysis; (b) in the case of multiple pipeline options, I could actually choose one to pass to
-ct
in gdalwarpMy Question
I'm curious: is this a reasonable thing to do? Or should I just trust EPSG codes and do my conversions the way I always have in the past with the first gdalwarp command?
Sidenote
It appears that the second gdalwarp command with the
-ct
pipeline option does not write the CRS information into the GeoTiff metadata. Agdalinfo
ondest_epsg6393.tif
returns the old UTM 3N CRS info. Possible bug, opened an issue: OSGeo/gdal#8242Edit
This CRS issue is resolved on OSGeo/gdal#8243. Turns out you still need to use the
t_srs
option to write out the metadata even though the parameters of the proj pipeline will be respected and override the default params, so the updated, second gdalwarp command should have been:gdalwarp -ct "+proj=pipeline +step +inv +proj=utm +zone=3 +ellps=WGS84 +step +proj=aea +lat_0=50 +lon_0=-154 +lat_1=55 +lat_2=65 +x_0=0 +y_0=0 +ellps=GRS80" -t_srs EPSG:6393 source_epsg32603.tif dest_epsg6393.tif
Now the commands are really redundant, but at least you gain access control over the exact transformation parameters when using the
ct
flag....The text was updated successfully, but these errors were encountered: