MapView crashes while rendering random geometries

3888
1
03-24-2015 06:09 AM
Labels (1)
MathiasBecher
New Contributor

Some time ago, I asked this question on Stackoverflow. Sadly, I didn't get an answer yet.

For convenience, I provide the text of the question here again (better formatting on Stackoverflow). Hopefully, someone can help me.

I am using the Esri ArcGISRuntime for WPF SDK.

When I add a specific geometry to a graphics layer the runtime throws an exception:

System.Exception was unhandled HResult=-2146233088 Message=Geometry is corrupted and can not be used. : Source=Esri.ArcGISRuntime StackTrace: at RuntimeCoreNet.Interop.HandleException(Boolean retVal) in Interop.cs: line 54 at RuntimeCoreNet.CoreGeometryEngine.ProjectForDisplay(ICoreGeometry[] coreGeometries, CoreSpatialReference[] inCoreSRs, CoreSpatialReference outCoreSR) in CoreGeometryEngine.cs: line 77 at RuntimeCoreNet.CoreGraphicsLayerWrapper.ReprojectGeoms(ICoreGeometry[] geomArray, CoreSpatialReference[] inSRArray, CoreSpatialReference outSR, List`1 reprojectionIndicies) in C:\Users\mathias.becher.INTRANET\AppData\Local\JetBrains\Shared\v01\DecompilerCache\decompiler\207C5F0B-5A6C-43F9-AA7E-BA622D21C04A\71\43e7a7ec\CoreGraphicsLayerWrapper.cs: line 58 at RuntimeCoreNet.CoreGraphicsLayerWrapper.AddGraphicsInternal(AdditionInfo additions, SpatialReference mapSR) in C:\Users\mathias.becher.INTRANET\AppData\Local\JetBrains\Shared\v01\DecompilerCache\decompiler\207C5F0B-5A6C-43F9-AA7E-BA622D21C04A\71\43e7a7ec\CoreGraphicsLayerWrapper.cs: line 196 at RuntimeCoreNet.CoreGraphicsLayerWrapper.UpdatePendingGraphics() in C:\Users\mathias.becher.INTRANET\AppData\Local\JetBrains\Shared\v01\DecompilerCache\decompiler\207C5F0B-5A6C-43F9-AA7E-BA622D21C04A\71\43e7a7ec\CoreGraphicsLayerWrapper.cs: line 269 at Esri.ArcGISRuntime.Controls.ViewBase.MapBatchProcess() in C:\Users\mathias.becher.INTRANET\AppData\Local\JetBrains\Shared\v01\DecompilerCache\decompiler\207C5F0B-5A6C-43F9-AA7E-BA622D21C04A\09\765599cd\ViewBase.cs: line 1474 at Esri.ArcGISRuntime.Controls.ViewBase._batchUpdateTimer_Tick(Object sender, Object e) in C:\Users\mathias.becher.INTRANET\AppData\Local\JetBrains\Shared\v01\DecompilerCache\decompiler\207C5F0B-5A6C-43F9-AA7E-BA622D21C04A\09\765599cd\ViewBase.cs: line 1463 at System.Windows.Threading.DispatcherTimer.FireTick(Object unused) 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.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, ref Boolean handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, ref 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(ref MSG msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run()

The message is sometimes

Geometry is corrupted and can not be used. :

and sometimes

Out of Range :

The ArcGIS JSON for the Geometry looks like this:

{ "rings": [ [ [4615905,5670974.5],[4615907.2999999998,5670946.5999999996],[4615908,5670938],[4615896.2494000001,5670854.3267999999],[4615906.6396000003,5670835.2956000008],[4615906.7993000001,5670829.7652000003],[4615859.6497,5670807.6359999999],[4615820.8963000001,5670792.6265999991],[4615783.5515999999,5670779.0028000008],[4615748.9396000002,5670768.8585000001],[4615720.6342000002,5670762.7089000009],[4615613.1843999997,5670753.3034000006],[4615611.8454,5670753.2748000007],[4615581.6266000001,5670752.6349999998],[4615541.9779000003,5670755.7150999997],[4615490.4504000004,5670762.5042000003],[4615475.7495999997,5670764.5595999993],[4615472.8079000004,5670777.4870999996],[4615472,5670859],[4615469.5,5670908.5],[4615469.5,5670926],[4615469,5670935.0999999996],[4615460,5671097],[4615460,5671106],[4615456.5,5671145.5],[4615447.5,5671247],[4615443.5,5671299.5],[4615430.5,5671463.5],[4615591,5671476.5],[4615704,5671486.5],[4615853.5,5671498],[4615861,5671407],[4615871.3839089964,5671304.8366202144],[4615883.1511221537,5671189.0634304462],[4615898.7999999998,5671035.0999999996],[4615905,5670974.5] ], [ [4615905,5670974.5],[4615806.4102548826,5671142.1025666995],[4615790.7505476633,5671168.7240689723],[4615861.7244710932,5671048.0683991415],[4615905,5670974.5]],[[4615790.7505476633,5671168.7240689723],[4615685.8400790496,5671101.6904205801],[4615709.3655735208,5671116.7222829424],[4615790.7505476633,5671168.7240689723] ], [ [4615861.7244710932,5671048.0683991415],[4615806.2506467318,5670992.566504566],[4615726.4072268894,5670912.6826832909],[4615861.7244710932,5671048.0683991415] ], [ [4615663.6754335677,5671087.528087005],[4615550.6250370946,5671015.2933460111],[4615546.5,5671030],[4615558,5670989],[4615569.9000000004,5670940.1999999993],[4615575.5,5670917],[4615578.1063946998,5670906.6877427083],[4615576.3770848848,5670913.5297945868],[4615602.6684305351,5670937.1472172178],[4615602,5670937.5],[4615599.2000000002,5670971.0999999996],[4615601.5999999996,5670984.0999999996],[4615605.7999999998,5670994.3000000007],[4615613,5671008.1999999993],[4615617.4000000004,5671021.5],[4615619.5999999996,5671032.3000000007],[4615621.4000000004,5671040.0999999996],[4615623.7999999998,5671044.3000000007],[4615628.5999999996,5671044.6999999993],[4615634.5999999996,5671043.5],[4615639.5999999996,5671036.1999999993],[4615641.0999999996,5671020.3000000007],[4615642,5670998.1999999993],[4615641.1138411984,5671019.9601216801],[4615676.0974427527,5671052.9055918409],[4615663.6754335677,5671087.528087005] ], [ [4615578.1063946998,5670906.6877427083],[4615723.4054336874,5670921.0492501659],[4615688.2336575678,5671019.0796597805],[4615693.7225749865,5671003.7810060792],[4615640.193375092,5670987.7434740169],[4615638.7000000002,5670979.0999999996],[4615636.7999999998,5670962.0999999996],[4615636,5670947.8000000007],[4615644.5999999996,5670946.5],[4615644.2999999998,5670931.5999999996],[4615642.9596180143,5670919.8716576239],[4615644.844244685,5670913.2841809019],[4615578.1063946998,5670906.6877427083] ], [ [4615755.3395999996,5670798.7449999992],[4615790.5947000002,5670811.3576999996],[4615765.9272806915,5670802.5327992188],[4615755.3395999996,5670798.7449999992] ] ], "spatialReference":{"wkid":31464,"latestWkid":31468} }

This is created via some transformation from this WKT Geometry (Spatial Reference ID 31468), which SQL Server considers valid, and has no trouble showing:

POLYGON ((4615905 5670974.5, 4615907.3 5670946.6, 4615908 5670938, 4615896.2494 5670854.3268, 4615906.6396 5670835.2956000008, 4615906.7993 5670829.7652, 4615859.6497 5670807.636, 4615820.8963 5670792.6265999991, 4615783.5516 5670779.0028000008, 4615748.9396 5670768.8585, 4615720.6342 5670762.7089000009, 4615613.1844 5670753.3034000006, 4615611.8454 5670753.2748000007, 4615581.6266 5670752.635, 4615541.9779 5670755.7151, 4615490.4504 5670762.5042, 4615475.7496 5670764.5595999993, 4615472.8079 5670777.4871, 4615472 5670859, 4615469.5 5670908.5, 4615469.5 5670926, 4615469 5670935.1, 4615460 5671097, 4615460 5671106, 4615456.5 5671145.5, 4615447.5 5671247, 4615443.5 5671299.5, 4615430.5 5671463.5, 4615591 5671476.5, 4615704 5671486.5, 4615853.5 5671498, 4615861 5671407, 4615871.3839089964 5671304.8366202144, 4615883.1511221537 5671189.0634304462, 4615898.8 5671035.1, 4615905 5670974.5), (4615905 5670974.5, 4615806.4102548826 5671142.1025666995, 4615790.7505476633 5671168.7240689723, 4615861.7244710932 5671048.0683991415, 4615905 5670974.5), (4615790.7505476633 5671168.7240689723, 4615685.84007905 5671101.69042058, 4615709.3655735208 5671116.7222829424, 4615790.7505476633 5671168.7240689723), (4615861.7244710932 5671048.0683991415, 4615806.2506467318 5670992.566504566, 4615726.4072268894 5670912.6826832909, 4615861.7244710932 5671048.0683991415), (4615663.6754335677 5671087.528087005, 4615550.6250370946 5671015.2933460111, 4615546.5 5671030, 4615558 5670989, 4615569.9 5670940.1999999993, 4615575.5 5670917, 4615578.1063947 5670906.6877427083, 4615576.3770848848 5670913.5297945868, 4615602.6684305351 5670937.1472172178, 4615602 5670937.5, 4615599.2 5670971.1, 4615601.6 5670984.1, 4615605.8 5670994.3000000007, 4615613 5671008.1999999993, 4615617.4 5671021.5, 4615619.6 5671032.3000000007, 4615621.4 5671040.1, 4615623.8 5671044.3000000007, 4615628.6 5671044.6999999993, 4615634.6 5671043.5, 4615639.6 5671036.1999999993, 4615641.1 5671020.3000000007, 4615642 5670998.1999999993, 4615641.1138411984 5671019.96012168, 4615676.0974427527 5671052.9055918409, 4615663.6754335677 5671087.528087005), (4615578.1063947 5670906.6877427083, 4615723.4054336874 5670921.0492501659, 4615688.2336575678 5671019.0796597805, 4615693.7225749865 5671003.7810060792, 4615640.193375092 5670987.7434740169, 4615638.7 5670979.1, 4615636.8 5670962.1, 4615636 5670947.8000000007, 4615644.6 5670946.5, 4615644.3 5670931.6, 4615642.9596180143 5670919.8716576239, 4615644.844244685 5670913.2841809019, 4615578.1063947 5670906.6877427083), (4615755.3396 5670798.7449999992, 4615790.5947 5670811.3577, 4615765.9272806915 5670802.5327992188, 4615755.3396 5670798.7449999992))

Does anybody know what the problem is with this geometry? Is this a bug with the ArcGIS runtime, or do I need to take some special care when creating geometries? (This specific geometry is the result of Unioning multiple smaller geometries using GeoAPI.)

0 Kudos
1 Reply
MathiasBecher
New Contributor

After further investigation, the problem seems to happen, when there are very small multipart geometry parts. The above geometry for example, contains a part with an area of about 0.6m².

But in my opinion the runtime should definitely not crash on encountering such a geometry.

0 Kudos