ESRI and Microsoft SQL disagreeing on what is a valid shape

Discussion created by micsbjc on Jun 18, 2016
Latest reply on Jun 19, 2016 by lpinner

We are using Microsoft SQL Server 2012 and ESRI 10.2 in a Windows environment, shapes are stored in Geometry format.

We are trying to programmatically add shapes directly to an ESRI Geodatabase (IE via SQL, not ESRI routines).

Some of the shapes have suspect self-intersections and we need to either make them valid, or reject them.

This issue we are having is that raw SQL environment considers the shapes valid, but when they are read by ESRI products some are considered invalid.

This issue seems to be related to the number of decimal places used by SQL versus that used by ESRI.

The attached SQL code demonstrates the issue..

  • The initial shape is considered by SQL to be valid, but when inserted into an ESRI layer, ESRI considers it self-intersecting.
  • By reducing the number of decimal places, (7 for Lng and 8 for Lat), we can get ESRI to agree with SQL that the shape is ‘valid’

My question is have I detected a solution that is applicable to all cases (IE ESRI and SQL will always both agree on validity or otherwise).


Feedback from anyone with knowledge in this area would be appreciated