AnsweredAssumed Answered

newbie question about feature layer in Python

Question asked by dschatt on Mar 27, 2015
Latest reply on Mar 30, 2015 by dschatt

hi all, I'm confused about something.   I just took an ESRI Python course that points out the distinction between feature classes and feature layers, and that some tools require the use of feature layers.  Now I need to clip one polygon feature class to another and the Clip analysis tool seems to be what I need.  The documentation for this tool says that both the "in_features" and the "clip_features" need to be Feature Layers as opposed to Feature Classes.  But in their Clip sample code, they just use shapefiles as is within the tool parameters (code below).

My question is: Why do they NOT need to use the MakeFeatureLayer tool on the in_features and clip_features shapefiles to make Feature Layers for use in the tool?  Thanks!

Dan

 

# Name: Clip_Example2.py
# Description: Clip major roads that fall within the study area.

# Import system modules
import arcpy
from arcpy import env

# Set workspace
env.workspace = "C:/data"

# Set local variables
in_features = "majorrds.shp"
clip_features = "study_quads.shp"
out_feature_class = "C:/output/studyarea.shp"
xy_tolerance = ""

# Execute Clip
arcpy.Clip_analysis(in_features, clip_features, out_feature_class, xy_tolerance)

Outcomes