ThinkGeo.com    |     Documentation    |     Premium Support

Error message when trying to draw GeoTiff layer

We have a GeoTiff file that will not draw. Instead, we get the following message:

C:\Data\GeoTiff\From Grant\wattylidar.tif: Sorry, can not handle images with 32-bit samples

Any ideas what we are doing wrong?

Thanks!

Steve

Hey @Steven1,

The packages that we use to render GeoTiff can only handle images in their 8bit sample size. In the past, we’ve had a workaround by having the user open the GeoTiff in QGIS and export it out, which exports to 8bit format by default last I saw. You can confirm that by looking at the properties of the layer in QGIS.

Thanks,
Kyle

Kyle,

I tried your suggestion and the result does not look well in my ThinkGeo map. Here is what it looks like:

It looks good in QGIS, like this:

Is there any solution?

Thanks!

Steve

Hey @Steven1,

Huh, that’s not normal. It’s like the light levels got decimated somehow. I wonder if the 8bit export settings borked something. Is it possible for you to attach the original 32bit GeoTIFF so I can dig into it more?

Thanks,
Kyle

Kyle,

Here is a link to the GeoTiff.

Thanks!

Steve

Hey @Steven1,

That looks like the histograph got messed up in the export. I messed around in my QGIS and saw the same thing happen, which made it different from the original even in QGIS. I changed the export properties from raw to rendered image and this makes the export look exactly the same in both QGIS and ThinkGeo maps (left: export in thinkgeo, right: original in QGIS):

image

Thanks,
Kyle

Thanks for the help. I’m not a frequent user of QGIS so I’m having a little trouble figuring out exactly what you are doing to achieve your result. To create the file I showed in the original post I went to the menu Raster | Conversion | Transalte (Convert Format…). That was the only way I could change the bit depth,

If I simply go to Export | Save As and choose Rendered Image it still produces a GeoTiff with 32 bit depth and I don’t see an option to change it. I have QGIS 3.20.2.

Any help with that?

Thanks!

Steve

Hey @Steven1,

Hmm, that might be why. I’m on QGIS 3.10.5, so they may have updated the export functionality. Let me upgrade to the latest LTS version and try again.

Thanks,
Kyle

Hey @Steven1,

I upgraded to the latest LTS (3.22.8) and re-ran the export. I still get the output datatype of 8bit. Here is how I did it:

Export command:

image

Export Settings:

For the export settings, I just set the Output mode to Rendered Image and gave it a filepath to save it. After it finished the export, I opened the properties of the newly created layer and it shows the correct datatype:

image

I also messed around with the translate operate and it always seems to either mess up the histogram levels or it creates really bad banding between the grayscale values. So, I think just a regular export is probably safer to do.

Here is the exported tiff that I got: https://thinkgeo.sharepoint.com/:u:/g/EdcYheuRcZhPtWlq5-45uf8BROBe28D0MZxTOnY7iOqdvQ?e=e6aGlx

Thanks,
Kyle

Kyle,

Thanks for all your help. I made my image exactly the same way you did. The image will not display if I use the GeoTiffRasterLayer. The error I get is -22676: Invalid strip byte count, strip 2655. So I tried with the UnmanagedGeoTiffRasterLayer and the image displays properly. However, we can’t use UnmanagedGeoTiffRasterLayer because it has many problems with other GeoTiff layers.

So I tried one more thing. I did the Export | Save As again with Rendered Image but also applied LZW compression and now the layer displays properly with GeoTiffRasterLayer. The file is also much smaller, so that is a good thing. Thanks again!

Steve

Hey @Steven1,

Good to hear it’s working for you! Good luck!

Thanks,
Kyle