com.esri.arcgis.arcmapui
Class SpatialJoin

java.lang.Object
  extended by com.esri.arcgis.arcmapui.SpatialJoin
All Implemented Interfaces:
IAggregateOptions, ISpatialJoin, com.esri.arcgis.interop.RemoteObjRef, Serializable

public class SpatialJoin
extends Object
implements com.esri.arcgis.interop.RemoteObjRef, ISpatialJoin, IAggregateOptions

Spatial Join two feature classes.

Description

A spatial join is a form of spatial analysis in which the attributes of features in two feature classes are joined together based on the relative locations of the features. Spatial joins are not dynamic and require the results to be saved to a new output layer.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

See Also:
Serialized Form

Constructor Summary
SpatialJoin()
          Constructs a SpatialJoin using ArcGIS Engine.
SpatialJoin(Object obj)
          Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
SpatialJoin theSpatialJoin = (SpatialJoin) obj;
 
Method Summary
 boolean equals(Object o)
          Compare this object with another
static String getClsid()
          getClsid.
 int hashCode()
          the hashcode for this object
 IFeatureClass joinAggregate(IName pOutputName, double maxMapDist)
          Join using aggregate.
 IFeatureClass joinNearest(IName pOutputName, double maxMapDist)
          Joins with the nearest feature in the join feature class.
 IFeatureClass joinWithin(IName pOutputName)
          Joins a feature in the source feature class with the feature if it falls within in the join feature class.
 void setIsAverage(boolean rhs1)
          Indicates if the average of all numeric fields in the join feature class is appended to the result.
 void setIsCount(boolean rhs1)
          Indicates if the count of all numeric fields in the join feature class is appended to the result.
 void setIsMax(boolean rhs1)
          Indicates if the maximum of all numeric fields in the join feature class is appended to the result.
 void setIsMin(boolean rhs1)
          Indicates if the minimum of all numeric fields in the join feature class is appended to the result.
 void setIsStdDev(boolean rhs1)
          Indicates if the standard deviation of all numeric fields in the join feature class is appended to the result.
 void setIsSum(boolean rhs1)
          Indicates if the sum of all numeric fields in the join feature class is appended to the result.
 void setIsVar(boolean rhs1)
          Indicates if the variance of all numeric fields in the join feature class is appended to the result.
 void setJoinTableByRef(ITable rhs1)
          The spatial table to append fields from.
 void setLeftOuterJoin(boolean rhs1)
          Indicates whether a match is required before adding a record from the source feature class to the result.
 void setShowProcess(boolean bShowMessage, int rhs2)
          Indicates whether to show update messages while processing join.
 void setSourceTableByRef(ITable rhs1)
          The spatial table to append fields to.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.esri.arcgis.interop.RemoteObjRef
getJintegraDispatch, release
 

Constructor Detail

SpatialJoin

public SpatialJoin()
            throws IOException,
                   UnknownHostException
Constructs a SpatialJoin using ArcGIS Engine.

Throws:
IOException - if there are interop problems
UnknownHostException - if there are interop problems

SpatialJoin

public SpatialJoin(Object obj)
            throws IOException
Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
SpatialJoin theSpatialJoin = (SpatialJoin) obj;

Construct a SpatialJoin using a reference to such an object returned from ArcGIS Engine or Server. This is semantically equivalent to casting obj to SpatialJoin.

Parameters:
obj - an object returned from ArcGIS Engine or Server
Throws:
IOException - if there are interop problems
Method Detail

getClsid

public static String getClsid()
getClsid.


equals

public boolean equals(Object o)
Compare this object with another

Overrides:
equals in class Object

hashCode

public int hashCode()
the hashcode for this object

Overrides:
hashCode in class Object

setSourceTableByRef

public void setSourceTableByRef(ITable rhs1)
                         throws IOException,
                                AutomationException
