Show Navigation | Hide Navigation
You are here:
Geoprocessing > Automating your work with scripts > Scripting object: Properties and Methods > Properties and Methods

ListFeatureClasses method

Release 9.3
Last modified January 19, 2010
E-mail This Topic Printable Version Give Us Feedback

Print all topics in : "Properties and Methods"


Related Topics

Note: This topic was updated for 9.3.1.

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

Returns a Python List that will contain the names of the feature classes under the location specified by the workspace environment setting

NOTE: The content below describes the use of ListFeatureClasses using a 9.3-version geoprocessor. When using a 9.2-version geoprocessor, ListFeatureClasses returns an enumeration instead of a Python List. For more information, see Differences between geoprocessor versions.



Syntax


object.ListFeatureClasses({wildCard} As String, {FeatureType} As String) As Python List

{} = optional

Part Description
object The instantiated geoprocessing object.
wild card Optional. Combination of * and characters that helps to limit the results. The asterisk is the same as saying ALL. If no wildcard is specified, all feature classes in the workspace will be returned.
FeatureType Optional. Feature type keyword that limits the returned feature classes. Valid feature types for this method are

  • ANNOTATION—Only annotation feature classes will be returned.
  • ARC—Only arc (or line) feature classes will be returned.
  • DIMENSION—Only dimension feature classes will be returned.
  • LABEL—Only label feature classes will be returned.
  • LINE—Only line (or arc) feature classes will be returned.
  • NODE—Only node feature classes will be returned.
  • POINT—Only point feature classes will be returned.
  • POLYGON—Only polygon feature classes will be returned.
  • REGION—Only region feature classes will be returned.
  • ROUTE—Only route feature classes will be returned.
  • TIC—Only tic 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 arcgisscripting
import os
gp = arcgisscripting.create(9.3)

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

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

for fc in fcs:
    # 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)



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