Topological Intersection

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

Introduction

Topological intersection is the process of intersecting multiple polygon layers. In this exercise, you will use the SpatialFilter to set a spatial predicate that will determine which polygon features are merged together. The SpatialFilter compares two sets of features to see if their spatial relationships meet selected test conditions. The features being tested (Candidate features) are identified as having Passed or Failed the test. For example, if you have a road dataset (lines), and wanted to extract all the roads that passed through parks (polygons), you would direct the roads into the Candidate input port, and the parks into the Filter input port.
 

Step-by-step Instructions

In this scenario, you want to merge the MountPleasantClipBoundary and Parks polygon features and their attributes based on the spatial predicate: “Filter OGC - Intersects Candidate.” In this case, the clip boundary is the filter because you only want to extract the park polygons that intersect the MountPleasantClipBoundary - this will also join the attributes of both features.

Sources
The first source is an Esri Shapefile containing the Mount Pleasant neighborhood boundary in the City of Vancouver. MountPleasantClipSource.png

The second source is a MapInfo TAB dataset containing parks in the City of Vancouver. 
ParkSource.png
 
1. Create a New Workspace
Open FME Workbench and create a blank workspace. 
NewWorkspace.png
 
2. Add an Esri Shapefile Reader
Add an Esri Shapefile reader to the canvas by clicking on the Reader button on the top menu bar or by going to Readers > Add Reader. In the Add Reader dialog, select Esri Shapefile as the Format, then for Dataset browse to the MountPleasantClipBoundary.shp dataset which is available for download from the Files section on this article. Then click OK to finish adding the reader.
 Shapefile.png
 
3. Add a MapInfo TAB Reader
Next, add a MapInfo TAB (MITAB) reader to the canvas, and browse to the Parks.tab dataset. 
MapInfo.png
 
4. Inspect Coordinate Systems 
Since we will be performing a spatial join, we need to ensure that both datasets are in the same coordinate system. 
Click on the MountPleasantBoundaryClip reader feature type to open the popup menu, then click on View Source Data to view the data in Visual Preview. 
ViewSource.png
 
In Visual Preview, open the Feature Information Window, and select a feature to view the Coordinate System. Repeat this step for the Parks reader feature type. 
Coord.png

The datasets are in different coordinate systems, so we need to change one so that they are the same.
 
5. Reproject Coordinates
We will reproject the MountPleasantBoundaryClip dataset. Click on the MountPleasantBoundaryClip reader feature type to select it. Then add a Reprojector to the canvas by typing “Reprojector” to bring up the list of FME Transformers in the Quick Add Search. Select the Reprojector from the list of Transformers by double-clicking or by using the arrow keys and the Enter key to add it. 
Reprojector.png
ReproConnect.png

Double-click on the Reprojector to open the parameters. In the parameters, set the Destination Coordinate System to UTM83-10, then click OK. 
ReproParams.png
 
If you were to run the workspace now and view both the reprojected datasets in Visual Preview, you will see the parks that are within the Mount Plesant neighborhood. 
ReprojectedVP.png

 
6. Add a SpatialFilter
Add a SpatialFilter to the canvas and connect the Filter input port to the Reprojector, then connect the Candidate input port to the Parks writer feature type. 
SpatialConnect.png
 
Open the SpatialFilter parameters and take note of the Spatial Predicates to Test parameter. For this example, we will use the default which is Filter OGC - Intersects Candidate. Click OK to close the parameters. 
SpatialFilterParams.png

 
7. Run Workspace
Connect an Inspector transformer to the Passed output port on the SpatialFilter. 
WOrkspace.png
 
Run the workspace by clicking on the Run button on the top toolbar, or by using Run > Run Workspace on the top menu bar. 
Run.png
 
After running the workspace, only the parks that are within/interset the MountPleasantBoundaryClip dataset will be available, and the two datasets will have their attributes merged. 
OutputVP.png
  

Data Attribution

Data used in this tutorial originates from open data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.