gvSIG-Desktop 1.10. User Manual
Spatial join
Introduction
This geoprocess allows you to transfer the attributes of one layer to another based on a common element. In contrast to the join sql operator in the relational data bases, in this case, the common element is not that a field of the two tables takes the same value, but that the related elements in the two layers meet some spatial criteria.
The “Spatial join” geoprocess allows you to follow two types of spatial criteria to establish the spatial link:
Nearest neighbour (1->1 relationship). This assigns the attributes of the nearest element in the related layer to an element in the source layer.
If the nearest element intersects (or in the case of polygons is “Contained in”) with the source element, the algorithm will take the first element analysed in the possible intersections.
Contained in (1->M relationship). This relates an element in the source layer with several elements in the destination layer (in particular, with those that intersect).
In this case, the source layer will not inherit the related layer’s attributes, but the operation will be very similar to the "Dissolve" geoprocess.
The user can choose one or several summary functions (average, minimum, maximum, summatory) to be applied on the numerical attributes of the related layer for the M elements related to an element in the source layer.
Running a 'Spatial Join'
When you have selected the "Spatial join" option, the following window appears:
This window is practically the same as the windows in the overlay geoprocesses (Union, Difference, Intersection) with one difference.
It allows you to choose whether you want to run a 1-1 relationship (using the nearest neighbour spatial criterion) or run a 1-N relationship (using the “Intersect” or “Contained in” spatial criterion).
The choice can be made by enabling or disabling the "Use nearest geometry" check box. If when you have selected the source layer and the layer to be related, the geoprocess is launched and you have not enabled the "Use nearest geometry" check box, a window appears in which you can select the summary functions you wish to apply for each numerical attribute of the layer to be related:
The summary functions are the same as in the “Dissolve” geoprocess:
Thus, the attributes transferred to the source layer will be the result of the summary functions selected for each numerical field. If you run the geoprocess and the “Use nearest geometry” option is enabled, this window does not appear.