Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Isolating features, who have no matching row in a table

$
0
0
I’ve been working with this for a while, but I feel like I must have hit a wall…
  • Everything is contained in one file geodatabase.
  • The point featureclass contains approximately 65000 features.
  • The table contains approximately 65000 rows.
  • The featureclass and the table have a key field that links them together.
My goal is to isolate those features, who have no matching row in the table and copy those features to a new featureclass.
To achieve this I’ve adopted the following approach:
  1. Use MakeFeatureLayer_management to create a layer from the point featureclass.
  2. Use AddJoin_management to join the table to the featureclass using the "KEEP_ALL" option
  3. Use MakeFeatureLayer_management to create another layer, with a where clause that selects only features where the joined key field is null.
  4. Open a search cursor on the feature layer from 3 and insert those features in a new featureclass.
This does NOT work. The feature layer defined in step 3 always contains no features.
To validate my approach, I tried doing the same thing in ArcMap. This did not work either.
To investigate further, I copied the featureclass and table to a personal geodatabase and tried again from ArcMap. 51 features were – as expected – selected.

How can this be done in a file geodatabase?
Is this the best way to isolate features, who have no matching row in the table and copy those features to a new featureclass?

Viewing all articles
Browse latest Browse all 2485

Trending Articles