I have a raster image that has a custom projection system. I used the following code to retrieve the projection information from the raster and turn it into an ArcGIS recognized PCS following this example...
import arcpy
from osgeo import gdal
raster_path = r"\\tiff_inputs\tiff_UTM_inputs\amz_jurisdiction_UTM20.tif"
in_ds = gdal.Open(raster_path)
projection = in_ds.GetProjection()
pcs = arcpy.SpatialReference(text=projection)
Here is the projection string when printed to the console...
'PROJCS["Brasil, Zona UTM 20, hemisf\udce9rio sul",GEOGCS["br_utm20sad_s",DATUM["South American 1969",SPHEROID["International 1967 (truncated)",6378160,298.24999999573],TOWGS84[-67.35,3.88,-38.22,0,0,0,0]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",-63],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",10000000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH]]'
However when I input this projection string into arcpy.SpatialReference
I receive the following error:
ValueError: SpatialReference: Spatial reference string is invalid.
I cannot use the display name of the coordinate system as an input either because it is not recognized by arcpy.
How can I reformat the gdal projection string to be valid parameter for arcpy.SpatialReference
?