Generate Spatial Join Attribute Rule (Data Management)

Summary

Generates a .csv file with an attribute rule for an input based on field values queried from one or more feature classes.

Usage

  • Use the Field Map parameter to manage the fields and their content in the output dataset.

    • Add and remove fields from the fields list, reorder the fields list, and rename fields.
    • The default data type of an output field is the same as the data type of the first input field (of that name) it encounters. You can change the data type to another valid data type.
    • Use an action to determine how the values from one or multiple input fields will be merged into a single output field. The available actions are First, Last, Concatenate, Sum, Mean, Median, Mode, Minimum, Maximum, Standard Deviation, and Count.
    • When using the Concatenate action, you can specify a delimiter such as a comma or other characters. Click the start of the Delimiter text box to add the delimiter characters.
    • Standard Deviation is not a valid option for single input values.
    • Use the Export option Export to save a field map as a .fieldmap file.
    • Use the Load option Import to load a .fieldmap file. The feature layer or dataset specified in the file must match the dataset used in the tool. Otherwise, the Field Map parameter will be reset.
    • Use the Slice Text button Cut on text source fields to choose which characters from an input value will be extracted to the output field. To access the Slice Text button, hover over a text field in the input fields list; then specify the start and end character positions.
    • Fields can also be mapped in Python script.

Parameters

LabelExplanationData Type
Input Table

The feature class from which the attribute rule will be created.

Feature Layer
Output Folder

The folder where the output .csv file will be saved. The name of the file will use the name of the Input Table parameter value.

Folder
Join Classes

The attributes from the join features that will be joined to the attributes of the input features.

Feature Layer
Field Map

Controls the transfer or mapping of fields from the Join Classes parameter values to the Input Table parameter value.

Field Mappings
Expression
(Optional)

An SQL expression that will be used to limit the features from the input that will participate in the attribute rule.

SQL Expression
Search Options
(Optional)

Defines spatial queries between the features from the Input Table and Join Classes parameter values. The geometry type, spatial operator, and spatial distance can be configured to define matches between each join class and the input table.

  • Join Class—The name of the join class the spatial query will run on.
  • Input Geometry Type—The portion of the input geometry that will be used to query the join class.
  • Spatial Operator—The spatial operation that will be used in the query.
  • Search Distance—The distance from the geometry that will be included in the query.

Available input geometry operators are as follows:

  • Geometry—The complete geometry of the input feature. This is default.
  • Start—The first vertex within a polyline feature. This option is only supported for polyline features.
  • End—The last vertex within a polyline feature. This option is only supported for polyline features.
  • Centroid—The geometric center of the input feature.

Available spatial operators are as follows:

  • Intersects—Features in the join class will be matched if they intersect with an input feature. This is default.
  • Crosses—Features in the join class will be matched if they cross with an input feature.
  • Contains—Features in the join class will be matched if an input feature contains them. This is the opposite of the Within option.
  • Envelope_Intersects—Features in the join class will be matched if their bounding boxes (envelopes) intersect with the bounding box of an input feature.
  • Overlaps—Features in the join class will be matched if they overlap with an input feature. The join class features are not completely contained by the input features.
  • Touches—Features in the join class will be matched if they have a boundary that touches an input feature. When the input and join features are polylines or polygons, the boundary of the join feature can only touch the boundary of the input feature and no part of the join feature can cross the boundary of the input feature.
  • Within—Features in the join class will be matched if an input feature is within them. This is the opposite of the Contains option.

Value Table

Derived Output

LabelExplanationData Type
Output Rule CSV File

The folder location and name of the output .csv file.

File

arcpy.management.GenerateSpatialJoinAttributeRule(in_table, out_folder, join_classes, field_map, {where_clause}, {search_options})
NameExplanationData Type
in_table

The feature class from which the attribute rule will be created.

Feature Layer
out_folder

The folder where the output .csv file will be saved. The name of the file will use the name of the in_table parameter value.

Folder
join_classes
[join_classes,...]

The attributes from the join features that will be joined to the attributes of the input features.

Feature Layer
field_map

Controls the transfer or mapping of fields from the join_classes parameter values to the in_table parameter value.

Field Mappings
where_clause
(Optional)

An SQL expression that will be used to limit the features from the input that will participate in the attribute rule.

SQL Expression
search_options
[search_options,...]
(Optional)

Defines spatial queries between the features from the in_table and join_classes parameter values. The geometry type, spatial operator, and spatial distance can be configured to define matches between each join class and the input table.

  • Join Class—The name of the join class the spatial query will run on.
  • Input Geometry Type—The portion of the input geometry that will be used to query the join class.
  • Spatial Operator—The spatial operation that will be used in the query.
  • Search Distance—The distance from the geometry that will be included in the query.

Available input geometry operators are as follows:

  • GEOMETRY—The complete geometry of the input feature. This is default.
  • START—The first vertex within a polyline feature. This option is only supported for polyline features.
  • END—The last vertex within a polyline feature. This option is only supported for polyline features.
  • CENTROID—The geometric center of the input feature.

Available spatial operators are as follows:

  • INTERSECTS—Features in the join class will be matched if they intersect with an input feature. This is default.
  • CROSSES—Features in the join class will be matched if they cross with an input feature.
  • CONTAINS—Features in the join class will be matched if an input feature contains them. This is the opposite of the WITHIN option.
  • ENVELOPE_INTERSECTS—Features in the join class will be matched if their bounding boxes (envelopes) intersect with the bounding box of an input feature.
  • OVERLAPS—Features in the join class will be matched if they overlap with an input feature. The join class features are not completely contained by the input features.
  • TOUCHES—Features in the join class will be matched if they have a boundary that touches an input feature. When the input and join features are polylines or polygons, the boundary of the join feature can only touch the boundary of the input feature and no part of the join feature can cross the boundary of the input feature.
  • WITHIN—Features in the join class will be matched if an input feature is within them. This is the opposite of the CONTAINS option.

Value Table

Derived Output

NameExplanationData Type
out_rule_csv

The folder location and name of the output .csv file.

File

Code sample

GenerateSpatialJoinAttributeRule example (Python window)

The following example demonstrates the use of the GenerateSpatialJoinAttributeRule function between two classes:

import arcpy
arcpy.management.GenerateSpatialJoinAttributeRule( 
    in_table=r"C:\temp\test.gdb\in_featureclass", 
    out_folder=r"C:\temp", 
    join_classes=["layer_one", "layer_two"], 
    where_clause="select * from X" 
)

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: No
  • Standard: Yes
  • Advanced: Yes

Related topics