SDE Code (-155): Linestring or poly boundary is self-intersecting

4385
9
03-22-2011 05:22 AM
AgnesPoirier
Emerging Contributor
Hi,
I'm having the above errors while trying to append polygons to an existing layer using ShpToSde.
I'm working with ArcSDE   8.1.1   and ArGIS 9.3.1, the system units of this layer is set to 1000000.000000
The polygons have been generated from lines, geometry and polygon generation have been checked with Argis topology tools and no errors are detected.
I've tried to load these polygons to a new layer with the System Units set to 100000000.000000 and it works.
So apparently, it's a question of how this layer is set but I can't change this parameter.
Is there a way to detect this self-intersections in order to change the original polygons/Lines.
Can we set some parameters in the dataset properties or topology properties in order to detect the same self-intersecting erros in ArcGis

Thanks
0 Kudos
9 Replies
VinceAngelo
Esri Esteemed Contributor
Esri never released an 8.1.1 version of ArcSDE (8.1 went directly to 8.1.2; both were
retired in May 2004).

What version and service pack of ArcSDE are you using?  With which database?

The 'shp2sde' command always allows you to specify a coordinate reference with the
'create' option.  In fact, you *should* use the '-x' or '-R' option every time you use
'shp2sde' or 'sdelayer' to create a layer.

The 'shp2sde' utility includes a "reject" option ('-r') to allow you to place shapes which
fail validation into a location for further processing.  If the data works at 100*N scale,
but not at N scale, that means you will likely need to do significant processing to make
it load at N scale.

- V
0 Kudos
SamSnyder1
Deactivated User
Hi Vince,

Like the person above, I am running into SDE Code (-155) when loading spatial data from a vendor, as well as two other errors that seem to be related: 

SDE Code (-148): The number of points is less than required for feature
SDE Code (-152): Polygon shell has no area. 

I just came across this forum thread and hope you can give me some advice.

I write my bad shapes out to a reject file.  I was wondering what type of "significant processing" you meant in your statement, " If the data works at 100*N scale, but not at N scale, that means you will likely need to do significant processing to make it load at N scale."

Most of the data we receive from our vendor has no problems.  But I've run into several problems lately.  The vendor does not seem to be able to resolve them.  I'm hoping I can do something on my end.

Any help is appreciated.

Thanks,
Sam
0 Kudos
VinceAngelo
Esri Esteemed Contributor
Any time a human has to review individual errors that should have processd in
microseconds, there's going to be "significant processing" delays (by 8-9 orders
of magnitude).

Topology errors are an indication of incorrect data capture.  ArcSDE is tolerant of
some errors (incorrect orientation, mistaken part/subpart sequencing) and intolerant
of others (part overlap, self-intersection, zero area).  ArcGIS is more tolerant of some
errors (self-intersection), but sometimes makes incorrect resolutions (bow-ties are
always converted to a pair of intersecting triangles, when a quadrilateral may have
been intended).

Vendors should be responsible for delivering correct data.  If sloppy procedures write
shapefiles that are non-compliant, then it's the procedures that need cleanup, not the
data, and fixing them post-delivery could miss issues that are hidden by pairs of errors
(like making quadrilaterals into multi-part triangle pairs).  I urge caution -- By accepting
data with errors that you correct, you may be absolving the vendor from fixing the
errors you don't correct.

- V
0 Kudos
SamSnyder1
Deactivated User
Thank you! 

That is the stand of our company (seeing as we are paying for this data).  Thanks for helping me understand some of the details involved.
0 Kudos
VincentSclafani
New Contributor
Vince,

The issue I am encountering is that SQL Server claims that all of the geomerties are valid, but ESRI finds self intersecting polygons. Is there a SDE command that would return the objectid's that it believes are invalid?

Thanks for your help and below is the configuration,
Vince

SQL Server 2008 R2 SQL for invalid geometries. This query retruns no records.
select
  objectid
, shape.STIsValid() as valid
,shape.STNumPoints() as vertices
, shape.STAsText() as shape_text
,shape
from SECTION
where shape.STIsValid() <> 1

ArcSDE 10.0 sp5


ArcSDE 10.0  for SQL Server Build 2063 Tue May 22 14:45:23  2012
Layer    Administration Utility
-----------------------------------------------------
Layer Description ....: <None>
Database              : SDE
Table Owner ..........: SDE
Table Name ...........: SECTION
Spatial Column .......: SHAPE
Layer Id .............: 23
SRID .................: 2
Auth SRID.............: 4326
Minimum Shape Id .....: 1
Offset ...............:
  falsex:       -400.000000
  falsey:       -400.000000
