Extract Data By Feature (Topographic Production)

Synthèse

Extracts features from multiple input feature classes into a target database.

This tool can extract all features, only the schema, or features that match filter criteria. Features can be filtered based on a polygon feature. The Target Geodatabase parameter can be a database containing input schema, or it can be an empty database in which the tool will create a schema that matches the input dataset.

Utilisation

  • Input Datasets can include points, polylines, polygons, and annotation features.

  • If the input features include a topology, features are extracted from all the layers that participate in that topology. This may be in addition to the layers specified in the Input Datasets parameter.

  • The extracted data will use the same names as the data provided for the Input Datasets parameter.

  • All Input Datasets parameter values must originate from the same workspace. For example, if extracted data originates from a feature dataset, the tool will create a feature dataset of the same name in the target geodatabase.

  • The target geodatabase must exist before you run this tool.

  • The Re-use Schema parameter is enabled for file geodatabases only.

  • The Filter Feature Layer parameter requires that one feature is selected.

  • The selected feature in the Filter Feature Layer parameter must be a polygon. If it is not, the tool will return an error.

  • If the target geodatabase is a Microsoft SQL Server Express database and some of the input datasets are open in ArcGIS Pro, the extraction may fail due to schema locks.

  • If a replica with the same name exists in either the source or target geodatabase, the operation will fail and the tool will return an error.

  • If you are creating a checkout replica, the input datasets must be registered as versioned.

  • Web feature services are not supported for extraction at this time.

  • Enterprise databases are not supported as a Target Geodatabase value at this time.

  • Related data is extracted by default. To avoid extracting related data, you must specify each relationship class that defines the related objects you want to exclude using the Excluded Relationship Classes parameter.

  • Related data is extracted in a forward direction, from origin to destination.

  • The Expression parameter will be applied to all Input Datasets values and the fields used in the SQL expression must exist in all tables. If they don't, the tool will fail and report the name of the tables that don't satisfy the expression. This also applies to feature layers with invalid definition queries.

  • The SQL query build drop-down options in the Expression parameter will contain a list of the fields that are shared by all of the Input Datasets feature classes and tables.

Paramètres

ÉtiquetteExplicationType de données
Input Datasets

A value table of rows that contain a dataset to extract and a filter option for that dataset. Specifying a filter option allows you to control how rows are replicated in each dataset. The following are filter options:

  • Dataset—The schema of the dataset will be extracted to the child workspace
  • Rows Option—Specifies whether all rows, only the schema, or features that match filter criteria will be extracted.
    • All Rows—All rows of the dataset will be extracted to the child workspace.
    • Schema Only—Only the schema of the dataset will be extracted to the child workspace.
    • Use Filters—If a feature layer is specified for the Filter Feature Layer parameter, features that either intersect or are contained by features in the Filter Feature Layer parameter will be extracted.
Value Table
Target Geodatabase

The workspace into which data will be extracted.

Workspace; GeoDataServer
Re-use Schema
(Facultatif)

Specifies whether a geodatabase that contains the schema of the data to extract will be reused. This reduces the amount of time required to extract the data. This option is only supported for file geodatabases.

  • Checked—The schema will be reused.
  • Unchecked—The schema will not be reused. This is the default.
Boolean
Filter Feature Layer
(Facultatif)

A feature layer with one selected feature used to limit the extent of the data that will be extracted.

Layer
Filter Spatial Relation
(Facultatif)

Specifies the spatial relationship between the Filter Feature Layer and Input Datasets parameter values and how that relationship will be filtered. The spatial relationship is applied to data in an extent defined by the area of interest (AOI) specified in the Filter Feature Layer parameter.

  • IntersectsFeatures in the Input Datasets parameter that intersect features in the Filter Feature Layer parameter will be extracted.
  • ContainsFeatures in the Input Datasets parameter that are contained by the selected feature in the Filter Feature Layer parameter will be extracted.
  • ClipFeatures in the Input Datasets parameter that intersect features in the Filter Feature Layer parameter will be extracted, and the features will be split at the AOI boundary and only those within the AOI will be kept.
String
Checkout replica
(Facultatif)