The spatial table to append fields to.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
setSourceTableByRef in interface ISpatialJoin
Parameters:
rhs1 - A reference to a com.esri.arcgis.geodatabase.ITable (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setJoinTableByRef

public void setJoinTableByRef(ITable rhs1)
                       throws IOException,
                              AutomationException
The spatial table to append fields from.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
setJoinTableByRef in interface ISpatialJoin
Parameters:
rhs1 - A reference to a com.esri.arcgis.geodatabase.ITable (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

joinAggregate

public IFeatureClass joinAggregate(IName pOutputName,
                                   double maxMapDist)
                            throws IOException,
                                   AutomationException
Join using aggregate. Only features within a distance of maxMapDist will be joined. A maxMapDist of -1 means infinity.

Remarks

JoinAggregate will count the number of features in the join table that are the closest to features in the source table. The maxMapDist parameter determines the search radius for the join operation. Negative maxMapDist values other than -1 (infinity) are invalid and will produce an empty output feature class.

For example, if a source layer containing line features (rivers) is spatially joined to a layer which contains point features (cities), the new output layer will contain a record for each feature in the source table and include an additional column, 'count'. Where a match was successful, the value in this column indicates the number of cities closest to a particular river, given the value of maxMapDist.

Rivers and cities feature classes:

Output feature class table:

If additional information about the related features is required, QI on the SpatialJoin CoClass for the IAggregateOptions interface to append an aggregate (minimium, average, maximum etc.) of the numeric attributes of the closest features.

Output feature class table with aggregated numeric attributes:

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
joinAggregate in interface ISpatialJoin
Parameters:
pOutputName - A reference to a com.esri.arcgis.system.IName (in)
maxMapDist - The maxMapDist (in)
Returns:
A reference to a com.esri.arcgis.geodatabase.IFeatureClass
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

joinNearest

public IFeatureClass joinNearest(IName pOutputName,
                                 double maxMapDist)
                          throws IOException,
                                 AutomationException
Joins with the nearest feature in the join feature class. Only features within a distance of maxMapDist will be joined. A maxMapDist of -1 means infinity.

Remarks

JoinNearest identifies the nearest feature in the join table to features in the source table. The maxMapDist parameter determines the search radius for the join operation. Negative maxMapDist values other than -1 (infinity) are invalid and will produce an empty output feature class.

For example, joining a source layer containing line features (rivers) to a layer which contains point features (cities) with LeftOuterJoin = FALSE. Where a match is successful, the new output layer will contain a record for each feature in the source table with the corresponding attribute columns for the nearest feature in the join table.

Rivers and cities feature classes:

New output feature class table:

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
joinNearest in interface ISpatialJoin
Parameters:
pOutputName - A reference to a com.esri.arcgis.system.IName (in)
maxMapDist - The maxMapDist (in)
Returns:
A reference to a com.esri.arcgis.geodatabase.IFeatureClass
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

joinWithin

public IFeatureClass joinWithin(IName pOutputName)
                         throws IOException,
                                AutomationException
Joins a feature in the source feature class with the feature if it falls within in the join feature class.

Remarks

JoinWithin identifies those features in the source table that are contained by features in the table being joined.

For example, if the source layer containing line features (rivers) is spatially joined to a layer which contains polygon features (administrative boundaries), with the LeftOuterJoin property set to TRUE, the new output layer will contain a record for each feature in the source table with all the attribute columns from the join table appended. Where a JoinWithin match was identified, each river in the new feature class will now have additional attribute information about the administrative boundary it falls within. Where no match was identified, the appended columns will be empty.

River and states feature classes:

New feature class table:

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
joinWithin in interface ISpatialJoin
Parameters:
pOutputName - A reference to a com.esri.arcgis.system.IName (in)
Returns:
A reference to a com.esri.arcgis.geodatabase.IFeatureClass
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setShowProcess

public void setShowProcess(boolean bShowMessage,
                           int rhs2)
                    throws IOException,
                           AutomationException
Indicates whether to show update messages while processing join.

Product Availability

Available with ArcGIS Desktop.

Specified by:
setShowProcess in interface ISpatialJoin
Parameters:
bShowMessage - The bShowMessage (in)
rhs2 - The rhs2 (A COM typedef) (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setLeftOuterJoin

public void setLeftOuterJoin(boolean rhs1)
                      throws IOException,
                             AutomationException
Indicates whether a match is required before adding a record from the source feature class to the result. If TRUE, all records in the source feature class are added regardless of whether there is a match.

Remarks

The following diagram illustrates the nature of the join which is performed depending on whether this parameter is set to true or false:

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
setLeftOuterJoin in interface ISpatialJoin
Parameters:
rhs1 - The rhs1 (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setIsSum

public void setIsSum(boolean rhs1)
              throws IOException,
                     AutomationException
Indicates if the sum of all numeric fields in the join feature class is appended to the result.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
setIsSum in interface IAggregateOptions
Parameters:
rhs1 - The rhs1 (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setIsAverage

public void setIsAverage(boolean rhs1)
                  throws IOException,
                         AutomationException
Indicates if the average of all numeric fields in the join feature class is appended to the result.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
setIsAverage in interface IAggregateOptions
Parameters:
rhs1 - The rhs1 (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setIsCount

public void setIsCount(boolean rhs1)
                throws IOException,
                       AutomationException
Indicates if the count of all numeric fields in the join feature class is appended to the result.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
setIsCount in interface IAggregateOptions
Parameters:
rhs1 - The rhs1 (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setIsMax

public void setIsMax(boolean rhs1)
              throws IOException,
                     AutomationException
Indicates if the maximum of all numeric fields in the join feature class is appended to the result.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
setIsMax in interface IAggregateOptions
Parameters:
rhs1 - The rhs1 (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setIsMin

public void setIsMin(boolean rhs1)
              throws IOException,
                     AutomationException
Indicates if the minimum of all numeric fields in the join feature class is appended to the result.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
setIsMin in interface IAggregateOptions
Parameters:
rhs1 - The rhs1 (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setIsStdDev

public void setIsStdDev(boolean rhs1)
                 throws IOException,
                        AutomationException
Indicates if the standard deviation of all numeric fields in the join feature class is appended to the result.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
setIsStdDev in interface IAggregateOptions
Parameters:
rhs1 - The rhs1 (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setIsVar

public void setIsVar(boolean rhs1)
              throws IOException,
                     AutomationException
Indicates if the variance of all numeric fields in the join feature class is appended to the result.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
setIsVar in interface IAggregateOptions
Parameters:
rhs1 - The rhs1 (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.