<?xml version="1.0" encoding="UTF-8"?><metadata>
<Esri>
<CreaDate>20181109</CreaDate>
<CreaTime>09344200</CreaTime>
<ArcGISFormat>1.0</ArcGISFormat>
<SyncOnce>TRUE</SyncOnce>
<ModDate>20190807</ModDate>
<ModTime>153348</ModTime>
</Esri>
<dataIdInfo>
<idCitation>
<resTitle>Spatial Join</resTitle>
<date>
<createDate>20181109</createDate>
</date>
</idCitation>
<idAbs>
<para>Joins attributes from one feature to another based on the spatial relationship. The target features and the joined attributes from the join features are written to the output feature class.</para>
</idAbs>
<descKeys KeyTypCd="005">
<keyTyp>
<keyTyp>005</keyTyp>
</keyTyp>
<keyword>Combine</keyword>
<keyword>Cover</keyword>
<keyword>Inside</keyword>
<keyword>Intersect</keyword>
<keyword>Join</keyword>
<keyword>On Top Of</keyword>
<keyword>Outside</keyword>
<keyword>Overlap</keyword>
<keyword>Spatial Relationship</keyword>
<keyword>Superimpose</keyword>
<keyword>Topological Set</keyword>
<keyword>Topology</keyword>
<keyword>Append</keyword>
<keyword>Attribute</keyword>
<keyword>By Location</keyword>
<keyword>Closest</keyword>
<keyword>Common</keyword>
<keyword>Contain</keyword>
<keyword>Count</keyword>
<keyword>Distance</keyword>
<keyword>Match</keyword>
<keyword>Move</keyword>
<keyword>Near</keyword>
<keyword>Number</keyword>
<keyword>Transfer</keyword>
</descKeys>
</dataIdInfo>
<distInfo>
<distributor>
<distorFormat>
<formatName>ArcToolbox Tool</formatName>
</distorFormat>
</distributor>
</distInfo>
<mdDateSt>20181109</mdDateSt>
<mdContact>
<rpOrgName>Environmental Systems Research Institute, Inc. (Esri)</rpOrgName>
<rpCntInfo>
<cntAddress>
<delPoint>380 New York Street</delPoint>
<city>Redlands</city>
<adminArea>California</adminArea>
<postCode>92373-8100</postCode>
<eMailAdd>info@esri.com</eMailAdd>
<country>United States</country>
</cntAddress>
<cntPhone>
<voiceNum>909-793-2853</voiceNum>
<faxNum>909-793-5953</faxNum>
</cntPhone>
<cntOnlineRes>
<linkage>http://www.esri.com</linkage>
</cntOnlineRes>
</rpCntInfo>
<role>
<RoleCd>007</RoleCd>
</role>
</mdContact>
<tool displayname="Spatial Join" name="SpatialJoin" softwarerestriction="none" toolboxalias="&lt;process id=&quot;Background#1:193497761558643&quot; ticks=&quot;637007982570000000&quot; err_code=&quot;0&quot; has_error=&quot;false&quot; decimal_point=&quot;,&quot; version=&quot;1&quot; ticks2=&quot;637007982607011331&quot;&gt; &lt;tool name=&quot;SpatialJoin&quot; type=&quot;function&quot; toolboxalias=&quot;analysis&quot;&gt; &lt;displayname&gt;Spatial Join&lt;/displayname&gt; &lt;description&gt;Geoprocessing tool used to join the attributes of two feature classes based on the spatial relationships between the features in the two feature classes and to write the join an output.&lt;/description&gt; &lt;/tool&gt; &lt;params&gt; &lt;param name=&quot;target_features&quot; displayname=&quot;Target Features&quot; derived=&quot;false&quot; output=&quot;false&quot; datatype=&quot;GPFeatureLayer&quot;&gt;AJURICABA&lt;/param&gt; &lt;param name=&quot;join_features&quot; displayname=&quot;Join Features&quot; derived=&quot;false&quot; output=&quot;false&quot; datatype=&quot;GPFeatureLayer&quot;&gt;AJURICABA&lt;/param&gt; &lt;param name=&quot;out_feature_class&quot; displayname=&quot;Output Feature Class&quot; derived=&quot;false&quot; output=&quot;true&quot; datatype=&quot;DEFeatureClass&quot;&gt;C:\Users\giovani\Documents\ArcGIS\Projects\app3 light\app3 light.gdb\AJURICABA_SpatialJoin&lt;/param&gt; &lt;param name=&quot;join_operation&quot; displayname=&quot;Join Operation&quot; derived=&quot;false&quot; output=&quot;false&quot; datatype=&quot;GPString&quot;&gt;JOIN_ONE_TO_ONE&lt;/param&gt; &lt;param name=&quot;join_type&quot; displayname=&quot;Keep All Target Features&quot; derived=&quot;false&quot; output=&quot;false&quot; datatype=&quot;GPBoolean&quot;&gt;KEEP_ALL&lt;/param&gt; &lt;param name=&quot;field_mapping&quot; displayname=&quot;Field Map of Join Features&quot; derived=&quot;false&quot; output=&quot;false&quot; datatype=&quot;GPFieldMapping&quot;&gt;NM_MUNICIP &quot;NM_MUNICIP&quot; true true false 60 Text 0 0,First,#,AJURICABA,NM_MUNICIP,0,60;GEOCODIGO &quot;GEOCODIGO&quot; true true false 10 Long 0 10,First,#,AJURICABA,GEOCODIGO,-1,-1;Symbol &quot;Symbol&quot; true true false 50 Text 0 0,First,#,AJURICABA,Symbol,0,50;G_MGS_H &quot;G_MGS_H&quot; true true false 19 Double 0 0,First,#,AJURICABA,G_MGS_H,-1,-1;G_MGS2_H &quot;G_MGS2_H&quot; true true false 19 Double 0 0,First,#,AJURICABA,G_MGS2_H,-1,-1;C1_MGP_H &quot;C1_MGP_H&quot; true true false 19 Double 0 0,First,#,AJURICABA,C1_MGP_H,-1,-1;C2_MGP_H &quot;C2_MGP_H&quot; true true false 19 Double 0 0,First,#,AJURICABA,C2_MGP_H,-1,-1;C3_MGP_H &quot;C3_MGP_H&quot; true true false 19 Double 0 0,First,#,AJURICABA,C3_MGP_H,-1,-1;Shape_Leng &quot;Shape_Leng&quot; true true false 19 Double 0 0,First,#,AJURICABA,Shape_Leng,-1,-1;Shape_Area &quot;Shape_Area&quot; true true false 19 Double 0 0,First,#,AJURICABA,Shape_Area,-1,-1;NM_MUNICIP_1 &quot;NM_MUNICIP&quot; true true false 60 Text 0 0,First,#,AJURICABA,NM_MUNICIP,0,60;GEOCODIGO_1 &quot;GEOCODIGO&quot; true true false 10 Long 0 10,First,#,AJURICABA,GEOCODIGO,-1,-1;Symbol_1 &quot;Symbol&quot; true true false 50 Text 0 0,First,#,AJURICABA,Symbol,0,50;G_MGS_H_1 &quot;G_MGS_H&quot; true true false 19 Double 0 0,First,#,AJURICABA,G_MGS_H,-1,-1;G_MGS2_H_1 &quot;G_MGS2_H&quot; true true false 19 Double 0 0,First,#,AJURICABA,G_MGS2_H,-1,-1;C1_MGP_H_1 &quot;C1_MGP_H&quot; true true false 19 Double 0 0,First,#,AJURICABA,C1_MGP_H,-1,-1;C2_MGP_H_1 &quot;C2_MGP_H&quot; true true false 19 Double 0 0,First,#,AJURICABA,C2_MGP_H,-1,-1;C3_MGP_H_1 &quot;C3_MGP_H&quot; true true false 19 Double 0 0,First,#,AJURICABA,C3_MGP_H,-1,-1;Shape_Leng_1 &quot;Shape_Leng&quot; true true false 19 Double 0 0,First,#,AJURICABA,Shape_Leng,-1,-1;Shape_Area_1 &quot;Shape_Area&quot; true true false 19 Double 0 0,First,#,AJURICABA,Shape_Area,-1,-1&lt;/param&gt; &lt;param name=&quot;match_option&quot; displayname=&quot;Match Option&quot; derived=&quot;false&quot; output=&quot;false&quot; datatype=&quot;GPString&quot;&gt;INTERSECT&lt;/param&gt; &lt;param name=&quot;search_radius&quot; displayname=&quot;Search Radius&quot; derived=&quot;false&quot; output=&quot;false&quot; datatype=&quot;GPLinearUnit&quot;&gt;&lt;/param&gt; &lt;param name=&quot;distance_field_name&quot; displayname=&quot;Distance Field Name&quot; derived=&quot;false&quot; output=&quot;false&quot; datatype=&quot;GPString&quot;&gt;&lt;/param&gt; &lt;/params&gt; &lt;environments /&gt; &lt;return_value&gt;C:\Users\giovani\Documents\ArcGIS\Projects\app3 light\app3 light.gdb\AJURICABA_SpatialJoin&lt;/return_value&gt; &lt;messages&gt; &lt;msg code=&quot;0&quot; type=&quot;2&quot;&gt;Start Time: quarta-feira, 7 de agosto de 2019 15:10:59&lt;/msg&gt; &lt;msg code=&quot;0&quot; type=&quot;3&quot;&gt;Succeeded at quarta-feira, 7 de agosto de 2019 15:11:00 (Elapsed Time: 1,00 seconds)&lt;/msg&gt; &lt;/messages&gt; &lt;/process&gt;">
<summary>&lt;DIV STYLE="text-align:Left;"&gt;&lt;DIV&gt;&lt;P&gt;&lt;SPAN&gt;Geoprocessing tool used to join the attributes of two feature classes based on the spatial relationships between the features in the two feature classes and to write the join an output.&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</summary>
<alink_name>SpatialJoin_analysis</alink_name>
<parameters>
<param datatype="Feature Set" direction="Input" displayname="Target Features" expression="target_features" name="target_features" sync="true" type="Required">
<pythonReference>
<para>Attributes of the target features and the attributes from the joined features are transferred to the output feature class. However, a subset of attributes can be defined in the field map parameter. </para>
</pythonReference>
<dialogReference>&lt;DIV STYLE="text-align:Left;"&gt;&lt;DIV&gt;&lt;P&gt;&lt;SPAN&gt;Attributes of the target features and the attributes from the joined features are transferred to the output feature class. However, a subset of attributes can be defined in the field map parameter.&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</dialogReference>
</param>
<param datatype="Feature Set" direction="Input" displayname="Join Features" expression="join_features" name="join_features" sync="true" type="Required">
<pythonReference>
<para>The attributes from the join features are joined to the attributes of the target features. See the explanation of the join_operation parameter for details on how the aggregation of joined attributes are affected by the type of join operation. </para>
</pythonReference>
<dialogReference>&lt;DIV STYLE="text-align:Left;"&gt;&lt;DIV&gt;&lt;P&gt;&lt;SPAN&gt;The attributes from the join features are joined to the attributes of the target features. See the explanation of the Join Operation parameter for details on how the aggregation of joined attributes are affected by the type of join operation.&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</dialogReference>
</param>
<param datatype="Feature Set" direction="Output" displayname="Output Feature Class" expression="{out_feature_class}" name="out_feature_class" sync="true" type="Optional">
<pythonReference>
<para>A new feature class containing the attributes of the target and join features. By default, all attributes of target features and the attributes of the joined features are written to the output. However, the set of attributes to be transferred can be controlled by the field map parameter.</para>
</pythonReference>
<dialogReference>&lt;DIV STYLE="text-align:Left;"&gt;&lt;DIV&gt;&lt;P&gt;&lt;SPAN&gt;A new feature class containing the attributes of the target and join features. By default, all attributes of target features and the attributes of the joined features are written to the output. However, the set of attributes to be transferred can be controlled by the field map parameter.&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</dialogReference>
</param>
<param datatype="String" direction="Input" displayname="Field Map of Join Features" expression="{field_mapping}" name="field_mapping" sync="true" type="Optional">
<pythonReference>
<para>Controls what attribute fields will be in the output feature class. The initial list contains all the fields from both the target features and the join features. Fields can be added, deleted, renamed, or have their properties changed. The selected fields from the target features are transferred as is, but selected fields from the join features can be aggregated by a merge rule. For details on field mapping, see Using the field mapping control and Mapping input fields to output fields. Multiple fields and statistic
combination may be specified.</para>
</pythonReference>
<dialogReference>&lt;DIV STYLE="text-align:Left;"&gt;&lt;DIV&gt;&lt;P&gt;&lt;SPAN&gt;Controls which attribute fields will be in the output feature class. The initial list contains all the fields from both the target features and the join features. Fields can be added, deleted, renamed, or have their properties changed. The selected fields from the target features are transferred as is, but selected fields from the join features can be aggregated by a valid merge rule. The default value is an empty string, in which case, all fields from both target and join features are transferred to the output. For details on field mapping, see the help topics "Using the field mapping control" and "Mapping input fields to output fields." Multiple fields and statistic
combination may be specified.Merge rules allow you to specify how values from two or more
input fields are merged or combined into a single output value.
There are several merge rules that determine how the output field is populated with values.First—Use the input fields' first value.Last—Use the input fields' last value.Join—Concatenate (join) the input fields' values.Sum—Calculate the total of the input fields' values.Mean—Calculate the mean (average) of the input fields' values.Median—Calculate the median (middle) of the input fields' values.Mode—Use the value with the highest frequency.Min—Use the minimum value of all input fields' values.Max—Use the maximum value of all input fields' values.Standard deviation—Use the standard deviation classification method on all input fields'
values.Count—Find the number of records included in the calculation.&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</dialogReference>
</param>
<param datatype="String" direction="Input" displayname="Output Feature Service Name" expression="{esri_out_feature_service_name}" name="esri_out_feature_service_name" type="Optional">
<dialogReference>&lt;DIV STYLE="text-align:Left;"&gt;&lt;DIV&gt;&lt;P&gt;&lt;SPAN&gt;The name of the optional feature service to create on the federated server containing the result of this tool. If no name is specified an output feature service will not be created.&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</dialogReference>
</param>
</parameters>
<returnvalues/>
<environments>
<environment label="Default output Z value" name="outputZValue">
</environment>
<environment label="M resolution" name="MResolution">
</environment>
<environment label="M tolerance" name="MTolerance">
</environment>
<environment label="Output Config Keyword" name="configKeyword">
</environment>
<environment label="Output M domain" name="MDomain">
</environment>
<environment label="Output XY domain" name="XYDomain">
</environment>
<environment label="Output Z domain" name="ZDomain">
</environment>
<environment label="Output coordinate system" name="outputCoordinateSystem">
</environment>
<environment label="Output extent" name="extent">
</environment>
<environment label="Output has M values" name="outputMFlag">
</environment>
<environment label="Output has Z values" name="outputZFlag">
</environment>
<environment label="XY resolution" name="XYResolution">
</environment>
<environment label="XY tolerance" name="XYTolerance">
</environment>
<environment label="Z resolution" name="ZResolution">
</environment>
<environment label="Z tolerance" name="ZTolerance">
</environment>
</environments>
<usage>
<bullet_item>
<para>A spatial join involves matching rows from the Join Features to the Target Features based on their relative spatial locations.</para>
</bullet_item>
<bullet_item>
<para>By default, all attributes of the join features are appended to attributes of the target features and copied over to the output feature class. You can define which of the attributes will be written to the output by manipulating them in the Field Map of Join Features parameter.</para>
</bullet_item>
<bullet_item>
<para>Two new fields, Join_Count and TARGET_FID, are always added to the output feature class. Join_Count indicates how many join features match each target feature (TARGET_FID).</para>
<para>Another new field, JOIN_FID, is added to the output when Join one to many (JOIN_ONE_TO_MANY in Python) is specified in the Join Operation parameter.</para>
</bullet_item>
<bullet_item>
<para>When the Join Operation parameter is Join one to many, there can be more than one row in the output feature class for each target feature. The JOIN_FID field makes it easier to determine which feature is joined to which target feature (TARGET_FID). A value of -1 for JOIN_FID field means no feature meets the specified spatial relationship with the target feature. </para>
</bullet_item>
<bullet_item>
<para>
All input target features are written to the output feature class only if:
<bulletList>
<bullet_item>The Join Operation is set to Join one to one, and</bullet_item>
<bullet_item>Keep All Target Features is checked (join_type = "KEEP_ALL" in Python).</bullet_item>
</bulletList>
</para>
</bullet_item>
<bullet_item>
<para>Merge rules specified in the Field Map of Join Features parameter only apply to attributes from the join features and when more than one feature is matched to a target feature (when Join_Count &gt; 1). For example, if three features with DEPTH attribute values of 15.5, 2.5, and 3.3 are joined, and a merge rule of Mean is applied, the output field will have a value of 6.1. Null values in join fields are ignored for statistic calculation. For example, 15.5, &lt;null&gt;, and 2.5 will result in 9.0 for Mean and 2 for Count.</para>
</bullet_item>
<bullet_item>
<para>
When the Match Option is set to Closest or Closest geodesic, it is possible that two or more join features are at the same distance from the target feature. When this situation occurs, one of the join features is randomly selected as the matching feature (the join feature's FID does not influence this random selection). If you want to find the 2nd, 3rd, or <italics>N</italics>
<italics>th</italics>
closest feature, use the Generate Near Table tool.
</para>
</bullet_item>
<bullet_item>
<para>If a join feature has a spatial relationship with multiple target features, then it is counted as many times as it is matched against the target feature. For example, if a point is within three polygons, then the point is counted three times, once for each polygon.</para>
</bullet_item>
<bullet_item>
<para>For more information about using the three-dimensional spatial relationships Intersect 3D and Within a distance 3D see Select by Location 3D relationships.</para>
</bullet_item>
</usage>
<scriptExamples>
<scriptExample>
<title>SpatialJoin example 1 (Python window)</title>
<para>The following script demonstrates how to use the SpatialJoin function in a Python window.</para>
<code xml:space="preserve">import arcpy
target_features = "C:/data/usa.gdb/states"
join_features = "C:/data/usa.gdb/cities"
out_feature_class = "C:/data/usa.gdb/states_cities"
arcpy.SpatialJoin_analysis(target_features, join_features, out_feature_class)
</code>
</scriptExample>
<scriptExample>
<title>SpatialJoin example 2 (stand-alone script)</title>
<para>The following stand-alone script demonstrates how to use SpatialJoin to join attributes of cities to states.</para>
<code xml:space="preserve"># Name: SpatialJoin_Example2.py
# Description: Join attributes of cities to states based on spatial relationships.
# Requirements: os module
# Import system modules
import arcpy
import os
# Set local variables
workspace = r"usa.gdb"
outWorkspace 
= r"output.gdb"
 
# Want to join USA cities to states and calculate the mean city population
# for each state
targetFeatures = os.path.join(workspace, "states")
joinFeatures = os.path.join(workspace, "cities")
# Output will be the target features, states, with a mean city population field (mcp)
outfc = os.path.join(outWorkspace, "states_mcp2")
# Create a new fieldmappings and add the two input feature classes.
fieldmappings = arcpy.FieldMappings()
fieldmappings.addTable(targetFeatures)
fieldmappings.addTable(joinFeatures)
# First get the POP1990 fieldmap. POP1990 is a field in the cities feature class.
# The output will have the states with the attributes of the cities. Setting the
# field's merge rule to mean will aggregate the values for all of the cities for
# each state into an average value. The field is also renamed to be more appropriate
# for the output.
pop1990FieldIndex = fieldmappings.findFieldMapIndex("POP1990")
fieldmap = fieldmappings.getFieldMap(pop1990FieldIndex)
# Get the output field's properties as a field object
field = fieldmap.outputField
# Rename the field and pass the updated field object back into the field map
field.name = "mean_city_pop"
field.aliasName = "mean_city_pop"
fieldmap.outputField = field
# Set the merge rule to mean and then replace the old fieldmap in the mappings object
# with the updated one
fieldmap.mergeRule = "mean"
fieldmappings.replaceFieldMap(pop1990FieldIndex, fieldmap)
# Delete fields that are no longer applicable, such as city CITY_NAME and CITY_FIPS
# as only the first value will be used by default
x = fieldmappings.findFieldMapIndex("CITY_NAME")
fieldmappings.removeFieldMap(x)
y = fieldmappings.findFieldMapIndex("CITY_FIPS")
fieldmappings.removeFieldMap(y)
#Run the Spatial Join tool, using the defaults for the join operation and join type
arcpy.SpatialJoin_analysis(targetFeatures, joinFeatures, outfc, "#", "#", fieldmappings)
</code>
</scriptExample>
</scriptExamples>
<shortdesc> ArcGIS geoprocessing tool used to join the attributes of two feature classes based on the spatial relationships between the features in the two feature classes and to write the join an output.</shortdesc>
<arcToolboxHelpPath>withheld</arcToolboxHelpPath>
</tool>
</metadata>
