11

I have ~30 feature datasets and ~100 feature classes spread throughout the feature datasets. I would like to search for a feature class by name among the feature datasets. Also, I would like to query out of all the feature classes those records that have "Date_Mod" from someDate to someOtherDate.

This is all in ArcGIS SDE 10.0 on sql server 2008.

3 Answers 3

10

As for me I would recommend choosing python scripting for this task (arcpy).

Here are some ideas:

  1. Use ListDatasets for getting all datasets.
  2. Use ListFeatureClasses for getting all featureclasses.
  3. Use SearchCursor for querying data.
  4. Take a look at Describe function - it also can be very usefull for some tasks.

UPDATE:

Have found after posting: @Aragon has described in detail how to perform step 3.

1
  • I have created a python script outputting something similar with the 4 items listed, so I can vouch for the fact that this is do-able. First, decide exactly what you want your output to be. In your script, create the output table first. Then, you start at the workspace level and conduct a series of describes and lists, collecting your data along the way. You'll need to add ListFields and collect the min and max values out of the date columns. Your exact algorithm will depend on the format of your output & location of input feature datasets (do they all originate in one common workspace?).
    – RHB
    Feb 26, 2016 at 17:36
6

you can check out SearchCursor method here. only one thing is that build an SQL expression instead of where_clause. Query expressions is the same as standard SQL expressions in ArcGIS too. it is similar to Select By Attributes dialog box. you can write your own tool by looking at the following code

Summary

The SearchCursor function establishes a read-only cursor on a feature class or table. The SearchCursor can be used to iterate through row objects and extract field values. The search can optionally be limited by a where clause or by field, and optionally sorted.

Syntax SearchCursor (dataset, {where_clause}, {spatial_reference}, {fields}, {sort_fields})

Example:

import arcpy

# Open a searchcursor 
#  Input: C:/Data/Counties.shp 
#  FieldList: NAME; STATE_NAME; POP2000 
#  SortFields: STATE_NAME A; POP2000 D 
# 
rows = arcpy.SearchCursor("C:/Data/Counties.shp", "'POP2000' > 5000", "", "NAME; 
STATE_NAME; POP2000", "STATE_NAME A; POP2000 D") 
currentState = "" 

# Iterate through the rows in the cursor 
# 
for row in rows: 
    if currentState != row.STATE_NAME: 
        currentState = row.STATE_NAME 

    # Print out the state name, county, and population 
    # 
    print "State: %s, County: %s, population: %i" % \
            (row.STATE_NAME, row.NAME, row.POP2000) 

i hope it helps you....

3

You can also enable the arcmap search indexing (note performance hit).
The usability for me is begining to outweigh the performance loss.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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