ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Select

  • Summary
  • Usage
  • Syntax
  • Code Sample
  • Environments
  • Licensing Information

Summary

Extracts features from an input feature class or input feature layer, typically using a select or Structured Query Language (SQL) expression and stores them in an output feature class.

Usage

  • The select or SQL expression gets built with the Query Builder, or is simply typed in. For details on the expression syntax see Building an SQL Expression or SQL Reference.

  • If a layer is used for Input Features and no expression is entered, only the selected features are written to the output feature class. If a layer is used for Input Features and an expression is entered, the expression is only executed against the selected features, and the expression-based subset of the selected set is written to the output feature class.

  • If you want to create a feature class from the selected set of features in a layer, use the Copy_Features tool.

Syntax

Select_analysis (in_features, out_feature_class, {where_clause})
ParameterExplanationData Type
in_features

The input feature class or layer from which features are selected.

Feature Layer
out_feature_class

The output feature class to be created. If no expression is used, it contains all input features.

Feature Class
where_clause
(Optional)

An SQL expression used to select a subset of features. For more information on SQL syntax see the help topic SQL reference for query expressions used in ArcGIS.

SQL Expression

Code Sample

Select Example (Python Window)
import arcpy
from arcpy import env

env.workspace = "c:/basedata/roads.gdb"
arcpy.Select_analysis("nfroads", "paved", '[ROAD_CLASS] = "PAVED"')
Select Example (Python Window)

The following Python Window script demonstrates how to use the Select function in immediate mode.

import arcpy
from arcpy import env

env.workspace = "C:/data"
arcpy.Select_analysis("majorrds.shp", "C:/output/majorrdsClass4.shp", '"CLASS" = \'4\'')
Select Example 2 (stand-alone Python Script)

The following Python script demonstrates how to use the Select function in a stand-alone script.

# Name: Select_Example2.py
# Description: Select roads of Class 4 from major roads tin the gnatcatcher habitat study area

# Import system modules
import arcpy
from arcpy import env

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

# Set local variables
in_features = "majorrds.shp"
out_feature_class = "C:/output/majorrdsClass4.shp"
where_clause = '"CLASS" = \'4\''

# Execute Select
arcpy.Select_analysis(in_features, out_feature_class, where_clause)

Environments

  • Default Output Z Value
  • M Resolution
  • M Tolerance
  • Output CONFIG Keyword
  • Output M Domain
  • Output XY Domain
  • Output Coordinate System
  • Extent
  • Output has M values
  • Output Spatial Grid 1
  • Output Spatial Grid 2
  • Output Spatial Grid 3
  • XY Resolution
  • XY Tolerance

Licensing Information

  • ArcGIS for Desktop Basic: Yes
  • ArcGIS for Desktop Standard: Yes
  • ArcGIS for Desktop Advanced: Yes

Related Topics

  • An overview of the Extract toolset
Feedback on this topic?

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal