026] Global Mapper - Spatial Operations 02: Understanding Predicates

Today, in our second session on Spatial Operations, we will explore Predicates, which offer a more granular approach than the basic operations we discussed previously.

Admittedly, there are some limitations. Since these operations typically involve only two layers at a time, you might find yourself thinking deeply when dealing with multiple layers. However, most spatial operations can be successfully performed using these methods.

1. Getting Started

First, let’s open the file we used in the last session.

Global Mapper Control Center showing various vector layers including Area, Line, and Point
lobal Mapper Control Center showing various vector layers including Area, Line, and Point


In the Control Center, you can see our sample layers: Area01, Area02, Line01, and Point01. Now, let's launch the Spatial Operations tool and navigate to the Predicates tab.

2. Understanding Spatial Predicates UI

Spatial Operations dialog with the Predicates tab selected
Spatial Operations dialog with the Predicates tab selected

The Predicates tab has a similar layout to the Operations tab we handled last time. However, it focuses on the relationship between objects rather than creating new geometries from scratch.

A. Spatial Predicates: 11 Types of Relationships

You can choose from a total of 11 relationship conditions:

Dropdown menu listing all 11 available spatial predicates
Dropdown menu listing all 11 available spatial predicates


  • Intersects: Returns features from Layer 1 that intersect with features in Layer 2.
  • Overlaps: Returns features where Layer 1 and Layer 2 partially overlap.
  • Touches: Returns features that touch only at their boundaries.
  • Contains: Returns features in Layer 1 that completely contain features in Layer 2.
  • Equals: Returns features where geometries are exactly the same.
  • Within: Returns features in Layer 1 that are completely contained within Layer 2 (The inverse of Contains).
  • Disjoint: Returns features that are completely separate from each other.
  • Crosses: Returns features that cross but only partially overlap (primarily used for linear objects).
  • Covers: Returns features in Layer 1 that cover features in Layer 2.
  • CoveredBy: Returns features in Layer 1 that are covered by features in Layer 2.
  • Relate: Performs operations by designating specific relationships using custom DE-9IM strings for complex definitions.

B. Processing Results

You can choose how to handle the output of the operation from 5 different options:

[Dropdown menu showing the five options for result processing]
Dropdown menu showing the five options for result processing
  1. Create New Selection: Makes a new selection of the resulting elements.
  2. Add to Selection: Adds the results to the current selection.
  3. Remove from Selection: Deselects elements that match the result from the current selection.
  4. Invert Selection: Selects all elements except those that match the result.
  5. Create New Layer: Generates a brand new layer containing the selected elements.

3. Hands-on Examples

Testing every single one would take too much time, so let's try a few key ones. We will test using Area01 and Line01 first.

Tip: As you use these more often, you'll get used to them. Pay close attention to which layer the selected results belong to.

[Workspace setup with only Area01 and Line01 visible for testing]
Workspace setup with only Area01 and Line01 visible for testing


Test 1: Intersects (Area vs. Line)

The Intersects predicate returns Layer 1 objects if they cross or are contained within Layer 2.

[Setting up Intersects with Layer 1 as Area01 and Layer 2 as Line01]
Setting up Intersects with Layer 1 as Area01 and Layer 2 as Line01


Set Layer 1 to Area01 and Layer 2 to Line01. Select Create New Selection and click Run.

[Visual result of Intersects showing the selected Area object]
Visual result of Intersects showing the selected Area object

The red circles in the image indicate where intersections or containment occur. The Area01 object (Layer 1) that meets these conditions has been selected.


Test 2: Intersects (Line vs. Area)

What happens if we swap the layers?

[Switching Layer 1 to Line01 and Layer 2 to Area01]
Switching Layer 1 to Line01 and Layer 2 to Area01


[Visual result showing Line objects that intersect with the Area selected]
Visual result showing Line objects that intersect with the Area selected


This time, the Line01 objects (Layer 1) that touch or are contained within Area01 (Layer 2) are selected.

Test 3: Touches

The Touches predicate selects objects that contact each other only at their boundaries.

[Setting up the Touches predicate dialog]
Setting up the Touches predicate dialog


[Visual result of Touches showing lines that contact the area boundary]
Visual result of Touches showing lines that contact the area boundary


Objects that have matching vertices or lines along the boundary are selected.

Test 4: Within

Finally, let's try Within. This selects objects in Layer 1 that are completely contained inside Layer 2. We'll use Area01 and Point01 for this.

[Setup with Area and multiple Points visible]
Setup with Area and multiple Points visible


[Setting up the Within predicate with Point01 as Layer 1]
Setting up the Within predicate with Point01 as Layer 1


[Visual result showing only points inside the area selected]
Visual result showing only points inside the area selected


As you can see, only the Point01 objects (Layer 1) that are fully inside Area01 (Layer 2) have been selected.

Advanced Tip: The "Relate" Predicate and DE-9IM

Before wrapping up, I want to briefly mention Relate. This uses the DE-9IM (Dimensionally Extended 9-Intersection Model) method. To be honest, this software is quite interesting; if you dig through the menus, you'll find all sorts of surprisingly deep functions.

[The DE-9IM Edit dialog box for defining custom relations]
The DE-9IM Edit dialog box for defining custom relations


When you select Relate, you can enter a DE-9IM String. By clicking the 'Edit' button, you can search for objects by applying nine different conditions between two geometries.

For example, the image above shows the Within condition written as a DE-9IM string. Using this method allows you to perform two or more operations simultaneously. You could, for instance, select an object that Contains another object while also Touching its boundary. In 9IM code, this would be represented as 'TFF******'.

I don't use this level of complexity often in my professional practice, so I'm not perfectly fluent in it. I'm not sure how often you'll need it in Global Mapper, but it's good to know that such a powerful feature exists.

That’s it for today!

Comments

Popular posts from this blog

001] Global Mapper - Creating DEMs