System Units .........: 1000000000.000000
Z Offset..............:          0.000000
Z Units ..............:          1.000000
Measure Offset .......: <None>
Measure Units ........: <None>
XY Cluster Tolerance .:          0.000000008983
Spatial Index ........:
  parameter:    SPIDX_MSSQL
  exist:        Yes
  array form:   -6,0,0
Layer Envelope .......: <EMPTY>
Entities .............: nac+
Layer Type ...........: In-Line Spatial Type/GEOMETRY
Creation Date ........: 02/21/13 21:19:36
I/O Mode .............: NORMAL
Autolocking ..........: Enabled
Precision.............: High
User Privileges ......: SELECT, UPDATE, INSERT, DELETE
Coordinate System ....: GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]

Layer Configuration ..: GEOMETRY
0 Kudos
VincentSclafani
New Contributor
It seems that StIsSimple() provides what I need. Thanks.
0 Kudos
VinceAngelo
Esri Esteemed Contributor
There is a command ('sdelayer -o feature_info'), but it only works with Oracle.

If you export all the shapes in Well-Known Text along with an objectid, you can pass
the data through 'ascinfo' with a reject file to capture the invalid geometries.  You can
also change the coordinate reference parameters, to see if decreasing the XY scale
helps avoid overlap (though sometimes it makes it worse).

The 'ascinfo' utility is part of se_toolkit.  I can steer you through the basics, but using
command-line utilities like this requires extra effort (and the ability to download
open source binaries).

- V
0 Kudos
JohnCuthbertson
Emerging Contributor

I have a similar problem and so I thought I would take Vince's advice and see if I could isolate the baddies  using ascinfo.

I dumped my SQL geometry into a flat file

2 POLYGON ((120.258097207178 -28.8259932764729, 120.266262438367 -28.8253653184617, 120.271354650676 -28.8315606240709, 120.271588304722 -28.8377220084302, 120.26499880165 -28.8385718603031, 120.258097207178 -28.8259932764729))
3 POLYGON ((120.271354650676 -28.8315606240709, 120.277827541831 -28.8300055765609, 120.282974908246 -28.8436300321902, 120.276499614822 -28.8451858541119, 120.271588304722 -28.8377220084302, 120.271354650676 -28.8315606240709))

etc

I then setup a CTL file in various combinations, but I could not get the syntax correct. The current sticking point is how to specify that input is polygons.

..\jc.ctl: Class 'GeoArea' not found (line 10)
..\jc.ctl: Class 'GeoPolygon' not found (line 11)
..\jc.ctl: Class 'GeoPoly' not found (line 11)
..\jc.ctl: Class 'Geopoly' not found (line 11)
..\jc.ctl: Class 'GEOPOLygon' not found (line 11)
..\jc.ctl: Class 'GEOPOL' not found (line 11)

COORDREF_XY -210,-120,1000000
COORDSYS GCS_WGS_1984
EFLAGS "np"

SKIP 1

COLUMNS
OBJECTID String - 11 N
$WKT String - 32767 N
Shape GEOPOL($WKT) - 1 Y
END

Can someone push me along a little bit?

Thanks

0 Kudos
VinceAngelo
Esri Esteemed Contributor

You don't need to parse WKT before making a shape from it (though it will actually work):

COORDREF_XY     -400,-400,1000000
COORDSYS        GCS_WGS_1984
EFLAGS          "na+"
DELIMITERS      "\t"
SKIP            1

COLUMNS
OBJECTID        Int32               -    10 N
# $WKT          String              - 32767 N 
# Shape         AsShape($WKT,WKT)   -    32 Y
SHAPE           WKTShape            -  1000 Y
END

Assmptions:

1) You are using a 10.x ArcGIS install (or at least something after 9.1, so that HIGH precision coordinate references are in use)

2) You have a tab between the objectid and well-known text (the default delimiters set includes a comma, which messes up WKT).  There are other ways to parse the line if the objectid is space delimited from WKT.

3) The geometry doesn't exceed 1000 kilobytes (1024000 bytes) -- the maximum is 32767k (all BLOB, CLOB, XML, and Shape columns are in kilobyte units)

0 Kudos