ThinkGeo.com    |     Documentation    |     Premium Support

GeoTiff fails to display in MS 10

Hi,

We are using MS 10 WinForms for desktop and have updated our Nuget packages to the latest production version. We occasionally come across a GeoTiff that will not display in the map. I suspect the reason my be the type of compression being used (JPEG). I have uploaded the file to the FTP site. It is located in a folder called Tiff Will Not Display. The name of the file is _bennett.zip. The file does not display at all using the GeoTiffRasterLayer and displays as a black rectangle using UnmanagedGeoTiffRasterLayer.

Thanks,

Steve

Hi Steve,

Thanks to let us know that, we will look into it.

Any update I will let you know.

Regards,

Ethan

Hi Steve,

I think you’re right, the format cannot be parsed by our Tiff related class, but the NativeImageRasterLayer can parse it correct and render it, you just need pass into a correct bouding box.

The code should works for your file:

        private void Form1_Load(object sender, EventArgs e)
    {
        winformsMap1.MapUnit = GeographyUnit.Meter;

        LayerOverlay layerOverlay = new LayerOverlay();

        GeoTiffRasterLayer tiffLayer = new GeoTiffRasterLayer(@"..\..\AppData\_bennett.tif");
        tiffLayer.Open();

        RectangleShape rect = tiffLayer.GetBoundingBox();
        tiffLayer.Close();

        NativeImageRasterLayer imageLayer = new NativeImageRasterLayer(@"..\..\AppData\_bennett.tif", rect);

        layerOverlay.Layers.Add(imageLayer);
        winformsMap1.Overlays.Add(layerOverlay);
                    
        winformsMap1.CurrentExtent = rect;
        winformsMap1.Refresh();
    }

Regards,

Ethan