Spatial joins between drawings use spatial relationships between the geometry of objects in the source, joined drawing and the geometry of objects in the target, original drawing to join data into the original drawing. The Edit - Join dialog provides spatial joins between drawings that are layers in maps. Spatial joins done by the Join dialog are an easier way to accomplish classic GIS "overlay" operations. Spatial joins work between drawing layers in the same map. Layers can be in different data sources.
Overlays in ESRI nomenclature are called spatial joins in the data science / IT world, two different terms to describe exactly the same thing. The Edit - Join dialog is a more modern way to do the same jobs with easier workflow. Edit - Join, for example, updates the target table or drawing in place. Even skilled ESRI people often prefer Edit - Join.
Add fields using a spatial join:
In the upper right box choose the joined drawing in the map from which fields will be joined.
In the second row of boxes, choose the geometry fields to use and the spatial method, such as contains or contained in.
Click the Add button to choose a field in the joined drawing's table that will provide data for a new field in the original table.
Double-click a cell to edit the field name (new fields) or to choose a different source field (joined table) or to choose a different transfer method.
This example provides a drawing to drawing spatial join: Given a drawing showing circular buffer zones, and a drawing of provinces in Mexico, we explore the results of different spatial joins between the provinces and buffer zones, showing the effect of touches and contains join criteria, and the effect of different transfer options, such as union areas, copy and more.
We will work with a map that has two vector drawing layers: a drawing called Mexico that shows provinces in Mexico as polygonal areas, and a drawing called Buffers that shows circular buffers as polygonal areas. The Buffers layer has had 50% opacity set in the Layers pane, so the Mexico layer can show through the partially transparent buffer areas.
Opening the table for the Buffers drawing, we see that besides the geometry field, it has only one attribute field, a field called Buffer that gives the name of the buffer. Each buffer is an approximately circular area 280 km in radius centered on either the city of Mexico City or the city of Torreon, hence their names.
The table for the Mexico drawing in addition to the geometry field has a variety of statistics for each province.
We will join areas in the Mexico drawing into areas in the Buffers drawing. Using the traditional terminology of joins as they are done in SQL and other settings, this is a many to one join, because one buffer area has spatial interactions with many provinces, so joining many provinces into their one relevant buffer area means joining many provinces into one result.
With the focus on the Buffers layer in the open map window, we choose Edit - Join from the main menu.
In the upper right corner box, we choose Mexico as the joined drawing. We choose touches as the spatial method for the join. We want to join all provinces in Mexico which touch the buffer areas in Buffers.
Press the Add button to add a new field.
The Add button pull down menu lists all fields in the Mexico drawing. We choose Geom, since we will be joining areas.
A new line appears, with default settings, to create a new geometry field in the Buffers drawing by joining from the Geom field in the Mexico drawing. We double-click into the default name for that new geometry field, to change it to something more memorable and informative.
We change the name of the new field to GeomJoined, to remind us it is the result of a Join operation.
We click into the center box and change the transfer method to union areas. Since this join is a many to one join, that is, there could be many objects from the Mexico drawing that will end up in a single object in the Buffers drawing, we have to pick some method of aggregating those many objects into a single object.
Unioning the areas simply combines all the areas into a single area object. If the areas being unioned are contiguous, a single contiguous area will result. If they are not contiguous, a single area object will still result, but it will be a branched area with the various non-contiguous islands being branches.
We double check our work, and press Join.
Instantly, in the Buffers Table we see that a new field has appeared, called GeomJoined. It has been populated with geometry values that are areas. To see what that new field contains, we can create a drawing from it.
In the Project pane, we right-click on the Buffers Table component and in the resulting context menu we choose Create - New Drawing.
In the New Drawing dialog, we specify Joined Buffers Drawing as the name of the new drawing. We choose the GeomJoined field as the Geometry field to use.
Press Create Drawing.
We drag and drop the new Joined Buffers Drawing into our map to see what it is. To get a clearer view of it, we have turned off the Mexico layer.
There are two areas in the new drawing. Each area consists of the union of areas in Mexico that were touched by one of the buffers.
To get a clearer view of that union operation, we style the areas with transparent background color, with different colored hatched lines filling the areas. We can then turn on the Mexico layer again and see how the various province areas in Mexico correspond to the two new areas that were created by the join.
Turning the Mexico layer back on, we can see how the various provinces show through the new areas that were created.
Turning the Buffers layer back on, we can see how each province area in Mexico that was touched by a buffer has been unioned into the area for that buffer that was created by the join.
Using touches as the join criterion created unioned areas that were much larger than the buffer areas, because those buffer areas touched province areas that all together were much larger than the buffer areas. We can see a different result by repeating the operation using contains as a join criterion. A quick glance at the illustration above shows that the upper buffer zone does not fully contain any provinces, while the lower buffer zone fully contains only a few small provinces.
With the focus on the Buffers layer in the open map window, we choose Edit - Join from the main menu.
As before, in the upper right corner box, we choose Mexico as the joined drawing. We choose contains as the spatial method for the join. That will join all provinces in Mexico that each Buffer area contains.
We do not need to add a new field, because we can reuse the GeomJoined field we added earlier in this example. We double-click into the GeomJoined row where the joined field will go.
The pull down menu that appears knows that GeomJoined is a geometry field, so it offers all geometry fields in the Mexico drawing (in this case, only one field). We choose the Geom field.
We click into the center box and change the transfer method to union areas. Since this join is a many to one join, that is, there could be many objects from the Mexico drawing that will end up in a single object in the Buffers drawing, we have to pick some method of aggregating those many objects into a single object. We choose the same union areas method we chose before.
We double check our work, and press Join.
No new fields appear in the Buffers Table, but the contents of the GeomJoined field are updated. One of the records has NULL results in that field. Thinking ahead to what we will see in the map, we realize that is the record where no provinces were contained by the buffer area.
The Joined Buffers Drawing in our map automatically updates, since it is based on the GeomJoined geometry field that was updated. We can see how the small provinces fully contained by the lower buffer area have been unioned into one area object.
We can get a clearer look at that area by turning off the Mexico layer and by dragging the Joined Buffers Drawing above the Buffers layer.
For another look at the same thing we can copy the Joined Buffers Drawing, paste it and rename the copy to Joined Buffers Drawing Gray, drop that new drawing into the map, and then we can use Style to change the style of that new drawing to default gray. Turning the Mexico layer back on and setting the opacity of the Mexico layer to 15% in the Layers pane gives the above illustration.
The illustration shows more clearly the result of the contains join, with just enough of the Mexico layer showing through to understand the result of the join using contains.
We will use that new illustration to repeat the join with different transfer methods, to see what they do. Every time we do the join, the Joined Buffers Drawing Gray drawing will update to show the result, since it, too, is created from the GeomJoined geometry field in the Buffers Table. We will use touch as the join criterion, to ensure both of the buffer areas participate in the action.
With the focus on the Buffers layer in the open map window, we choose Edit - Join from the main menu. We set up the Join dialog as before, using touch, but this time we leave the transfer method at copy.
Press Join. The map immediately updates with the Joined Buffers Drawing Gray area showing the results of what was put into the GeomJoined field for each buffer area record.
The copy transfer method samples one of the resulting areas. It simply takes the first non-NULL area it encounters from the areas that are picked out by the join and copies that area into the GeomJoined field. In the illustration above, it just happened to pick out the two areas shown. When re-run, it might have picked out any of the other areas touched by the two buffer areas.
With the focus on the Buffers layer in the open map window, we choose Edit - Join from the main menu. We set up the Join dialog as before, using touch, but this time we choose center as the transfer method.
The center method aggregates areas into one object by creating the centroid (using the circle method) for the union of all areas picked out by the join. The two points that appear are not the centroids of the buffer areas, they are the centroids of what would have been created had we unioned the areas. The point for the upper buffer, for example, is offset toward the Northwest because of the larger bulk of the province that is touched in that direction, and which thus is one of the areas picked out by the join.
With the focus on the Buffers layer in the open map window, we choose Edit - Join from the main menu. We set up the Join dialog as before, using touch, but this time we choose convex hull as the transfer method.
The result is a single area object for each buffer area that is the convex hull of the areas which were picked out by the join. Since the convex hull areas are larger than the buffer areas and they are in a layer above the buffer areas, they completely hide the buffer areas underneath.
Two transfer methods that are not applicable to joins between areas are merge lines and merge points. We will try merge lines to see what that does.
The result is nothing, since there are no lines being joined. The result of the join is to put NULL into the GeomJoined field for both records in the Buffer Table. Using merge points would have the same result, so we will skip trying that transfer method.
The last transfer method in the list is union rects. With the focus on the Buffers layer in the open map window, we choose Edit - Join from the main menu. We set up the Join dialog as before, using touch, but this time we choose union rects as the transfer method.
The union rects transfer method aggregates areas into one object by unioning the areas and then creating the minimum enclosing rectangle, oriented vertically, that encloses the unioned areas.
While the geometry of joining areas is interesting and is useful, in real life workflow we often also would join another field, such as a population field.
With the focus on the Buffers layer in the open map window, we choose Edit - Join from the main menu. We set up the Join dialog using contains as the join criterion and union areas as the transfer method for joining the Geom field from Mexico.
We press the Add button to add a new field, adding a field we call HouseholdsJoined which accepts the sum of Households joined from the Mexico table.
In addition to combining all the provinces which the buffer area contains, we will also sum the number of households in those combined areas to get a total number of households for the unioned area.
The visual result, as before, is a single area that is the union of all of the small provinces that the lower buffer area contains.
In addition, a new HouseholdsJoined field appears in the Buffer Table, and it gives the sum of households in all the provinces that were unioned together.
Terminology - The original table also may be called the target table, and the table providing data also may be called the source table.
Quick reference - With the Join dialog open, press F1 to open a quick reference guide in a browser window.
Guessing the key field - When we launch the dialog with an original field and when we choose a joined field, the dialog will try to guess what fields we might want to use as key fields and will load those first by default. If it guesses wrong, we can choose the field we want. For the original table, the dialog tries to use a field (other than mfd_id) that has a BTREE / BTREENULL index, with a data type preference for numbers, then text, then everything else, and a name preference for field names with id in them, such as ... id or ..._id, then ...id and then everything else. For the joined table, the dialog uses similar logic, but first tries to use a field with the same name as in the original table.
Added fields are static - Added fields are static, that is, if data in the joined table changes the fields in the original table that received data in the Join operation from the joined table will not automatically be updated. We can easily update the table any time we want using a saved update query.
Spatial joins are automatically parallel - Joining data between drawings uses parallel GeomOverlay function variants. Joins from images to drawings are parallelized through a nested SELECT using THREADS.
Two meanings of "intersect" - There are two notions of what "intersect" should mean, both of which are used by Manifold. Topology overlays, as discussed in the Topology Overlays topic, use the classic set-theoretic meaning of "intersect," in which objects that are entirely contained by other objects are said to intersect as well. A different meaning is used in Select pane templates and spatial joins in Join, where an object that is entirely contained within another object does not "intersect" that object but is contained by that object. In the Join dialog and in Select pane templates, an object only intersects another object if some part of the object is outside the other object and some part is within the other object. This allows the use of contained and containing to provide different selection criteria instead of simply duplicating what intersect does in a selection.
See the Join Videos list of videos showing how to use the Join dialog.
Editing and Combining Data
Editable Results Tables