Specifies whether the data will be checked out, replicated, edited, and checked back in one time.

  • Checked—The replica will be checked out.
  • Unchecked—The replica will not be checked out. This is the default.
Boolean
Replica Name
(Facultatif)

The name of the replica to check out.

String
Expand Feature Classes and Tables
(Facultatif)

Specifies whether expanded feature classes and tables—such as those in networks, topologies, or relationship classes—will be added.

  • Use defaultsThe expanded feature classes and tables related to the feature classes and tables in the replica will be added. The default for feature classes is to replicate all features intersecting the spatial filter. If no spatial filter has been provided, all features are included. The default for tables is to replicate only the schema.
  • Add with schema onlyOnly the schema for the expanded feature classes and tables will be added.
  • All rowsAll rows for expanded feature classes and tables will be added.
  • Do not addNo expanded feature classes and tables will be added. This is the default.
String
Replicate Related Data
(Facultatif)

Specifies whether rows related to existing rows in the replica will be replicated. For example, consider a feature (f1) inside the replication filter and a related feature (f2) from another class outside the filter. Feature f2 is included in the replica if you choose to replicate related data.

  • Checked—Related data will be replicated.
  • Unchecked—Related data will not be replicated. This is the default.
Boolean
Excluded Relationship Classes
(Facultatif)

The relationship classes with the relationships to exclude from extraction. The relationship classes will still be included if both datasets that participate are present but the related objects are not extracted.

Relationship Class
Expression
(Facultatif)

An SQL expression that is used to further refine results from the AOI extraction.

SQL Expression

Sortie obtenue

ÉtiquetteExplicationType de données
Updated Target Geodatabase

The updated target geodatabase.

Workspace; GeoDataServer

arcpy.topographic.ExtractDataByFeature(in_datasets, target_gdb, {reuse_schema}, {filter_feature}, {filter_type}, {checkout_replica}, {replica_name}, {expand_feature_classes_and_tables}, {get_related_data}, {excluded_rel_classes}, {where_clause})
NomExplicationType de données
in_datasets
[[Dataset, Rows Option],...]

A value table of rows that contain a dataset to extract and a filter option for that dataset. Specifying a filter option allows you to control how rows are replicated in each dataset. The following are filter options:

  • Dataset—The schema of the dataset will be extracted to the child workspace
  • Rows Option—Specifies whether all rows, only the schema, or features that match filter criteria will be extracted.
    • All Rows—All rows of the dataset will be extracted to the child workspace.
    • Schema Only—Only the schema of the dataset will be extracted to the child workspace.
    • Use Filters—If a feature layer is specified for the Filter Feature Layer parameter, features that either intersect or are contained by features in the Filter Feature Layer parameter will be extracted.
Value Table
target_gdb

The workspace into which data will be extracted.

Workspace; GeoDataServer
reuse_schema
(Facultatif)

Specifies whether a geodatabase that contains the schema of the data to extract will be reused. This reduces the amount of time required to extract the data. This option is only supported for file geodatabases.

  • REUSEThe schema will be reused.
  • DO_NOT_REUSEThe schema will not be reused. This is the default.
Boolean
filter_feature
(Facultatif)

A feature layer with one selected feature used to limit the extent of the data that will be extracted.

Layer
filter_type
(Facultatif)

Specifies the spatial relationship between the Filter Feature Layer and Input Datasets parameter values and how that relationship will be filtered. The spatial relationship is applied to data in an extent defined by the area of interest (AOI) specified in the Filter Feature Layer parameter.

  • INTERSECTSFeatures in the Input Datasets parameter that intersect features in the Filter Feature Layer parameter will be extracted.
  • CONTAINSFeatures in the Input Datasets parameter that are contained by the selected feature in the Filter Feature Layer parameter will be extracted.
  • CLIPFeatures in the Input Datasets parameter that intersect features in the Filter Feature Layer parameter will be extracted, and the features will be split at the AOI boundary and only those within the AOI will be kept.
String
checkout_replica
(Facultatif)

Specifies whether the data will be checked out, replicated, edited, and checked back in one time.

  • CHECKOUT_REPLICAThe replica will be checked out.
  • DO_NOT_CHECKOUT_REPLICAThe replica will not be checked out. This is the default.
