Accessing data sources in Python

Geoprocessing tools and other ArcPy functionality usually have input parameters that define the dataset or datasets that are typically used to generate new output data.

Input data is frequently accessed through a data path. If the input is a file type, such as a text file, the path is the same as that in File Explorer (Windows Explorer). A catalog path is a path that only ArcGIS recognizes, for example, a feature class in a file geodatabase. The D:\Data\Final\Infrastructure.gdb\EastValley\powerlines path refers to the powerlines feature class in the EastValley feature dataset in the Infrastructure file geodatabase. This is not a valid system path for the Windows operating system, because the Infrastructure.gdb folder does not contain a folder named EastValley, nor a file named powerlines.

Feature services

When using ArcPy to access web feature layers, you can open individual layers and tables by providing the URL to the feature service sublayer referenced by the layer. To access the workspace for the web feature layer, provide the URL to the service. This syntax can be used in any tool or function referenced in your scripts.

Sublayer example
import arcpy
layer_name = "Permits"
featureLayer = arcpy.MakeFeatureLayer_management("", 
Workspace example
import arcpy
arcpy.env.workspace = ""
featureClasses = arcpy.ListFeatureClasses()

Dans cette rubrique
  1. Feature services