ThinkGeo.com    |     Documentation    |     Premium Support

Topology Exception

Hi,



I am getting the below exception when running a GetFeaturesNearestTo query on multiPolygon type layers.  I am guessing it has something to do with the NaN value in the z coordinate.



Here’s the function I am using:

 Collection<Feature> selectedFeature = imfl.QueryTools.GetFeaturesNearestTo(clickedPoint, GeographyUnit.Meter, 1, new string[1] { “Name” }, 250, DistanceUnit.Meter);






GisSharpBlog.NetTopologySuite.Geometries.TopologyException was unhandled

  Message=side location conflict [ (12720485.1419011, 542540.041027168, NaN) ]

  Source=NetTopologySuite

  StackTrace:

       at GisSharpBlog.NetTopologySuite.GeometriesGraph.EdgeEndStar.PropagateSideLabels(Int32 geomIndex)

       at GisSharpBlog.NetTopologySuite.GeometriesGraph.EdgeEndStar.ComputeLabelling(GeometryGraph[] geom)

       at GisSharpBlog.NetTopologySuite.Operation.Relate.RelateComputer.LabelNodeEdges()

       at GisSharpBlog.NetTopologySuite.Operation.Relate.RelateComputer.ComputeIM()

       at GisSharpBlog.NetTopologySuite.Operation.Relate.RelateOp.get_IntersectionMatrix()

       at GisSharpBlog.NetTopologySuite.Operation.Relate.RelateOp.Relate(IGeometry a, IGeometry b)

       at GisSharpBlog.NetTopologySuite.Geometries.Geometry.Relate(IGeometry g)

       at GisSharpBlog.NetTopologySuite.Geometries.Geometry.Intersects(IGeometry g)

       at ThinkGeo.MapSuite.Core.BaseShape.IntersectsCore(BaseShape targetShape)

       at ThinkGeo.MapSuite.Core.BaseShape.Intersects(BaseShape targetShape)

       at ThinkGeo.MapSuite.Core.MultipolygonShape.GetDistanceToCore(BaseShape targetShape, GeographyUnit shapeUnit, DistanceUnit distanceUnit)

       at ThinkGeo.MapSuite.Core.BaseShape.GetDistanceTo(BaseShape targetShape, GeographyUnit shapeUnit, DistanceUnit distanceUnit)

       at ThinkGeo.MapSuite.Core.FeatureSource.GetFeaturesWithinDistanceOfCore(BaseShape targetShape, GeographyUnit unitOfData, DistanceUnit distanceUnit, Double distance, IEnumerable`1 returningColumnNames)

       at ThinkGeo.MapSuite.Core.FeatureSource.GetFeaturesWithinDistanceOf(BaseShape targetShape, GeographyUnit unitOfData, DistanceUnit distanceUnit, Double distance, IEnumerable`1 returningColumnNames)

       at ThinkGeo.MapSuite.Core.FeatureSource.GetFeaturesNearestTo(BaseShape targetShape, GeographyUnit unitOfData, Int32 maxItemsToFind, IEnumerable`1 returningColumnNames, Double searchRadius, DistanceUnit unitOfSearchRadius)

       at ThinkGeo.MapSuite.Core.QueryTools.GetFeaturesNearestTo(BaseShape targetShape, GeographyUnit unitOfData, Int32 maxItemsToFind, IEnumerable`1 returningColumnNames, Double searchRadius, DistanceUnit unitOfSearchRadius)

       at EmuSL.SelectObjectsOnMap.SelectItemOnMap(WinformsMap winformsMap, TreeList treeLayers, LayerOverlay layerOverlay, BaseShape clickedPoint, Int32 scenarioID) in C:\Users\dhite\Documents\Visual Studio 2010\Projects\EMU\EmuSL\SelectObjectsOnMap.cs:line 56

       at EmuSL.Main.winformsMap1_MapClick(Object sender, MapClickWinformsMapEventArgs e) in C:\Users\dhite\Documents\Visual Studio 2010\Projects\EMU\EmuSL\Main.cs:line 1498

       at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.OnMapClick(MapClickWinformsMapEventArgs e)

       at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.DBQ=(InteractionArguments yBc=)

       at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.8xM=(Object thc=, 4RU= txc=)

       at QRQ=.2xQ=.OnMouseEvent(4RU= e)

       at QRQ=.2xQ=.CRU=(Object ChU=, EventArgs CxU=)

       at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)

       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)

       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)

       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)

       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)

       at EMU.Program.Main() in C:\Users\dhite\Documents\Visual Studio 2010\Projects\EMU\EMU\Program.cs:line 18

       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)

       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)

       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

       at System.Threading.ThreadHelper.ThreadStart()

  InnerException:

Nevermind.  I have just seen the excellent project on merging these shapes and that has worked perfectly. 
  
 Thanks, 
 Damian

Hi Damian,


 


Glad to hear you have got a way to fix the issue. Actually,
here is a similar thread in our forums thinkgeo.com/forums/MapSuite...fault.aspx
, we can see it seems there are some bugs in NetTopologySuite validations on
some spatial shapes. 


 


Thanks for your post anyway.


Johnny