Spatial Join And Aggregation
Introduction
Generate new data by joining the target data and the join data based on the spatial relationship. The target data must be spatial data, and the join data can be spatial data or attribute data. All fields of the target data are preserved to the new data. Since one record of the target data may match multiple records of the join data, different merge rules can be set for different fields of the join data.
1. Set the target data

- Target Data: Spatial data only.
2. Set the join data

- Join Data: It can be spatial data or attribute data.
- Longitude and Latitude Fields: When joining attribute data, you need to select longitude and latitude fields for determining the spatial relationship.
3. Set the match option

- Match Option: The spatial relationship between the target data and the join data.
4. Set the output fields

- Field Mapping: The field mapping type from the join data to the generated new data, including Calculate Values, Count Units. When you select Calculate Values, you can set the output fields and the merge rules for each field. When you select Count Units, you can select the fields to count the number of units with different values and set the keywords used for matching.
4.1 Calculate values
- Output Fields: The fields to be added to the new data. For each output field, one or more merge rules can be set.
- Merge Rule: The rule for merging the values of multiple records of the join data when a record of the target data matches multiple records of the join data.
- First: Use the value of the first matched record.
- Last: Use the value of the last matched record.
- Join by Semicolon: Concatenate the values of multiple matched records with semicolons.
- Distinct Join by Semicolon: Concatenate the distinct values of multiple matched records with semicolons.
- Count Distinct: Count the number of distinct values of the matched records.
- Sum: Calculate the sum of the values of the matched records.
- Average: Calculate the average of the values of the matched records.
- Median: Calculate the median of the values of the matched records.
- Min: Use the minimum value of the matched records.
- Max: Use the maximum value of the matched records.
- Standard Deviation: Calculate the standard deviation of the values of the matched records.
4.2 Count units

- Count Field (optional): When no count field is selected, count the number of units that match the spatial relationship of the join data. When the count field is selected, the number of different values of the field in the spatially related units of the join data is counted.
- Input Keywords (optional): If no keywords are entered, all different values in the count field are counted. When keywords are entered, only the values of the count fields that match the keywords are counted. Multiple keywords should be separated by ";" (e.g. "Restaurant;Starbucks").
- Match Type: Exact match or fuzzy match for the entered keywords.
5. Set Time Range

- Set Time Range: If you only need data within a certain time range, click Yes and select the time field and set the time range.
- Time Field: Set the time field of the join data for judging the time range.
- Time Range: Set the start time and end time of the join data.
6. Set the output data

- Output Data Range: If you choose to output all units, all spatial units of the target data will be output, and the spatial units without aggregated data will be assigned a value of "0". If you choose to output the units with aggregated data, only the spatial units of the target data with aggregated data will be output.

- Output Data Name: If no name is set, the default is "toolName_time".
7. Submit
After completing the above settings, click Submit to start the tool.
When it finishes successfully, a message will be shown at the top of the page. You can click the Open Data button to start accessing the data or go to the Data page to view it.