Joins the attributes of the Join Layer to the attribute table of the Target Layer based on spatial location.
Example: Points to Polygons - Search Tolerance = 0
Example: Polylines to Polygons - Search Tolerance = 0
Example: Polygons to Points - Search Tolerance = 0 - Update Rule = "Sum"
Example: Points to Polygons - Search Tolerance = 0
Example: Points to Polygons - Search Tolerance = 0 Keep All Target Features = FALSE. The feature with no joins is missing in the output.
Expression | Explanation |
---|---|
Function Name | SpatialJoin |
<Target Dataset> | A String representing the target layer. |
<Join Dataset> | A String representing the join layer. |
<output dataset> | A String - the full name of the output layer. |
< Join Type> | A String representing the Join Type to be used. Valid values: "OneToMany" and "ManyToMany" |
<CutOff Distance> | A Double representing the Cut-Off Distance to be used. The units of the tolerance are the units of spatial reference of the Target Dataset |
<Join Fields< | A String representing a list (separator ";") of the fields to transfer together with the method for each field. Valid values - "Sum", "Max", "Min" for number fields and "First", "Last" for string fields. Example: "Field1 Sum; Field2 First; Field3 Min" |
{Keep All} | A Boolean indicated whether to keep all target features - see explanation above. |
{Add Statistics} | A Boolean indicated whether to add statistics fields - see explanation above. |
ETGWPath used in the table below is the full path to ETGWRun.exe (E.G. "C:\Program Files\ETSpatial Techniques\ETGeo Wizards\ETGWRun.exe")
Language | Syntax |
---|---|
Python | subprocess.call([ETGWPath, "SpatialJoin", "Target Dataset", "Join Dataset", "output dataset", " Join Type", "CutOff Distance", "Join Fields", "Keep All", "Add Statistics"]) |
.NET using ETGWRun.exe | StartInfo.FileName = ETGWPath StartInfo.Arguments = "SpatialJoin" "Target Dataset" "Join Dataset" "output dataset" "Join Type" "CutOff Distance" "Join Fields" "Keep All" "Add Statistics" |
.NET using ETGWOutX.dll | SpatialJoin(Target Dataset,Join Dataset, output dataset, Join Type, CutOff Distance,Join Fields,Keep All,Add Statistics) |
ArcPy | arcpy.SpatialJoin(Target Dataset, Join Dataset, output dataset, "Join Type", "CutOff Distance", "Join Fields","Keep All", "Add Statistics") |
Notes:
<> - required parameter
{} - optional parameter
The argument separator for StartInfo.Arguments is space. If a string might contain a space, you need to double quote it.