Schema
サマリー
The schema of a dataset.
ディスカッション
Every output parameter of type feature class, table, raster, or workspace has a Schema object. Only output feature classes, tables, rasters, and workspaces have a schema—other types do not. The Schema object is created in geoprocessing tool validation. You access this schema through the parameter object and set the rules for describing the output of the tool. After you set the schema rules in validation, the geoprocessing internal validation code examines the rules you set and updates the description of the output.
Learn more about the Schema object
プロパティ
| 名前 | 説明 | データ タイプ |
|---|---|---|
|
additionalChildren (読み取り/書き込み) |
A list of datasets that will be added to a workspace schema. |
String |
|
additionalFields (読み取り/書き込み) |
Additional fields that will be created by the tool. These fields are in addition to those added by the application of the |
Field |
|
cellSize (読み取り/書き込み) |
The cell size of the output. Use this property when the |
Double |
|
cellSizeRule (読み取り/書き込み) |
Specifies the cell size of output rasters or grids.
|
String |
|
clone (読み取り/書き込み) |
Specifies whether an exact copy (clone) of the description in the first dependent parameter will be used. The default value is |
Boolean |
|
extent (読み取り/書き込み) |
The extent that will be used when the |
Extent |
|
extentRule (読み取り/書き込み) |
Specifies how the
|
String |
|
featureType (読み取り/書き込み) |
Specifies the feature type of the output when the
|
String |
|
featureTypeRule (読み取り/書き込み) |
Specifies the feature type of the output feature class. This rule has no effect on output rasters or tables.
|
String |
|
fieldsRule (読み取り/書き込み) |
Specifies the fields that will exist on the output feature class or table.
|
String |
|
geometryType (読み取り/書き込み) |
Specifies the geometry type of the output. The value can be |
String |
|
geometryTypeRule (読み取り/書き込み) |
Specifies the geometry type (such as point or polygon) of the output feature class.
|
String |
|
rasterFormatRule (読み取り/書き込み) |
Specifies the output raster format, either |
String |
|
rasterRule (読み取り/書き込み) |
Specifies the data type that will be contained in the output raster.
|
String |
|
type (読み取り専用) |
Specifies the output schema type: |
String |
コードのサンプル
In a ToolValidator class, set the schema of the output parameter to the first input parameter.
def initializeParameters(self):
# Set the dependencies for the output and its schema properties. The two
# input parameters are feature classes.
self.params[2].parameterDependencies = [0, 1]
# Feature type, geometry type, and fields all come from the first dependency
# (parameter 0), the input features.
self.params[2].schema.featureTypeRule = "FirstDependency"
self.params[2].schema.geometryTypeRule = "FirstDependency"
self.params[2].schema.fieldsRule = "FirstDependency"
# The extent of the output is the intersection of the input features and
# the clip features (parameter 1).
self.params[2].schema.extentRule = "Intersection"
return
Interrogate the schema of a specific tool output parameter using the GetParameterInfo function.
import arcpy
toolname = "Buffer_analysis"
parameter_index = 1
# Get the schema of the tool parameter
schema = arcpy.GetParameterInfo(toolname)[parameter_index].schema
properties = ['additionalChildren', 'additionalFields', 'cellSize',
'cellSizeRule', 'clone', 'extent', 'extentRule',
'featureType', 'featureTypeRule', 'fieldsRule',
'geometryType', 'geometryTypeRule', 'rasterFormatRule',
'rasterRule', 'type']
# Walk through all schema properties and print the value
for prop in properties:
try:
val = eval("schema." + prop)
print("{:<18} : {}".format(prop, val))
except (NameError, RuntimeError):
# Properties unsupported by the parameter data type will be ignored
pass