ThinkGeo.com    |     Documentation    |     Premium Support

Error in baseshape.getdifference with different computer languages

 I am getting a number of errors within the GisSharpBlog.NetTopologySuite when I attempt to run my mapping software on a Portuguese Win 7 machine.  All three errors seem to stem from the fact that decimal degrees do not get converted internally correctly.  The numbers I am seeing in the error log look like they have been converted to the Portuguese format instead of staying in traditional US style.  Below are some of the errors I am getting:


First One:


side location conflict [ (-784500902331482, 38130215189836,6, NaN (Não é um número)) ] Type = GisSharpBlog.NetTopologySuite.Geometries.TopologyException Source = NetTopologySuite at GisSharpBlog.NetTopologySuite.GeometriesGraph.EdgeEndStar.PropagateSideLabels(Int32 geomIndex) at GisSharpBlog.NetTopologySuite.GeometriesGraph.EdgeEndStar.ComputeLabelling(GeometryGraph[] geom) at GisSharpBlog.NetTopologySuite.GeometriesGraph.DirectedEdgeStar.ComputeLabelling(GeometryGraph[] geom) at GisSharpBlog.NetTopologySuite.Operation.Overlay.OverlayOp.ComputeLabelling() at GisSharpBlog.NetTopologySuite.Operation.Overlay.OverlayOp.ComputeOverlay(SpatialFunction opCode) at GisSharpBlog.NetTopologySuite.Operation.Overlay.Snap.SnapOverlayOp.GetResultGeometry(SpatialFunction opCode) at GisSharpBlog.NetTopologySuite.Operation.Overlay.Snap.SnapIfNeededOverlayOp.GetResultGeometry(SpatialFunction opCode) at GisSharpBlog.NetTopologySuite.Geometries.Geometry.Difference(IGeometry other) at ThinkGeo.MapSuite.Core.AreaBaseShape.GetDifferenceCore(AreaBaseShape targetShape) at ThinkGeo.MapSuite.Core.AreaBaseShape.GetDifference(AreaBaseShape targetShape) at KMLParsing.GeometryFromKMLHelper.buildPolygonFromPolyType(PolygonType geom)


 


Second One:


no outgoing dirEdge found [ (-78450254923874,3, 381293457915528, NaN (Não é um número)) ] Type = GisSharpBlog.NetTopologySuite.Geometries.TopologyException Source = NetTopologySuite at GisSharpBlog.NetTopologySuite.GeometriesGraph.DirectedEdgeStar.LinkResultDirectedEdges() at GisSharpBlog.NetTopologySuite.GeometriesGraph.PlanarGraph.LinkResultDirectedEdges(IList nodes) at GisSharpBlog.NetTopologySuite.Operation.Overlay.PolygonBuilder.Add(IList dirEdges, IList nodes) at GisSharpBlog.NetTopologySuite.Operation.Overlay.PolygonBuilder.Add(PlanarGraph graph) at GisSharpBlog.NetTopologySuite.Operation.Overlay.OverlayOp.ComputeOverlay(SpatialFunction opCode) at GisSharpBlog.NetTopologySuite.Operation.Overlay.Snap.SnapOverlayOp.GetResultGeometry(SpatialFunction opCode) at GisSharpBlog.NetTopologySuite.Operation.Overlay.Snap.SnapIfNeededOverlayOp.GetResultGeometry(SpatialFunction opCode) at GisSharpBlog.NetTopologySuite.Geometries.Geometry.Difference(IGeometry other) at ThinkGeo.MapSuite.Core.AreaBaseShape.GetDifferenceCore(AreaBaseShape targetShape) at ThinkGeo.MapSuite.Core.AreaBaseShape.GetDifference(AreaBaseShape targetShape)


 


Third One:


found null Directed Edge Type = GisSharpBlog.NetTopologySuite.Utilities.AssertionFailedException Source = NetTopologySuite at GisSharpBlog.NetTopologySuite.Utilities.Assert.IsTrue(Boolean assertion, String message) at GisSharpBlog.NetTopologySuite.GeometriesGraph.EdgeRing.ComputePoints(DirectedEdge start) at GisSharpBlog.NetTopologySuite.GeometriesGraph.EdgeRing..ctor(DirectedEdge start, IGeometryFactory geometryFactory) at GisSharpBlog.NetTopologySuite.Operation.Overlay.PolygonBuilder.BuildMaximalEdgeRings(IList dirEdges) at GisSharpBlog.NetTopologySuite.Operation.Overlay.PolygonBuilder.Add(IList dirEdges, IList nodes) at GisSharpBlog.NetTopologySuite.Operation.Overlay.PolygonBuilder.Add(PlanarGraph graph) at GisSharpBlog.NetTopologySuite.Operation.Overlay.OverlayOp.ComputeOverlay(SpatialFunction opCode) at GisSharpBlog.NetTopologySuite.Operation.Overlay.Snap.SnapOverlayOp.GetResultGeometry(SpatialFunction opCode) at GisSharpBlog.NetTopologySuite.Operation.Overlay.Snap.SnapIfNeededOverlayOp.GetResultGeometry(SpatialFunction opCode) at GisSharpBlog.NetTopologySuite.Geometries.Geometry.Difference(IGeometry other) at ThinkGeo.MapSuite.Core.AreaBaseShape.GetDifferenceCore(AreaBaseShape targetShape) at ThinkGeo.MapSuite.Core.AreaBaseShape.GetDifference(AreaBaseShape targetShape) at KMLParsing.GeometryFromKMLHelper.buildPolygonFromPolyType(PolygonType geom)



Thomas, 



Thanks for your question. I would imagine this is an issue with the RegionalSettings on that computer not using the '.' symbol for the Decimal Seperator value. Can you try changing the Regional Settings on that computer to the 'English (United States)' Format to verify this is the issue?



 I know, with certainity that regionalization settings of the computer are the culprit.  The code I am using is heavily tested on a number of different operating systems.  These errors started occuring when we first deployed to portuguese systems.  I have been able to recreate on a VM as well.  Having the users change the regionlization of the machines is not a viable option.



Thomas,


There are a couple of threads on this issue that might be of interest:


gis.thinkgeo.com/Support/Dis...fault.aspx

gis.thinkgeo.com/Support/Dis...fault.aspx


Perhaps setting your values to an InvariantCulture before peforming a GetDifference would resolve the issue?


You might also take a look at some of the MSDN documentation for InvariantCulture to see if this might be an option for your application: 

msdn.microsoft.com/en-us/lib....100).aspx


Edit: 

This maybe a bug on our side where we are not 'formatting' the results of that we get back from NTS to InvariantCulture. I am going to setup a test scenario to see if this might be the case.



Hi Thomas,  
  
 I created a sample application that I think should recreate the issue you are seeing but I would like to get some additional information about your application as I am not currently able to recreate the exception using version 6.0.0.0. 
  
 First what version of Map Suite are you referencing? 
 Can you provide me with the exact code (or a sample application) you are using to perform your BaseShape.Difference? I want to make sure my sample works the same way as yours.