FME Version
Files
Introduction
When assessing spatial relationships, a common scenario is finding out whether one feature is within X distance of another feature; for example, is there a fire station/hall within 5km of a planned fireworks factory.
FME has several transformers that assess spatial relationships when features physically overlap (inside, outside, intersect, match, etc) but no specific transformer to find relationships within X distance.
Therefore the solution is to create a buffer of X distance around one of the features and then carry out a standard spatial overlay of the two datasets.
Video
The video was filmed using an older version of FME. The concepts are the same, but the interface may appear different.
Step-By-Step Instructions
The scenario here is that these properties are for sale, and as a member of the municipal GIS team, we have to tell prospective buyers if a property is within 25 meters of a snow removal route.
Source Data
The first source dataset for this example is a set of lines (in a SpatiaLite database) representing roads that are snow removal routes; i.e. roads that have parking restrictions during winter so that snow can be cleared more efficiently. The second dataset (in GML format) is a set of point features that represent addresses.
1. Create a New Workspace
Open FME Workbench and create a blank workspace.
2. Add a SpatiaLite Reader
Add a SpatiaLite 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 SpatiaLite as the Format, then for Dataset, browse to the snowremovalroutes.sl3 dataset, which is available for download from the Files section on this article. Then click OK to finish adding the reader.
3. Add a GML Reader
Add another reader to the canvas. This time set the Format to OGC GML (Geography Markup Language), then browse to the HouseInquiries.gml dataset.
4. Create Buffer
Click on the snowremovalroute reader feature type to select it. Then add a Bufferer transformer to the canvas by typing “Bufferer” to bring up the list of FME Transformers in the Quick Add Search. Select the Bufferer 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 Bufferer to open the parameters. In the parameters, set the Buffer Distance to 25, then set the Bufferer Distance Units to Meters. Click OK to close the parameters.
5. Create Spatial Filter
Next, add a SpatialFilter to the canvas and connect the Filter input port to the Bufferer Buffered output port, and then connect the Candidate input port to the HouseInquiries reader feature type.
In the SpatialFilter parameters, click on the ellipsis next to Spatial Predicates to Test, uncheck any of the selected options, then select Filter OGC-Contains Candidate. This will now assess whether each candidate (property address) is contained by the buffered area of a snow removal route.
6. Run Workspace
Connect an Inspector transformer to the SpatialFilter Passed output port. Optionally, connect Inspectors to the Bufferer and the HouseInquiries reader feature type.
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, in Visual Preview, you can see that the procedure has successfully picked out which addresses are (and which are not) within 25 meters of a snow removal route.
Data Attribution
The data originates from open data made available by the City of Vancouver, British Columbia. It contains information licensed under the Open Government License - Vancouver.
Comments
0 comments
Please sign in to leave a comment.