3

I just upgraded to GDAL 2.2.0 and now I'm having issues with my python kernel crashing when I run gdal.Open() on certain files that it used to work on when I had GDAL 2.1.2. It seems to only be crashing on images I have created with gdal_translate or gdalwarp, but not all of them. This is the error I keep receiving in my terminal window after a crash:

x = gdal.Open("tiffpath.tif")
TIFFReadDirectory: Warning, Unknown field with tag 42113 (0xa481) encountered.

These are the commands I'm using to create the GTiffs that crash my kernel:

subprocess.call(["gdalwarp", "-of", "GTiff", "-r", "bilinear", "-srcnodata", "0", "infile1path", "infile1path", "tiffoutpath"])

gdalTranslate = r'/usr/local/Cellar/gdal2/2.2.0/bin/gdal_translate'
subset = (520926.0, 7339961.0, 686430.0, 7223749.0,"path_in","path_out")
trans = gdalTranslate + ' -of GTiff -projwin %s %s %s %s %s %s' %(subset)         
os.system(trans)

I can open these images using PIL Image.open(). However, I still need gdal.Open to work so I can retrieve projection information.

I found that tag 42113 is associated with this: 'a special pixel value to mark geospatial areas for which no info is available'. Is there a glitch in the way the new gdal_translate and gdalwarp are creating geotiffs, an error in the way gdal.Open() functions with some .tif images, or something else I might be doing wrong?

  • 2
    That's just a warning, is your kernel actually crashing or are you getting an exception? Why are you using subprocess? GDAL >= 2 has gdal.Warp and gdal.Translate built in now. – user2856 Jul 17 '17 at 22:40
  • Yes the kernel in python is crashing and the terminal window that it is running from shows only that warning every time. That second part is good to know. The code is remnant from when I first built it a few years ago. Thanks! – Snow Jul 18 '17 at 15:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.