English

Problem: SDO_Geometry layer does not completely draw due to invalid geometry data in Oracle Spatial layer

Description

Only some of the features from an SDO_Geometry layer draw or are returned to the client application.

Cause

When an Oracle Spatial layer does not fully draw, it is likely due to the presence of invalid geometry data.

Oracle Spatial allows the storage of invalid data. The presence of invalid data can cause problems when the data is consumed by an ArcSDE client. Most clients assume that all data that comes from ArcSDE is valid because ArcSDE and Esri ST_Geometry do not allow the storage of invalid geometry. Assuming that the geometry is valid speeds up processing, but it does not guarantee that an error message is returned if invalid data is present.

When the client requests invalid data from the geodatabase, ArcSDE stops the current operation. This indicates data is missing and the problem should be investigated.

Solution or Workaround

To correct the problem, identify the invalid geometries using one of the following tools or functionality, and remove or correct the invalid geometries.
 

Note:
What functionality is available may depend on which release of ArcSDE is being used.
  • In Oracle, there are Oracle validation functions such as SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT.
    SQL> SELECT A.ObjectID, SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(A.SHAPE, M.diminfo) AS PROBLEM
    2 FROM tot_errors A,USER_SDO_GEOM_METADATA M
    3 WHERE M.table_name = 'TOT_ERRORS'
    4 AND M.column_name = 'SHAPE'
    5 AND SDO_GEOM.VALIDATE_GEOMETRY_WITH_CONTEXT(A.SHAPE, M.diminfo) <> 'TRUE';
    
    OBJECTID PROBLEM
    ---------- --------------------------------------------------------------------------------
    672 13366 [Element <1>] [Ring <1>]
    672 13366 [Element <1>] [Ring <1>]
    673 13366 [Element <1>] [Ring <1>]
    552 13349 [Element <1>] [Ring <26>][Edge <345>][Edge <45>]
    435 13349 [Element <1>] [Ring <2>][Edge <8>][Edge <4>]
    436 13349 [Element <1>] [Ring <4>][Edge <6>][Edge <17>]
    437 13349 [Element <1>] [Ring <5>][Edge <8>][Edge <12>]
    438 13349 [Element <1>] [Ring <2>][Edge <8>][Edge <4>]
    674 13349 [Element <1>] [Ring <2>][Edge <8>][Edge <18>]
    675 13349 [Element <1>] [Ring <5>][Edge <26>][Edge <10>]
    676 13366 [Element <1>] [Ring <1>]
    677 13349 [Element <1>] [Ring <1>][Edge <2008>][Edge <2020>]
    678 13349 [Element <1>] [Ring <1>][Edge <2810>][Edge <1>]
    679 13349 [Element <1>] [Ring <1>][Edge <2250>][Edge <1>]
    680 13349 [Element <1>] [Ring <1>][Edge <2116>][Edge <1>]
    
    ...
    
    Although this function detects certain errors, it may not catch all the errors that ArcSDE verification does. This is because SDO and ArcSDE operate on a different set of rules.
  • ArcSDE converts and compresses the data before it is sent to the client. This conversion process may correct errors that the Oracle verification process returns. These are usually minor errors that are easily corrected.

    However, the conversion process may create errors if the x,y scale for the layer is set incorrectly. If the scale is set too large, vertices may collapse onto one another. If it is set too small, the boundary for the layer may be smaller than the data envelope. Increasing the x,y scale may correct the problem.
  • In releases prior to ArcSDE 9.1, the checkfeatures utility was installed with ArcSDE to check for errors that ArcSDE cannot correct or that were created in the conversion process. This utility can be run to determine the validity of features. See the Esri Knowledge Base article in the Related Information section of this article for instructions on using this tool.
  • At ArcSDE 9.1 and later releases, the functionality of the checkfeatures utility was moved to the sdelayer –o feature_info command. Run this command to detect errors.

    In the following example, the -r option is used to specify that only invalid geometries be returned.
    sdelayer -o feature_info -l TOT_ERRORS,shape -u user -p password -r invalid
    ArcSDE 9.4 for Oracle11g Build 257 Thu Dec 11 12:00:59 2008
    Layer Administration Utility
    -----------------------------------------------------
    Row Id,FID,Entity Type,Annotation,Cad Data,Number of Points,Number of Parts,Number of Subparts,Self-Touching Rings,Minimum Precision,Verification
    
    152,150,A,F,F,54396,74,178,T,Basic,-151
    672,552,A,F,F,386,0,0,F,Basic,-150
    673,571,A,F,F,166,0,0,F,Basic,-150
    676,664,A,F,F,1128,0,0,F,Basic,-150
    664,669,A,F,F,35,0,0,F,Basic,-150
    665,670,A,F,F,363,0,0,F,Basic,-150
    666,671,A,F,F,426,0,0,F,Basic,-155
    667,672,A,F,F,11,0,0,F,Basic,-150
    669,674,A,F,F,346,0,0,F,Basic,-150
    
    Total rows examined: 490
    Total invalid shapes: 9
    
    If the server encounters a problem part way through evaluating the shape when sdelayer -o feature_info is run against a layer, only the first part of the shape is returned. This can change the error message that the client, feature_info in this case, actually generates. To get an accurate error message, run sdelayer –o list on any invalid geometry detected by the feature_info operation.

    In the following example, the sdelayer -o list command is run against the invalid geometry returned by sdelayer -o feature_info that had an FID of 672.
     
    sdelayer -o list -l TOT_ERRORS,shape -u user -p password -v 672
    ArcSDE 9.4 for Oracle11g Build 257 Thu Dec 11 12:00:59 2008
    Layer Administration Utility
    -----------------------------------------------------
    Error: A polygon outer shell does not completely enclose all donuts for the part (-151).
    Error: Cannot fetch row for layer 
    The list operation retrieves the entire shape from the server and processes it on the client side. As shown in the previous example, using the list operation brought back a different error message (-151) than the feature_info operation did (-150). This is due to the fact that the feature_info operation stopped processing as soon as a problem with the geometry was encountered; whereas, the list operation retrieved the entire geometry.

    The sdelayer -o list command has to be run on one feature in a layer at a time, so validating large layers using this method takes considerably more time than using the feature_info method. The list operation retrieves one shape at a time and displays all of that shape's vertices if the shape is valid. If the shape is invalid, the layer operation returns an accurate error.

    Beginning with ArcGIS 10.1, the sdelayer command can be installed with the ArcSDE Administration Command installation or the ArcSDE Application Server for Oracle installation.
  • Prior to ArcSDE 9.1, all SDO_Geometry objects read by ArcSDE were sent through a verification and correction process. This process could correct more of the simpler errors that can be found in geometry objects than the conversion process alone.
    Note:
    This process had a negative effect on performance. Therefore, beginning with release 9.1, ArcSDE no longer validates and corrects SDO_Geometry shapes when they are read from the database. This means that ArcSDE is assuming that all geometries are valid, and it immediately attempts to convert the shapes to an internal format (SE_SHAPE_RECORD). If an invalid geometry is encountered, the conversion may fail and the current operation stops.
  • At ArcSDE 9.2, a new flag was added to layers to indicate whether the layer was created using ArcSDE or registered to ArcSDE using the sdelayer –o register command. This flag is added automatically by ArcSDE.

    If the layer was created using ArcSDE, the features are assumed to be valid since ArcSDE does not allow the creation of invalid geometries. Therefore, to help performance, layers that are flagged as having been created using ArcSDE are not verified and corrected before they are converted.

    If the layer was created outside of ArcSDE then registered to ArcSDE, the features are verified and corrected before they are converted since there is the possibility that layers created outside of ArcSDE can contain invalid geometries.
  • Starting with ArcSDE 9.3, if an invalid geometry is encountered when the client requests a shape, the layer name and ObjectID of the first invalid geometry are logged in the ArcSDE log file. Check the log file for the full error message.
    [Tue Jan 06 15:46:54 2009] [59] [DemoPC] load_buffer error -151 on TOT_ERRORS, rowid 672

Related Information