Hi,
We need to project large raster maps over the background map. These maps can be e.g. 12000*12000 pixels sometimes. This has been working fine on 64-bit application builds, but we have also requirement to support 32-bit operating systems. We’ve noticed problems in 32-bit application builds with these raster files.
I’m using this code to project a PNG file:
private void mapView_Loaded(object sender, RoutedEventArgs e)
{
// Set the Map Unit.
mapView.MapUnit = GeographyUnit.Meter;
// Add a base map overlay.
var cloudRasterBaseMapOverlay = new ThinkGeoCloudRasterMapsOverlay("USlbIyO5uIMja2y0qoM21RRM6NBXUad4hjK3NBD6pD0~", "f6OJsvCDDzmccnevX55nL7nXpPDXXKANe5cN6czVjCH0s8jhpCH-2A~~", ThinkGeoCloudRasterMapsMapType.Light);
mapView.Overlays.Add(cloudRasterBaseMapOverlay);
// Add a raster layer
var layer = new NativeImageRasterLayer(@"AppData/test.png", @"AppData/test.wld");
layer.ImageSource.ProjectionConverter = new UnmanagedProjectionConverter(3067, 3857);
layer.Open();
mapView.CurrentExtent = layer.GetBoundingBox();
LayerOverlay layerOverlay = new LayerOverlay();
layerOverlay.Layers.Add(layer);
mapView.Overlays.Add(layerOverlay);
mapView.Refresh();
}
I’m using just a test picture, with no real map data in it just for testing purposes. It looks like this in 64-bit build:
This is basically correct, but that white stripe surrounded with red ellipse should not be there. (I’ve seen this kind of artifacts earlier with projected raster files…)
But if I build a 32-bit app variant, at first it looks the same, but when I zoom in, I get this:
“Unable to allocate pixels for the bitmap.” exception gets printed to the map. Also in our production application we are seeing that the raster file can’t be added to the map at all. Layer.Open throws this exception:
MapCoreTestClient.exe Error: 0 : MapCore.Model.LayerImportResult|Exception|System.Exception: Unable to allocate pixels for the bitmap.
at SkiaSharp.SKBitmap..ctor(SKImageInfo info, Int32 rowBytes)
at SkiaSharp.SKBitmap.Decode(SKCodec codec, SKImageInfo bitmapInfo)
at SkiaSharp.SKBitmap.Decode(SKCodec codec)
at SkiaSharp.SKBitmap.Decode(String filename)
at ThinkGeo.Core.NativeImageRasterSource.OpenCore()
at ThinkGeo.Core.RasterSource.Open()
at ThinkGeo.Core.RasterLayer.OpenCore()
at ThinkGeo.Core.Layer.Open()
Is there something that can be done to make this work?
I have added the test project here as reference. It has both AnyCPU and x86 build configurations.ThinkGeo32Bit.zip (38.5 KB)
Thanks,
Rasmus