Polygon Within a Distance of Selected Features

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2022.0

Introduction

Typically select by location is done using a graphical user interface like ArcMap or QGIS. However, in FME you can perform the same task by querying your data with a Tester to “select” the desired feature(s), then select the features that pass the query using the NeighborFinder.
 

Step-by-step Instructions

In this scenario, you will learn how to query the school's dataset in order to select parcel polygons within 200m of King George Secondary and Henry Hudson Elementary.

Sources
The first source is a feature class from the Community geodatabase and contains schools in the City of Vancouver. 
SchoolsSource.png

The second source is an Esri Shapefile containing parcel polygons in the City of Vancouver. 
ParcelSource.png

1. Create a New Workspace
Open FME Workbench and create a blank workspace. 
NewWorkspace.png
 
2. Add an Esri Geodatabase (File Geodb Open API) Reader
Add an Esri Geodatabase (File Geodb Open API) 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 Geodatabase (File Geodb Open API) as the Format, then for Dataset browse to the Community.gdb dataset which is available for download from the Files section on this article. Then click OK. 
Geodb.png

In the Select Feature Type dialog, select Schools, then click OK to finish adding the reader. 
SelectFT.png
 
3. Add Parcels Esri Shapefile Reader
Next, add an Esri Shapefile reader to the canvas and browse to the Parcels.shp dataset. 
Shape.png
 
4. Filter Schools
Now we need to filter for the schools we are interested in. Click on the Schools reader feature type to select it. Then add a Tester to the canvas by typing “Tester” to bring up the list of FME Transformers in the Quick Add Search. Select the Tester from the list of Transformers by double-clicking or by using the arrow keys and the Enter key to add it. 
QuickAdd.png

 

Double-click on the Tester to open the parameters. In the parameters, we need to set up an OR test for the two schools. Click in the box below Left Value to show the drop-down button, then click on the drop-down button and select the school_name attribute. Next, set the Operator to Begins With, then for Right Value type in King George. On the next create the following test: 

School_name Begins With Henry

Finally, change the Logic to OR. 
Tester.png
 
5. Find Neighboring Parcels
Add a NeighborFinder to the canvas and connect the Candidate input port to the Tester Passed output port. Then connect the Base input port to the Parcels reader feature type. This will result in the connection lines crossing. To fix this, right-click on the Base port and select Move Down. 
MoveDown.png
Connection.png

 
In the NeighborFinder parameters, set the Maximum Distance to 200. This value is in map units, but since our coordinate system is UTM83-10, the units are in meters. 
NeighborFinder.png
 
6. Run Workspace
Connect an Inspector transformer to the MatchedBase output port on the NeighborFinder. 
Inspector.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, the polygons that are within a maximum of 200 meters around each school will be selected. 
Output.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.