Space Association
This topic describes how to use the spatial join operator.
Purpose
The spatial join operator associates properties from two data tables using the geometric fields in the tables and a specified spatial relationship.
Scenarios
Processing pipeline | Compute engine | Supported |
Offline | PostgreSQL | Yes |
Polar_PG | Yes | |
AnalyticDB for PostgreSQL (ADB_PG) | Yes |
Instructions
Source nodes
The spatial join operator requires two source nodes, also called input nodes. Each source node acts as a table and must contain at least one geometry field. The operator joins the tables based on a specified spatial relationship between their geometry fields. If a table has multiple geometry fields, the operator uses the first one by default. You can manually switch to another geometry field if needed.
Primary table
The primary table is one of the input nodes and specifies the relative position for the spatial calculation. By default, the system sets the first input node as the primary table. You can manually set a different node as the primary table.
Association logic
You can specify the spatial relationship between the primary table and the associated node. The relationships are described as follows. Assume that the primary table is A and the associated node is B.
1. A intersects B: A and B have at least one point in common.
2. A contains B: All points of B are inside or on the border of A, and at least one point of B is inside A.
3. A touches B: A and B share at least one border point but no interior points.
4. A overlaps B: A and B have the same dimension, such as point, line, or polygon. They share some but not all points, and one does not contain the other. The dimension of their intersection is the same as the dimension of A and B.
5. A is within B: All points of A are inside or on the border of B, and at least one point of A is inside B.
6. A crosses B: A and B share at least one interior point, and neither contains the other.
The following diagram shows the association logic:

Output fields
You can configure the list of fields that the current node outputs to descendant nodes. By default, this list includes all fields from all source nodes. You can remove fields as needed. If different source nodes have fields with the same name or code, the system renames the duplicate fields by adding a suffix. You can also manually modify the names or codes of the duplicate fields.