026] How to Use Spatial Predicates in Global Mapper for GIS Analysis

Define topological relationships and filter vector data using spatial logic.

This tutorial covers the Predicates tab within Global Mapper's Spatial Operations tool. You will learn how to use 11 different spatial relationship conditions—such as Intersects, Touches, and Within—to select or create data based on how layers interact geometrically. We also introduce the advanced DE-9IM "Relate" method for complex spatial queries.

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. Because these operations usually work between only two layers at a time, managing complex multi-layer relationships can become challenging. Even so, most spatial analysis tasks can still be performed effectively using these methods.

Loading Sample Layers for Spatial Predicate Analysis

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
img 1 : Global 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.

Understanding Spatial Predicates in Global Mapper

Spatial Operations dialog with the Predicates tab selected
img 2 : 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
img 3 : 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
img 4 : 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.

Spatial Predicate Examples in Global Mapper

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
img 5 : Workspace setup with only Area01 and Line01 visible for testing

How the Intersects Predicate Works in Global Mapper

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
img 6 : 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
img 7 : 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.


Changing Layer Order in Spatial Predicate Operations

What happens if we swap the layers?

Switching Layer 1 to Line01 and Layer 2 to Area01
img 8 : Switching Layer 1 to Line01 and Layer 2 to Area01
Visual result showing Line objects that intersect with the Area selected
img 9 : 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.

Using the Touches Predicate for Boundary Detection

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

Setting up the Touches predicate dialog
img 10 : Setting up the Touches predicate dialog
Visual result of Touches showing lines that contact the area boundary
img 11 : Visual result of Touches showing lines that contact the area boundary

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

Selecting Features with the Within Predicate

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
img 12 : Setup with Area and multiple Points visible
Setting up the Within predicate with Point01 as Layer 1
img 13 : Setting up the Within predicate with Point01 as Layer 1
Visual result showing only points inside the area selected
img 14 : 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.

Using DE-9IM and the Relate Predicate in Global Mapper

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
img 15 : 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******'.

When to Use Each Spatial Predicate in GIS Workflows

Choosing the appropriate spatial predicate depends on the type of spatial relationship you want to analyze. The table below summarizes some of the most commonly used predicates and their typical GIS applications.

Predicate Best Use Case
Intersects Detect overlapping or intersecting features
Touches Analyze shared boundaries between geometries
Within Perform point-in-polygon or containment analysis
Contains Identify areas that completely contain other features

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!

Continue Learning
Explore complete tutorial collections for CityEngine and Global Mapper.

Comments

Popular posts from this blog

029] How to Split Polygon Areas with Intersecting Lines in Global Mapper

[008] How to Understand CGA Rule Structure in CityEngine (Beginner Guide)

046] How to Create Parallel Offset Lines in Global Mapper