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

  • 3
    I suspect you are misidentifying the problem in this situation. Please edit the question to describe the environment and behavior more completely (which version of ArcGIS, what type of geometry storage, the coordinate system and coordinate reference values for the input and output layers, what exact command is being used to perform the export), so that the actual problem can be identified and a solution offered. – Vince May 27 '15 at 16:31
  • 1
    I think Vince may be correct. As are you, in that geometry repair cannot be run on sde data. However I think the empty geometry is more of a selection problem. If you are exporting from a csv, I have fixed this problem by selecting all of the rows (that have values) and then exporting. – Brad Nesom May 27 '15 at 19:06

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).

  • 2
    It is possible to create null geometry in sde. start an edit session. Open attribute table. Go to the bottom of the table and click on the next available record. Type anything in one field. Hit enter. Stop editing. Another thing that happens is I see my editors using copy paste multiple times quickly. If you get out of step it automatically jumps to the bottom. paste and hit enter and now you have a null geometry. – Brad Nesom Jul 14 '15 at 22:12

Here is my solution...

open in arcmap the suspect layer.
zoom to the entire dataset.
make it the only selectable layer (if there is more than one)
start editing
make a selection box around all of the features
switch the selection
you now have all the <NULL> geometry rows in the sde table.

  • This is a great suggestion, but I tried it and there were no other features selected after I switched the selection. The table has only five features and all 5 features were returned in the selection. Once the selection was switched, no other features were selected. – TacoB0t May 27 '15 at 19:59
  • see my comment above. I do not think your problem is related to the null geometry. rather no geometry. Mark this as answered and start a new question with more info (as requested by Vince) referring to the empty geometry, export format, software ver, origin data format. – Brad Nesom May 27 '15 at 20:39

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.