Select to view content in your preferred language

List of FCs that meet certain SQL criteria

281
0
11-08-2023 07:02 AM
Bud
by
Honored Contributor

ArcGIS Pro 2.6.8; Oracle 18c; 10.7.1 EGDB; SDE.ST_GEOMETRY


I want to create a list of FCs that meet certain SQL criteria:

  • Loop through all FC in a specific data owner called <MY_USER>.
  • For each FC, run a SQL query:
    select
        *
    from
        --FC name
    where
        (sde.st_isempty(shape) = 1 and sde.st_area(shape) is null)
    and shape is null --It's counterintuitive, but this will actually select some features where shape is not null. The shape data appears to be broken. Explanation below.
  • If the query returns at least one row (or, alternatively, if count(*) >= 1), then print the FC name to a list.

Use case:

I'm troubleshooting an issue with Esri Support in Case #03477586 where some of my features appear to be broken. If I query WHERE SHAPE IS NULL, then the query selects certain features even if though the shape isn't null. Support says BUG-000090937 describes a known issue "...Reproducible at ArcGIS Desktop 10.3.1 where inserting a new record into an attribute table in ArcMap without creating a corresponding shape would result in a NULL Geometry BLOB." As mentioned, those old features seem to be broken when querying WHERE SHAPE IS NULL. Features created in modern versions of ArcMap and ArcGIS Pro don't seem to have this issue. 

Bud_0-1699456843176.png

Action:

I want to create a list of FCs that have broken shapes. I will manually perform a field calculation on the broken shapes; I'll update shape=shape which will fix those shapes. Explanation: Most operations in ArcGIS Pro automatically change/fix features so that they go from "has shape, but geometry is null" to "has shape, but geometry is nill/zero-vertex". More info here: Select features with blank shapes.

Question:

How can I create a list of FCs that meet that SQL criteria using Python?

Thanks.

0 Kudos
0 Replies