ThinkGeo.com    |     Documentation    |     Premium Support

32 bit sample problem in GeoTiff

Hi,


 I downloaded the eval version, and run into problems right away when trying to open a geotiff image. I get a messagebox saying: 'Sorry can not handle images with 32-bit samples'. Is this the case, is the tiff just not compatible with mapsuite? I use:



Dim geotiff As New GeoTiffRasterLayer("geotiff-4919-6-1247526000-dmc_195_S_lai_map.tif") 
geoTiff.open()
Dim staticOverlay As New LayerOverlay() 
staticOverlay.Layers.Add("GeoTiffRasterLayer", geotiff) 
winformsMap1.Overlays.Add(staticOverlay)
winformsMap1.Overlays.Add(50,New Feature(geotiff.GetBoundingBox))

Unfortunately I am not a geoTiff expert, nor do we generate the tiff ourselves. I would appreciatie it if someone could have a look at the file!


Thanks,


Peter


 



1648-geotiff-4919-6-1247526000-dmc_195_S_lai_map.zip (6.58 KB)












Hi peter,


 


Thanks for your post and thank you for giving us your sample code and data.


 


We have recreated the exception you mentioned in this post with your data; there may be some issue in our GeoTiff moudule, we will do more research about this problem. As a workaround, you could use GdiPlusRasterLayer instead temporally. The code is like this:


 



RectangleShape boundingBox = new RectangleShape(5.08081184375624, 51.5199666081462, 5.0966905211244, 51.5086369572673);

GdiPlusRasterLayer worldImageLayer = new GdiPlusRasterLayer("geotiff-4919-6-1247526000-dmc_195_S_lai_map.tif", boundingBox);
worldImageLayer.UpperThreshold = double.MaxValue;
worldImageLayer.LowerThreshold = 0;
worldImageLayer.IsGrayscale = false;

LayerOverlay ImageOverlay = new LayerOverlay();
ImageOverlay.Layers.Add("WorldImageLayer", worldImageLayer);
winformsMap1.Overlays.Add(ImageOverlay);

worldImageLayer.Open();

winformsMap1.CurrentExtent = boundingBox;
winformsMap1.Refresh();

 


Sorry for the inconvenience and any progress on this issue we will let you know as soon as possible.


 


Thanks,


 


Sun



Hi Sun,


Thanks for the quick reply! I will wait for more news, the workaround will work for this image, but not for others since the bounding box will never be the same.


Peter



Peter, 
  
 I think we don’t support the kind of your GeoTiff files so far, the exception is thrown by the third component which we using.  If the workaround from Sun can’t work with your other files, I am afraid there is not any other way can do it. 
  
 The investigation will keep going, if we find anything can help I will let you know. 
  
 Thanks 
  
 James 


that’s a shame, thanks for investigating anyway… I will try to find another solution.

Peter, 
  
 We also try to find another solution, if you make it I will let you know ASAP. 
  
 Thanks 
  
 James

I’m having the exact same issue :frowning:

Hi @Mikko_Viitala,

Do you have a demo tiff file for us to do the test? Seems like the download link in this thread doesn’t work now.

Thanks a lot.
Johnny

Sure.

File is about 25Mb in size so you can get it via Google Drive https://drive.google.com/file/d/1KMRixfNuclU3MpZiHdIGsSoVt7NSybwD/view?usp=sharing

I am unable to open the file with any preinstalled software on Win10 (shown as blank white image) but this is how it looks like on QGIS.

Thanks @Mikko_Viitala, I’m looking into it now. Any progress will be updated here.

Regards,
Johnny

Hi @Mikko_Viitala,

As the development of managed code support may take a bit long time, could you please use the unmanaged version in the project instead, here below is the demo code:

        // It is important to set the map unit first to either feet, meters or decimal degrees.
        mapView.MapUnit = GeographyUnit.Meter;

        // Create a new overlay that will hold our new layer and add it to the map.
        LayerOverlay layerOverlay = new LayerOverlay();
        mapView.Overlays.Add(layerOverlay);

        // Create the new layer and dd the layer to the overlay we created earlier.
        UnmanagedGeoTiffRasterLayer geoTiffRasterLayer = new UnmanagedGeoTiffRasterLayer(@"C:\Users\zhangzhao.APTHINKGEO\Downloads\Q5112B.tif");
        layerOverlay.Layers.Add(geoTiffRasterLayer);

        // Set the map view current extent to a slightly zoomed in area of the image.
        // 500000.0000000000000000,7068000.0000000000000000
        // 506000.0000000000000000,7074000.0000000000000000
        mapView.CurrentExtent = new RectangleShape(500000, 7074000, 506000, 7068000);

        // Refresh the map.
        mapView.Refresh();

All works fine and here is the screenshot I got:

Any progress of managed code will be pasted here.

Regards,
Johnny

1 Like