I understand that the standard validation/repair tools are not for use with ArcSDE and that ESRI needs to fix this, but are there work-arounds for at least checking where there might be empty geometry in a feature using ArcObjects or a script? Anything really. I'm attempting to export features from layers in an ArcSDE instance but some of those layers in the database give the "Attempted an operation on empty geometry" error when attempting to extract. I'm running ArcMap 10.3
ArcGIS does not include tools to detect corrupt geometries because it is not possible to create them (short of hacking the SDE metadata tables). Native SQL types can create corrupt geometries, if ArcGIS is not used in the pipeline, but then there are native tools to detect and repair or delete those same corrupt geometries, so no Esri tools are needed.
A definition or selection query of
SHAPE IS NULL or
SHAPE IS NOT NULL is the simple solution for identifying NULL or not-NULL features (this will work for all storage types). This is not an error condition, just a natural database state, for which repair tools are not necessary.
Detecting NIL shapes (not-NULL shapes with zero vertices) is a different problem, easily detected with SQL queries by storage type (e.g.,
WHERE sde.ST_NumPoints(shape) = 0). NIL shapes are also not invalid, since they can only be populated if the database layer permits them (the "n" in "npc", "npc+", "nslc+", and "nac+" entity flags layer properties). Any supported mechanism to remove NILs from a layer would also first delete the NILs in the layer.
The most common way to generate invalid geometries is by using inappropriate on-the-fly projection parameters, which result in horizon clipping or vertex sequences beyond the coordinate reference precision. These objects are not technically in the data table, and therefore do not need detection/removal tools either.
It is far more likely that there is an error in your procedure that is producing corrupt output than that filesystem corruption has occurred only to the degree to cause subtle errors in a few disparate byte sequences which will still pass internal validation checks (and if this has occurred, you should immediately buy a lottery ticket, since normal rules of causality do not apply).
Assuming that you are running ArcSDE with ST_GEOMETRY as your storage type, you can use the ST_IsEmpty function to check for empty geometries. You can do this within a definition query applied to your layer like this :
objectid IN (SELECT objectid FROM your_table WHERE sde.st_isempty(shape) = 1)
Adjust accordingly as per your unique id column, table name and database backend (the example above applies to Oracle). Also be careful if you are running the query on a versioned table. You should run the query against a (multi)versioned view if that is the case.