ThinkGeo.com    |     Documentation    |     Premium Support

Inverted colors with rasters

Hi ThinkGeo,

So we’ve been having this inverted color issue when using UnmanagedGeoTiffRasterLayer for tiff files that won’t show up with the regular GeoTiffRasterLayer already for some time. We now noticed the same behavior also when using UnmanagedProjectionConverter for a GeoPDF on a GeoPdfFeatureLayer when the regular ProjectionConverter just wouldn’t render.

I’ll send the PDF in question to the support email for you.

I believe the problem has something to do with the color representation being in different byte order than expected by the Unmanaged components. Could you by any chance fix this internally because I don’t know what really could be done outside ThinkGeo libraries?

Thanks,
Jarno

1 Like

Hi Jarno,

Thank you for the geoPdf - we received it in the support email. there are a lot of different scenarios in how you add the pdf to the map and what projection you’re using. Is it possible for you to also send us a sample .sln showing the issue occurring and that will help us diagnose any possible issues a lot faster.

Thanks,
John

Hi John,

Yes, sure. Here’s a corresponding test code of how we use it.

private void wpfMap_Loaded(object sender, RoutedEventArgs e)
{
	// Create the background world maps using vector tiles requested from the ThinkGeo Cloud Service and add it to the map
	ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new(ClientId, ClientSecret, ThinkGeoCloudVectorMapsMapType.Light);
	WpfMap.Overlays.Add(thinkGeoCloudVectorMapsOverlay);

	var layer = new GdalRasterLayer(@"./test.pdf");
	layer.Open();

	var bitmap = new GeoImage(layer.ImageSource.GetImageWidth(), layer.ImageSource.GetImageHeight());
	var canvas = GeoCanvas.CreateDefaultGeoCanvas();
	canvas.BeginDrawing(bitmap, layer.GetBoundingBox(), GeographyUnit.Meter);
	layer.Draw(canvas, new Collection<SimpleCandidate>());
	canvas.EndDrawing();

	var projString = "+proj=utm +zone=22 +south +ellps=GRS80 +units=m +no_defs ";
	var externalProjString = Projection.GetProjStringByEpsgSrid(3857);

	var converter = new UnmanagedProjectionConverter(projString, externalProjString);
	converter.Open();
	layer.ImageSource.ProjectionConverter = converter;

	var overlay = new LayerOverlay();
	overlay.Layers.Add(layer);
	WpfMap.Overlays.Add(overlay);

	WpfMap.CurrentExtent = layer.GetBoundingBox();
}

Regards,
Jarno

Hi Jarno,

This issue is fixed in ThinkGeo.UnmanagedProj 13.2.0-beta017. Let us know if you still see any issues.

Thanks,
Ben