I am testing the new raster projection code in a wpf project
When I load a raster up and apply a projection when I zoom in on the second zoom the application crashes with an External component has thrown an exception.
Stack Trace
at ThinkGeo.MapSuite.WpfDesktopEdition.Tile.<>c__DisplayClass6.<drawexception>b__4()</drawexception>
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at Reproject_Rasters.App.Main() in c:\Users\murray.bryant\Documents\Visual Studio 2012\Projects\Reproject Rasters\Reproject Rasters\obj\Debug\App.g.cs:line 0
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
The code I am using to load is
public MainWindow()
{
InitializeComponent();
Map.MapUnit = GeographyUnit.DecimalDegree;
var imageLayer = new Jpeg2000RasterLayer( @"C:\spatial\Kalgoorlie_SH51_250KTOPO_MGA51_JPG2\Kalgoorlie_SH51.jp2");
imageLayer.Open();
var bounds = imageLayer.GetBoundingBox();
var proj = new Proj4Projection
{
InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(28351),
ExternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(4326)
};
imageLayer.ImageSource.Projection = proj;
proj.Open();
var overlay = new LayerOverlay();
Map.Overlays.Add(overlay);
overlay.Layers.Add(imageLayer);
Map.CurrentExtent = proj.ConvertToExternalProjection(bounds);
}
You can find that file here
it is the 250K Topography series mosaic images -> Kalgoorlie Image
It works fine if you do not apply the projection.
Am I doing this wrong? Or is this a bug
Version 6.0.189.0
regards
Murray