Polygon Within a Distance of Selected Features

Liz Sanderson
Liz Sanderson
  • Updated

FME Version

  • FME 2022.0


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.

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

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

1. Create a New Workspace
Open FME Workbench and create a blank workspace. 
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. 

In the Select Feature Type dialog, select Schools, then click OK to finish adding the reader. 
3. Add Parcels Esri Shapefile Reader
Next, add an Esri Shapefile reader to the canvas and browse to the Parcels.shp dataset. 
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. 


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

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. 
6. Run Workspace
Connect an Inspector transformer to the MatchedBase output port on the NeighborFinder. 
Run the workspace by clicking on the Run button on the top toolbar, or by using Run > Run Workspace on the top menu bar. 
After running the workspace, the polygons that are within a maximum of 200 meters around each school will be selected. 


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?



Please sign in to leave a comment.