ThinkGeo.com    |     Documentation    |     Premium Support

UnmanagedGeoTiffRasterLayer missing Colors

Hallo,
I try to project tiff-images. Following some posts in the forum, I downloaded beta-versions 13.x (ThinkGeo.UI.Wpf, ThinkGeo.Core, ThinkGeo.Gdal, ThinkGeo.UnmanagedGeoTiff, ThinkGeo.UnmanagedProj). and use this code:

private void Map_Loaded(object sender, RoutedEventArgs e)
{
    Map.MapUnit = GeographyUnit.Meter;
    Map.CurrentExtent = GetBoundingBoxGermany(25833); // MaxExtents.SphericalMercator;
    var gProjectionConverterForRendering = new UnmanagedProjectionConverter(25833, 25832);
    gProjectionConverterForRendering.Open();
    var geotifLayer = new UnmanagedGeoTiffRasterLayer(System.AppDomain.CurrentDomain.BaseDirectory + "\\..\\..\\Datas\\33206\\dtk10_33206_5920.tif");
    geotifLayer.ImageSource.ProjectionConverter = gProjectionConverterForRendering;
    var overLay = new LayerOverlay();
    overLay.TileType = TileType.SingleTile;
    overLay.Layers.Add(geotifLayer);
    Map.Overlays.Add(overLay);

    Map.Refresh();
}

public static RectangleShape GetBoundingBoxGermany(int externalSrid)
{
    ProjectionConverter projectionConverter = new ProjectionConverter(4326, externalSrid);
    projectionConverter.Open();
    var box = projectionConverter.ConvertToExternalProjection(new RectangleShape(5.8663153, 55.099161, 15.0419319, 47.2701114)) as RectangleShape;
    projectionConverter.Close();
    return box.GetBoundingBox();
}

The Position on the map seems correct, but it’s look like a grayscale picture.

Thanks Torsten,
Could you send us a sample geotif file. We could look into more details. You can send the file to support@thinkgeo.com

Thanks

Frank

Thanks Torsten,
I can re-produce this one. I looked into more detail. I found the geotif file is compressed.

We don’t support compressed geotif file. More detail is here

As we mentioned:

You would need to write a utility or method to uncompress these and then load them into the control.

Thanks

Frank

Hallo Frank;
I try to use NativeImageRasterLayer instead. But I get a NullReferenceException. Whats the reason for that?

Regards Torsten

Hallo Frank,
now I tested with GeoTiffRasterLayer. The results are different. I use two tiff-files (see attachement). Both are lzw-compressed.
The file Durchfahrtsplan.tif is perfecty rendered. - the other not.

Any suggestions?
Regards TorstenLZW.ZIP (2.2 MB)

Thanks Torsten,
I can re-produce this one. Still trying to find the difference between these two. I will update you once I get any progress.

Thanks

Frank

Thanks Torsten,
We have fixed this issue. Could you get the latest V12 beta release.

Here is the code

 private void MapView_Loaded(object sender, RoutedEventArgs e)
        {
            // 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.
            GeoTiffRasterLayer geoTiffRasterLayer = new GeoTiffRasterLayer(@"D:\Downloads\LZW\dtk10_33206_5920.tif");
            layerOverlay.Layers.Add(geoTiffRasterLayer);
            geoTiffRasterLayer.Open();
            // Set the map view current extent to a slightly zoomed in area of the image.
            mapView.CurrentExtent = geoTiffRasterLayer.GetBoundingBox();

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

Thanks

Frank

Thanks Frank;
I can confirm, the fix resolves my problem.
Thanks Torsten

Thanks Torsten,
Good to know it works. Go ahead let us know if you have any questions.

Thanks

Frank