Skip To Content

Extract Data By Feature (Topographic Production)

Zusammenfassung

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

This tool can extract all features, the schema only, or features that match a filter. 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.

Verwendung

  • 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 Input Datasets.

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

  • All Input Datasets 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 requires that one feature is selected.

  • The selected feature in the Filter Feature Layer 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 already exists on either the source or target geodatabase, the tool will abort the operation with an error message.

  • 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 at this time.

Syntax

ExtractDataByFeature(in_datasets, target_gdb, {reuse_schema}, {filter_feature}, {filter_type}, {checkout_replica}, {replica_name})
ParameterErklärungDatentyp
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—Extracts the schema of the dataset to the child workspace
  • Rows Option—Specifies whether to extract all rows, schema only, or by filtering criteria.
  • All Rows—Extracts all rows of the dataset to the child workspace.
  • Schema Only—Extracts the schema of the dataset to the child workspace.
  • Use Filters—If a feature layer is specified for the Filter Feature Layer, this tool extracts features that either intersect or are contained by features in the Filter Feature Layer.
Value Table
target_gdb

The workspace into which data will be extracted.

Workspace; GeoDataServer
reuse_schema
(optional)

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

  • REUSEThe schema is reused.
  • DO_NOT_REUSEThe schema is not reused. This is the default.
Boolean
filter_feature
(optional)

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

Feature Layer
filter_type
(optional)

Specifies the spatial relationship between Filter Feature Layer and Input Datasets using Intersects, Contains, or Clip. The spatial relationship is applied to data in an extent defined by the AOI specified in the Filter Feature Layer parameter.

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

Specifies whether the data will be 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
(optional)

The name of the replica to check out.

String

Abgeleitete Ausgabe

NameErklärungDatentyp
updated_target_gdb

The updated target geodatabase.

Workspace; GeoDataServer

Codebeispiel

ExtractDataByFeature example (stand-alone script)

The following stand-alone script demonstrates how to use the ExtractDataByFeature tool 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\TLM50_Index'
arcpy.management.MakeFeatureLayer(Index, "TLM50_Index")

# Selecting a single AOI from the AOI feature layer
selection_string = "NRN = 'V795X16573'"
arcpy.management.SelectLayerByAttribute("TLM50_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 = "TLM50_Index"
filter_type = "CONTAINS"
checkout_replica = "DO_NOT_CHECKOUT_REPLICA"
replica_name = ''

# 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)

# 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')

Umgebungen

Dieses Werkzeug verwendet keine Geoverarbeitungsumgebungen.

Lizenzinformationen

  • Basic: Nein
  • Standard: Erfordert Production Mapping
  • Advanced: Erfordert Production Mapping

Verwandte Themen