Boolean
replica_name
(Facultatif)

The name of the replica to check out.

String
expand_feature_classes_and_tables
(Facultatif)

Specifies whether expanded feature classes and tables—such as those in networks, topologies, or relationship classes—will be added.

  • USE_DEFAULTSThe expanded feature classes and tables related to the feature classes and tables in the replica will be added. The default for feature classes is to replicate all features intersecting the spatial filter. If no spatial filter has been provided, all features are included. The default for tables is to replicate only the schema.
  • ADD_WITH_SCHEMA_ONLYOnly the schema for the expanded feature classes and tables will be added.
  • ALL_ROWSAll rows for expanded feature classes and tables will be added.
  • DO_NOT_ADDNo expanded feature classes and tables will be added. This is the default.
String
get_related_data
(Facultatif)

Specifies whether rows related to existing rows in the replica will be replicated. For example, consider a feature (f1) inside the replication filter and a related feature (f2) from another class outside the filter. Feature f2 is included in the replica if you choose to get related data.

  • DO_NOT_GET_RELATEDRelated data will not be replicated. This is the default.
  • GET_RELATEDRelated data will be replicated.
Boolean
excluded_rel_classes
[excluded_rel_classes,...]
(Facultatif)

The relationship classes with the relationships to exclude from extraction. The relationship classes will still be included if both datasets that participate are present but the related objects are not extracted.

Relationship Class
where_clause
(Facultatif)

An SQL expression that is used to further refine results from the AOI extraction.

SQL Expression

Sortie obtenue

NomExplicationType de données
updated_target_gdb

The updated target geodatabase.

Workspace; GeoDataServer

Exemple de code

ExtractDataByFeature example (stand-alone script)

The following stand-alone script demonstrates how to use the ExtractDataByFeature function to extract features from an input feature class into a target file geodatabase.

# Name: ExtractDataByFeature_sample.py
# Description: Extracts features from an input feature class into a target file geodatabase.

# Import System Modules
import arcpy

# Check Out Extensions
arcpy.CheckOutExtension('Foundation')

# Making AOI Feature Layer
Index = r'C:\Data\ReferenceData\MapIndex.gdb\MapIndex\TM50_Index'
arcpy.management.MakeFeatureLayer(Index, "TM50_Index")

# Selecting a single AOI from the AOI feature layer
selection_string = "NRN = 'V795X16573'"
arcpy.management.SelectLayerByAttribute("TM50_Index", "NEW_SELECTION", selection_string)

# Setting Local Variables
in_datasets = r'C:\Data\TDS_7.gdb\TDS\StructurePnt'
target_gdb = r'C:\Data\ExtractTest.gdb'
reuse_schema = "DO_NOT_REUSE"
filter_feature = "TM50_Index"
filter_type = "CONTAINS"
checkout_replica = "DO_NOT_CHECKOUT_REPLICA"
replica_name = ''
expand_feature_classes_and_tables = 'DO_NOT_ADD'
get_related_data = 'DO_NOT_GET_RELATED'
excluded_rel_classes = None
where_clause = ''

# Calling the Extract Data By Feature tool to extract Structure Point features to a target file geodatabase
arcpy.topographic.ExtractDataByFeature(in_datasets, target_gdb, reuse_schema, filter_feature, filter_type, checkout_replica, replica_name, expand_feature_classes_and_tables, get_related_data, excluded_rel_classes, where_clause)

# Getting all messages, warnings, and errors from the tool run and printing the results back to the user
messages = arcpy.GetMessages(0)
warnings = arcpy.GetMessages(1)
errors = arcpy.GetMessages(2)
arcpy.AddMessage('Tool Messages: {}\nTool Warnings: {}\nTool Errors{}\n'.format(messages, warnings, errors))

# Check In Extensions
arcpy.CheckInExtension('Foundation')

Environnements

Cet outil n’utilise pas d’environnement de géotraitement.

Informations de licence

  • Basic: Non
  • Standard: Nécessite Production Mapping
  • Advanced: Nécessite Production Mapping

Rubriques connexes