com.esri.arcgis.geoprocessing.tools.analysistools
Class SpatialJoin
java.lang.Object
com.esri.arcgis.geoprocessing.AbstractGPTool
com.esri.arcgis.geoprocessing.tools.analysistools.SpatialJoin
- All Implemented Interfaces:
- GPTool
public class SpatialJoin
- extends AbstractGPTool
Transfers the attributes from one feature class to another feature class, based on the spatial relationships between the features in the two feature classes.
The Spatial Join tool is contained in the Analysis Tools tool box.
Usage tips:
- This tool is used to transfer attribute fields between feature classes. The attributes from the Join Features are added to the Target Features whenever a specified spatial relationship (or Match Option) is found. For example, if a point feature class is specified for the Target Features, and a polygon feature class is specified for the Join Features, with a Match Option of IS_WITHIN, each output point feature will have, in addition to its own original attributes, the attributes of the polygon that it is within.
- By default, all input Target Features will be maintained in the output feature class, even if no spatial relationships were found between the Join Features and a target feature. This is considered an outer join. If the output feature class should only contain Target Features that have a spatial relationship with one or more Join Features (an inner join), set the Keep All Target Features parameter to KEEP_COMMON (unchecked).
- Merge rules in the Field Map of Join Features parameter only apply to fields from the Join Features and only when a Join Operation of JOIN_ONE_TO_ONE is used. The merge rule is ignored when applied to fields from the Target Features or when the Join Operation is JOIN_ONE_TO_MANY.
- A new field named Join_Count is always added to the output feature class. This field indicates how many Join Features were joined to each input Target Feature.
Constructor Summary |
SpatialJoin()
Creates the Spatial Join tool with defaults. |
SpatialJoin(java.lang.Object targetFeatures,
java.lang.Object joinFeatures,
java.lang.Object outFeatureClass)
Creates the Spatial Join tool with the required parameters. |
Method Summary |
java.lang.String |
getDistanceFieldName()
Returns the Distance Field Name parameter of this tool . |
java.lang.Object |
getFieldMapping()
Returns the Field Map of Join Features parameter of this tool . |
java.lang.Object |
getJoinFeatures()
Returns the Join Features parameter of this tool . |
java.lang.String |
getJoinOperation()
Returns the Join Operation parameter of this tool . |
java.lang.String |
getJoinType()
Returns the Keep All Target Features parameter of this tool . |
java.lang.String |
getMatchOption()
Returns the Match Option parameter of this tool . |
java.lang.Object |
getOutFeatureClass()
Returns the Output Feature Class parameter of this tool . |
java.lang.Object |
getSearchRadius()
Returns the Search Radius parameter of this tool . |
java.lang.Object |
getTargetFeatures()
Returns the Target Features parameter of this tool . |
java.lang.String |
getToolboxAlias()
Returns the alias of the tool box containing this tool. |
java.lang.String |
getToolboxName()
Returns the name of the tool box containing this tool. |
java.lang.String |
getToolName()
Returns the name of this tool. |
void |
setDistanceFieldName(java.lang.String distanceFieldName)
Sets the Distance Field Name parameter of this tool . |
void |
setFieldMapping(java.lang.Object fieldMapping)
Sets the Field Map of Join Features parameter of this tool . |
void |
setJoinFeatures(java.lang.Object joinFeatures)
Sets the Join Features parameter of this tool . |
void |
setJoinOperation(java.lang.String joinOperation)
Sets the Join Operation parameter of this tool . |
void |
setJoinType(java.lang.String joinType)
Sets the Keep All Target Features parameter of this tool . |
void |
setMatchOption(java.lang.String matchOption)
Sets the Match Option parameter of this tool . |
void |
setOutFeatureClass(java.lang.Object outFeatureClass)
Sets the Output Feature Class parameter of this tool . |
void |
setSearchRadius(java.lang.Object searchRadius)
Sets the Search Radius parameter of this tool . |
void |
setTargetFeatures(java.lang.Object targetFeatures)
Sets the Target Features parameter of this tool . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
SpatialJoin
public SpatialJoin()
- Creates the Spatial Join tool with defaults.
Initializes the array of tool parameters with the default values specified when the tool was created.
SpatialJoin
public SpatialJoin(java.lang.Object targetFeatures,
java.lang.Object joinFeatures,
java.lang.Object outFeatureClass)
- Creates the Spatial Join tool with the required parameters.
Initializes the array of tool parameters with the values as specified for the required parameters and with the default values for the other parameters.
- Parameters:
targetFeatures
- the attributes from the Join Features are transferred to the Target Features whenever a specified spatial relationship (or Match Option) is found. The Target Features can be any spatial data source supported by ArcGIS.joinFeatures
- the attributes from the Join Features are transferred to the Target Features whenever a specified spatial relationship (or Match Option) is found. The Join Features can be any spatial data source supported by ArcGIS.outFeatureClass
- a new feature class containing the attributes of the Join Features joined to the Target Features.
getTargetFeatures
public java.lang.Object getTargetFeatures()
- Returns the Target Features parameter of this tool .
This parameter is the attributes from the Join Features are transferred to the Target Features whenever a specified spatial relationship (or Match Option) is found. The Target Features can be any spatial data source supported by ArcGIS.
This is a required parameter.
- Returns:
- the Target Features
setTargetFeatures
public void setTargetFeatures(java.lang.Object targetFeatures)
- Sets the Target Features parameter of this tool .
This parameter is the attributes from the Join Features are transferred to the Target Features whenever a specified spatial relationship (or Match Option) is found. The Target Features can be any spatial data source supported by ArcGIS.
This is a required parameter.
- Parameters:
targetFeatures
- the attributes from the Join Features are transferred to the Target Features whenever a specified spatial relationship (or Match Option) is found. The Target Features can be any spatial data source supported by ArcGIS.
getJoinFeatures
public java.lang.Object getJoinFeatures()
- Returns the Join Features parameter of this tool .
This parameter is the attributes from the Join Features are transferred to the Target Features whenever a specified spatial relationship (or Match Option) is found. The Join Features can be any spatial data source supported by ArcGIS.
This is a required parameter.
- Returns:
- the Join Features
setJoinFeatures
public void setJoinFeatures(java.lang.Object joinFeatures)
- Sets the Join Features parameter of this tool .
This parameter is the attributes from the Join Features are transferred to the Target Features whenever a specified spatial relationship (or Match Option) is found. The Join Features can be any spatial data source supported by ArcGIS.
This is a required parameter.
- Parameters:
joinFeatures
- the attributes from the Join Features are transferred to the Target Features whenever a specified spatial relationship (or Match Option) is found. The Join Features can be any spatial data source supported by ArcGIS.
getOutFeatureClass
public java.lang.Object getOutFeatureClass()
- Returns the Output Feature Class parameter of this tool .
This parameter is a new feature class containing the attributes of the Join Features joined to the Target Features.
This is a required parameter.
- Returns:
- the Output Feature Class
setOutFeatureClass
public void setOutFeatureClass(java.lang.Object outFeatureClass)
- Sets the Output Feature Class parameter of this tool .
This parameter is a new feature class containing the attributes of the Join Features joined to the Target Features.
This is a required parameter.
- Parameters:
outFeatureClass
- a new feature class containing the attributes of the Join Features joined to the Target Features.
getJoinOperation
public java.lang.String getJoinOperation()
- Returns the Join Operation parameter of this tool .
This parameter is determines how joins between the Target Features and Join Features will be handled in the output feature class if multiple Join Features are found that have the same spatial relationship with a single Target Feature. For example, if a single point Target Feature is found within two separate polygon Join Features, should the attributes of both polygons be aggregated using a Field Map merge rule (JOIN_ONE_TO_ONE), or should the output contain two instances of the Target Feature: one instance with the attributes of one polygon, and one instance with the attributes of the other polygon (JOIN_ONE_TO_MANY).
This is an optional parameter.
- Returns:
- the Join Operation
setJoinOperation
public void setJoinOperation(java.lang.String joinOperation)
- Sets the Join Operation parameter of this tool .
This parameter is determines how joins between the Target Features and Join Features will be handled in the output feature class if multiple Join Features are found that have the same spatial relationship with a single Target Feature. For example, if a single point Target Feature is found within two separate polygon Join Features, should the attributes of both polygons be aggregated using a Field Map merge rule (JOIN_ONE_TO_ONE), or should the output contain two instances of the Target Feature: one instance with the attributes of one polygon, and one instance with the attributes of the other polygon (JOIN_ONE_TO_MANY).
This is an optional parameter.
- Parameters:
joinOperation
- determines how joins between the Target Features and Join Features will be handled in the output feature class if multiple Join Features are found that have the same spatial relationship with a single Target Feature. For example, if a single point Target Feature is found within two separate polygon Join Features, should the attributes of both polygons be aggregated using a Field Map merge rule (JOIN_ONE_TO_ONE), or should the output contain two instances of the Target Feature: one instance with the attributes of one polygon, and one instance with the attributes of the other polygon (JOIN_ONE_TO_MANY).
getJoinType
public java.lang.String getJoinType()
- Returns the Keep All Target Features parameter of this tool .
This parameter is determines if all Taget Features will be maintained in the output feature class (outer join), or only those that have the specified spatial relationship with the Join Features (inner join).
This is an optional parameter.
- Returns:
- the Keep All Target Features
setJoinType
public void setJoinType(java.lang.String joinType)
- Sets the Keep All Target Features parameter of this tool .
This parameter is determines if all Taget Features will be maintained in the output feature class (outer join), or only those that have the specified spatial relationship with the Join Features (inner join).
This is an optional parameter.
- Parameters:
joinType
- determines if all Taget Features will be maintained in the output feature class (outer join), or only those that have the specified spatial relationship with the Join Features (inner join).
getFieldMapping
public java.lang.Object getFieldMapping()
- Returns the Field Map of Join Features parameter of this tool .
This parameter is controls what attribute fields will be in the output feature class. Fields can be added, deleted, renamed, or have their properties changed. The initial list contains fields from both the Target Features and the Join Features.
This is an optional parameter.
- Returns:
- the Field Map of Join Features
setFieldMapping
public void setFieldMapping(java.lang.Object fieldMapping)
- Sets the Field Map of Join Features parameter of this tool .
This parameter is controls what attribute fields will be in the output feature class. Fields can be added, deleted, renamed, or have their properties changed. The initial list contains fields from both the Target Features and the Join Features.
This is an optional parameter.
- Parameters:
fieldMapping
- controls what attribute fields will be in the output feature class. Fields can be added, deleted, renamed, or have their properties changed. The initial list contains fields from both the Target Features and the Join Features.
getMatchOption
public java.lang.String getMatchOption()
- Returns the Match Option parameter of this tool .
This parameter is defines the criteria used to match rows. The attributes from the Join Features are transferred to the Target Features whenever this spatial relationship (or Match Option) is found. The match options are:
This is an optional parameter.
- Returns:
- the Match Option
setMatchOption
public void setMatchOption(java.lang.String matchOption)
- Sets the Match Option parameter of this tool .
This parameter is defines the criteria used to match rows. The attributes from the Join Features are transferred to the Target Features whenever this spatial relationship (or Match Option) is found. The match options are:
This is an optional parameter.
- Parameters:
matchOption
- defines the criteria used to match rows. The attributes from the Join Features are transferred to the Target Features whenever this spatial relationship (or Match Option) is found. The match options are:
getSearchRadius
public java.lang.Object getSearchRadius()
- Returns the Search Radius parameter of this tool .
This parameter is join Features within this distance of a Target Feature will be considered for the spatial join. Search Radius is only valid when the spatial relationship (or Match Option) INTERSECTS or CLOSEST is specified. Using a search radius of 100 meters with the spatial relationship INTERSECTS is the equivalent of saying: If a Join Feature is within 100 meters of a Target Feature, transfer the Join Feature attributes to the Target Feature. Using a search radius of 100 meters with the spatial relationship CLOSEST is the equivalent of saying: If a Join Feature is within 100 meters of a Target Feature, and is the closest Join Feature to that Target Feature, transfer the Join Feature attribtures to that Target Feature.
This is an optional parameter.
- Returns:
- the Search Radius
setSearchRadius
public void setSearchRadius(java.lang.Object searchRadius)
- Sets the Search Radius parameter of this tool .
This parameter is join Features within this distance of a Target Feature will be considered for the spatial join. Search Radius is only valid when the spatial relationship (or Match Option) INTERSECTS or CLOSEST is specified. Using a search radius of 100 meters with the spatial relationship INTERSECTS is the equivalent of saying: If a Join Feature is within 100 meters of a Target Feature, transfer the Join Feature attributes to the Target Feature. Using a search radius of 100 meters with the spatial relationship CLOSEST is the equivalent of saying: If a Join Feature is within 100 meters of a Target Feature, and is the closest Join Feature to that Target Feature, transfer the Join Feature attribtures to that Target Feature.
This is an optional parameter.
- Parameters:
searchRadius
- join Features within this distance of a Target Feature will be considered for the spatial join. Search Radius is only valid when the spatial relationship (or Match Option) INTERSECTS or CLOSEST is specified. Using a search radius of 100 meters with the spatial relationship INTERSECTS is the equivalent of saying: If a Join Feature is within 100 meters of a Target Feature, transfer the Join Feature attributes to the Target Feature. Using a search radius of 100 meters with the spatial relationship CLOSEST is the equivalent of saying: If a Join Feature is within 100 meters of a Target Feature, and is the closest Join Feature to that Target Feature, transfer the Join Feature attribtures to that Target Feature.
getDistanceFieldName
public java.lang.String getDistanceFieldName()
- Returns the Distance Field Name parameter of this tool .
This parameter is the name of a field to be added to the output feature class, which contains the distance between the Target Feature and the closest Join Feature. This option is only valid when the spatial relationship (or Match Option) CLOSEST is specified. If no field name is specified, the field will not be added to the output feature class.
This is an optional parameter.
- Returns:
- the Distance Field Name
setDistanceFieldName
public void setDistanceFieldName(java.lang.String distanceFieldName)
- Sets the Distance Field Name parameter of this tool .
This parameter is the name of a field to be added to the output feature class, which contains the distance between the Target Feature and the closest Join Feature. This option is only valid when the spatial relationship (or Match Option) CLOSEST is specified. If no field name is specified, the field will not be added to the output feature class.
This is an optional parameter.
- Parameters:
distanceFieldName
- the name of a field to be added to the output feature class, which contains the distance between the Target Feature and the closest Join Feature. This option is only valid when the spatial relationship (or Match Option) CLOSEST is specified. If no field name is specified, the field will not be added to the output feature class.
getToolName
public java.lang.String getToolName()
- Returns the name of this tool.
- Returns:
- the tool name
getToolboxName
public java.lang.String getToolboxName()
- Returns the name of the tool box containing this tool.
- Returns:
- the tool box name
getToolboxAlias
public java.lang.String getToolboxAlias()
- Returns the alias of the tool box containing this tool.
- Returns:
- the tool box alias