Determining Spatial Relationships

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2016.x


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).


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 full list of relationships that exist.

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

The SpatialFilter is the more 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.



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:


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 and begin with an empty canvas

Select Readers > Add Reader from the menubar.

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. Again, select Readers > Add Reader from the menubar

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:


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!


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:


We have clearly identified which addresses don't have the correct spatial relationship with building footprints, and can pass them on to by 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?



Please sign in to leave a comment.