Show Navigation | Hide Navigation
You are here:
Writing geoprocessing scripts > Scripting Object: Properties and methods > Properties and Methods

ListFeatureClasses method

Release 9.1
Last modified August 19, 2005
E-mail This Topic Printable Version Give Us Feedback

Print all topics in : "Properties and Methods"


Related Topics

Lists all feature classes from the selected workspace. Specifying search conditions (wildcard) and a feature type will limit the results. The workspace must be specified before using any of the List methods, except ListFields and ListIndexes.

Syntax


object.ListFeatureClasses([wildCard], [FeatureType]) as Object

Returns a Dispatch enumeration object that will, in turn, hand out the names of the feature classes located under the location specified by the WORKSPACE environment setting.

Part Description
object The instantiated geoprocessing object
wild card Optional. Combination of * and characters that will help limit the results. The asterisk (*) is the same as saying ALL. If no wildcard is specified then all feature classes in the workspace will be returned.
FeatureType Optional. Keyword FeatureType that will limit the returned feature classes. Valid FeatureTypes for this method are:
  • POINT—Only point feature classes will be returned.
  • LABEL—Only label feature classes will be returned.
  • NODE—Only node feature classes will be returned.
  • LINE—Only line feature classes will be returned.
  • ARC—Only arc feature classes will be returned.
  • ROUTE—Only route feature classes will be returned.
  • POLYGON—Only polygon feature classes will be returned.
  • REGION—Only region feature classes will be returned.


Examples


This script shows how the ListFeatureClasses method can be used to create a list object that contains the names of all the feature classes in a workspace.

import os
from win32com.client import Dispatch
gp = Dispatch("esriGeoprocessing.GpDispatch.1")

gp.workspace = "d:\\MyData"
out_workspace = "d:\\MyData\\Results"
clip_features = "d:\\MyData\\TestArea\\Boundary.shp"

# Get a list of the feature classes in the workspace.
fcs = gp.ListFeatureClasses()

# Loop through the list of feature classes.
fcs.reset()
fc = fcs.next()

while fc:
    # Set the outputname for each output to be the same as the input.
    output = out_workspace + os.sep + fc

    # Clip each input feature class in the list.
    gp.clip_analysis(fc, clip_features, output, 5)
    fc = fcs.next()



Please visit the Feedback page to comment or give suggestions on ArcGIS Desktop Help.
Copyright © Environmental Systems Research Institute, Inc.