Determining Spatial Relationships

Liz Sanderson
Liz Sanderson
  • Updated

Introduction

Spatial relationships (also known as predicates define how two or more spatial features interact with each other.

For example, two features might intersect each other (or not, in which case they are disjoint), they might touch each other (where the boundaries intersect, but the interiors do not), or one feature might contain a second feature (which itself is therefore within the first feature).

spatialrelationships1.png

A more complete definition of the spatial predicates supported by FME, and how they work, can be found on this page of the FME documentation .

In FME, spatial relationships are calculated with the SpatialRelator and SpatialFilter transformers.

The SpatialRelator determines relationships between features, and tags them with attributes that define those relationships. It will return a comprehensive list of all existing relationships.

The SpatialFilter also determines relationships between features; however, it only tests for a user-defined list of relationships. Features are then filtered as either a pass or a fail, depending on whether they possess a relationship of the selected type.

The SpatialFilter is the more commonly used of the two transformers because, in general, the workspace author knows what type of relationship they are looking for and wants to join/filter data on that basis.

Video

This video was taken in an older version of FME. The interface may look different, but the steps are the same.

Source Data

The source datasets for this example are building footprint polygons in AutoCAD DWG and address point features in an Esri File Geodatabase. In the FME Data Inspector, it looks like this:

spatialrelationships2.png

This example is a simple QA exercise. Each address ought to fall inside a building and this example builds a workspace to test that spatial relationship and find addresses that are not within a building footprint.

Step-By-Step Instructions

1. Start FME Workbench

Click New to start a new workbench. Select "Readers"> "Add Reader" from the menu bar.

Set the data format to Autodesk AutoCAD DWG/DXF. Select the attached DWG data as the source dataset. If prompted, select only the BuildingFootprints layer, not layer 0.

2. Add a Second Reader

Again, select "Readers"> "Add Reader" from the menu bar. This time, set the data format to Esri Geodatabase (File Geodb Open API). Select the attached Geodatabase as the source dataset. When prompted, select only the PostalAddress table, not PostcodeBoundaries.

3. Add a SpatialFilter Transformer

Connect the BuildingFootprints to the SpatialFilter Filter port and the PostalAddressTable to the SpatialFilter Candidate port. The workspace will now look like this:

spatialrelationships3.png

4. Open the SpatialFilter parameters dialog

Set the Tests to Perform parameter to Contains; i.e. we want to check if a candidate (the address points) is contained within a filter (building footprints).

Set the Filter Type to Multiple Filters; i.e. there are many building footprints to test against

Set the Pass Criteria to Pass Against One Filter; i.e. each address only has to fall inside a single building, not all of them!

spatialrelationships4.png

Those are the key parameters; the rest are less important.

5. Connect an Inspector Transformer to each of the SpatialFilter Passed and Failed ports

Also connect an Inspector to the BuildingFootprints feature type, so we can see that in the output.

Run the workspace. If you style the passed/failed features differently in the Data Inspector, they will look like this:

spatialrelationships5.png

We have clearly identified which addresses don't have the correct spatial relationship with building footprints, and can pass them on to be fixed.

There are other transformers that can be used to determine the spatial relationship or spatial join between features. The article Merging and Joining Spatial Data is a guide to the appropriate transformer

Was this article helpful?

We're sorry to hear that.

Please tell us why.

As of January 14th, 2026, comments on knowledge base articles have been closed. To make sure questions don’t get missed and to enable more community support, we’ve moved discussions to the FME Community. If you have a question or a comment about this article, please create a new post or create a support ticket.