Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#7196 closed defect (wontfix)

DST_METHOD=NO_GEOTRANSFORM Not Passed to GDAL Through gdal.ReprojectImage

Reported by: parkerosgeo Owned by: hobu
Priority: normal Milestone:
Component: PythonBindings Version: 2.2.3
Severity: normal Keywords:
Cc:

Description

I'm trying to create a scaled version of an existing NTF image. Because I don't need GEO or GSP definitions in the output, I tried to set the DST_METHOD=NO_GEOTRANSFORM as per the error message, but GDALWarp isn't picking it up. I don't think the C code is picking up the setting from Python. Any help would be greatly appreciated.

#!/usr/bin/env python

import math
import os
import re
import sys

from datetime import datetime
from osgeo import gdal
from osgeo import osr

   # Register all drivers
gdal.AllRegister()

   # Allow GDAL to throw Python exceptions
gdal.UseExceptions()

   # Reference NITF driver for NITF RSET generation
nitf_driver = gdal.GetDriverByName("NITF")

	# Open file and get reference to the dataset
ds = gdal.Open( 'notcompressed3.ntf', gdal.GA_ReadOnly )

   # NITF Driver Creation Options - http://www.gdal.org/frmt_nitf.html
final_creation_options = []
final_creation_options += ['IC=NC']          
final_creation_options += ['NUMI=1']                     
final_creation_options += ['FHDR=NITF02.10']              
final_creation_options += ['ICORDS=G']                    
final_creation_options += ["BLOCKXSIZE=1024"]
final_creation_options += ["BLOCKYSIZE=512"]

gdal_warp_options = ["DST_METHOD=NO_GEOTRANSFORM"]

scaled_nitf = nitf_driver.Create( 'test.ntf', 8049, 4405, 1, gdal.GDT_UInt16, final_creation_options )

gdal.ReprojectImage( ds, scaled_nitf, None, None, gdal.GRA_Cubic, 0.0, 0.0, 0, None, gdal_warp_options )
Traceback (most recent call last):
  File "./rset-error.py", line 37, in <module>
    gdal.ReprojectImage( ds, scaled_nitf, None, None, gdal.GRA_Cubic, 0.0, 0.0, 0, None, gdal_warp_options )
  File "/usr/local/lib64/python2.7/site-packages/osgeo/gdal.py", line 2832, in ReprojectImage
    return _gdal.ReprojectImage(*args, **kwargs)
RuntimeError: Unable to compute a transformation between pixel/line and georeferenced coordinates for test.ntf. There is no affine transformation and no GCPs. Specify transformation option DST_METHOD=NO_GEOTRANSFORM to bypass this check.

Change History (2)

comment:1 by Even Rouault, 6 years ago

Resolution: wontfix
Status: newclosed

DST_METHOD=NO_GEOTRANSFORM is a transformer option, not a warping option. There's no way to pass it with gdal.ReprojectImage(). I'd suggest using the new gdal.Warp() API instead

comment:2 by parkerosgeo, 6 years ago

Thanks for your help

Note: See TracTickets for help on using tickets.