Hi,
Currently I’m working with about 1o geotiff files that are raster maps at a 1:20000 scale. Each of these files is about 80Mb so I’m loading a huge amount of data. When I start loading vector data on top of that I eventually get the following exception thrown:
System.Argument Exception: Parameter is not valid.
at ThinkGeo.MapSuite.WpfDesktopEdition.Tile.<>c__DisplayClass6.<DrawException>b__4()
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 CMHInc.Snowbase2.App.Main() in t:\Current\CMHInc.Snowbase2\CMHInc.Snowbase2\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()
I’m sure the problem is caused by the huge amount of data I’m loading as enabling tile caching seems to make it occur less frequently (if the tiles are pre-generated). Can you recommend a better way of accomplishing this? I’m currently loading each Geotiff in a GDIPlusRasterLayer (which seems to render nicer that the GeoTiffRasterLayer) and adding them all to an overlay with the UpperThreshold set the Double.Max and the LowerThreshold set to 0. If I was to acquire some 1:250000 maps for my area and set the thresholds such that it shows the 1:1250000 maps when the user is zoomed out more, would that help? I would still have to load all of the files at start-up but maybe it’s just a problem with how much I’m displaying at a given time?
Thanks for your imput!
Working with different scales of GeoTiffs
Hi Trevor,
We can only knows it’s a thread exception from the exception message. Because you load so many big data, and if cache is helpful, I think you should be right, that’s caused by multiply thread render big data.
I think if you open cache for all the data, this exception won’t be thrown again. But you mentioned it’s only less frequently. So the render code maybe can get enhancement, if possible, could you please build a simple sample with your render code which can reproduce this, so we can try to find where is the problem exception the big data issue.
For your question, the GdiPlusRasterLayer is different with ShapeFileFeatureLayer, it will load all data and shows part of it when you pan or zoom, so I am not sure whether modify the initialize extent is helpful for avoid that, but I think you can try to set IsVisible equal false if you don’t want to show any data in your extent, maybe that’s helpful.
But open cache and directly render cache should still be the best solution.
Regards,
Don
Thanks Don,
I had our GIS contractor generate a better base map and the Thread Exception doesn’t seem to be occurring anymore so I think it was definitely a problem with the large data set. From my end, I’m good to go, but if your team wanted to investigate, the problem occurred when I loaded about 10 Tiffs of 80ish MB each (Topo maps). Each one was put into a GdiPlusRasterLayer which was added to an overlay. I then loaded about 50 polygons to display on the map and would often get it to crash by zoom in/out or panning around quickly. As I mentioned, tile caching greatly reduced the problem.
Cheers,
Trevor
Hi Trevor,
Thanks for your further information, but seems like we are unable to reproduce the issue on our end with the attached sample, would you please check if there is any missing there? Or Would you please update your test data to us? You can ask a FTP address for sales@thinkgeo.com for upload.
Thanks,
Johnny
post12529.zip (9.11 KB)
Hi Trevor,
I am glad to hear build new data solve this problem.
Thanks for your detail information, I think our developer will do some investigate for this issue.
Regards,
Don
unfortunately I deleted the 10 large GeoTiffs I was previously using so I’m currently unable to replicate the issue
Hi Trevor,
Thanks for let us know the exception, because for GeoTiff sometimes the issue related with the data. We will keep trying find more data to test for reproduce that, and if you met the exception again please let us know and sent us your test data.
Regards,
Don