Transverse Mercator Complex projection


himat15@...
 

Hi, I have a geotiff with a "Transverse_Mercator_Complex" CRS.

Here is the output of the `.crs` property after reading in the tif with rio.read():
PROJCS["WGS_1984_Complex_UTM_Zone_29N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator_Complex"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-9.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
The rest of my files have the crs EPSG:32629, so I tried to reproject this tif into EPSG:32629 following the standard given example in the docs here.

But, I got this error:
No translation for Transverse_Mercator_Complex to PROJ.4 format is known

I found that this projection is the same (?) as the regular Transverse Mercator from
https://gis.stackexchange.com/questions/226679/complex-utm-projection. It seems to just be an ESRI specific one. It's also listed in this repo https://github.com/Esri/projection-engine-db-doc/blob/master/text/pe_list_projection.txt.

What should I do in this case to transform my file in this case to EPSG:32629?


Even Rouault
 

On lundi 9 mars 2020 14:42:32 CET himat15 via Groups.Io wrote:
Hi, I have a geotiff with a "Transverse_Mercator_Complex" CRS.

Here is the output of the `.crs` property after reading in the tif with
rio.read():
PROJCS["WGS_1984_Complex_UTM_Zone_29N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_
1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0
],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator_Compl
ex"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],P
ARAMETER["Central_Meridian",-9.0],PARAMETER["Scale_Factor",0.9996],PARAMET
ER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
The rest of my files have the crs EPSG:32629, so I tried to reproject this
tif into EPSG:32629 following the standard given example in the docs here (
https://rasterio.readthedocs.io/en/latest/topics/reproject.html ).

But, I got this error:
No translation for Transverse_Mercator_Complex to PROJ.4 format is known

I found that this projection is the same (?) as the regular Transverse
Mercator from
https://gis.stackexchange.com/questions/226679/complex-utm-projection. (
https://gis.stackexchange.com/questions/226679/complex-utm-projection ) It
seems to just be an ESRI specific one. It's also listed in this repo
https://github.com/Esri/projection-engine-db-doc/blob/master/text/pe_list_p
rojection.txt. (
https://github.com/Esri/projection-engine-db-doc/blob/master/text/pe_list_p
rojection.txt )

What should I do in this case to transform my file in this case
to EPSG:32629?
My understanding is that Transverse_Mercator_Complex corresponds to PROJ
"etmerc" method, which is the default since PROJ 4.9.3 for UTM. PROJ just
lacks a mapping for the Transverse_Mercator_Complex term.

So you could just override the projection information with for example:
gdal_translate in.tif out.tif -a_srs EPSG:32629
(or gdal_edit.py in.tif -a_srs EPSG:32629)
There's no need to do a reprojection.

Even

--
Spatialys - Geospatial professional services
http://www.spatialys.com


Luke
 

To override the projection with rasterio:

import rasterio
from rasterio.crs import CRS

in_tif = 'path/to.tif'
with rasterio.open(in_tif, 'r+') as src:
src.crs = CRS.from_epsg(32629)


himat15@...
 

@ Luke Pinner,

How should I then save the file with the updated CRS?
Like this? Or is there a better way?

with rasterio.open(in_tif, 'r+') as src:
src.crs = CRS.from_epsg(32629)
with raster.open("out.tif", 'w', **src.profile) as dst:
dst.write(src.read(1))


Luke
 

No. Exactly as I show in my code example. No need to write it out again, as you are just updating the georeferencing with the dataset opened in update mode ("r+").  The dataset is saved automatically when you exit the `with` statement context.

Luke