ThinkGeo.com    |     Documentation    |     Premium Support

NativeImageRasterLayer width OutOfRange Exception

Greetings,

We use a NativeImageRasterLayer to display a bitmap file to serve as texture for the world. Once zoomed in enough, it no longer displays, and instead shows “the input double value is out of range. parameter name: width” instead.

Are there any options to automatically prevent drawing the layer if it is going to fail at ValidatorHelper’s CheckInputValuesInRange function? Not attempting to display the layer would be much better than both showing exception text on the screen and seconds of slowdown/garbage collector churn.

Thanks!

Thanks Fred,
I tested on my environment. I didn’t see the error. Could you attach you sample project. We can look into more detail. I attached my demo project. You can modify it if you want.

WpfApp38.zip (5.2 KB)

Thanks

Frank

Main difference would be that we have

mapView.MapUnit = ThinkGeo.Core.GeographyUnit.DecimalDegree;

And an extent for the layer of -180,90,180,-90.

What would be the best way to prevent drawing when zoomed too far in? Setting Thresholds? If so, what’s the best way to automatically calculate that automatically? Thanks.

WholeEarthNight.bmp (2.0 MB)

Thanks Fred,
The single bmp file can not work. You need a file to specify the geo reference. That mean where to put the bmp file on the map. I generate one for you. It may not precise you may need adjust it or find the correct one for your bmp file. The code will be like this one
private void Window_Loaded(object sender, RoutedEventArgs e)
{
mapView.MapUnit = ThinkGeo.Core.GeographyUnit.DecimalDegree;
NativeImageRasterLayer test = new NativeImageRasterLayer(@“D:\WholeEarthNight.bmp”);
LayerOverlay lo = new LayerOverlay();
lo.TileType = TileType.SingleTile;
lo.Layers.Add(test);
mapView.Overlays.Add(lo);
mapView.Refresh();
}

File.zip (379.6 KB)

2020-10-30_14-29-15.zip (3.7 MB)

Thanks

Frank