|Exercise 2||Noise Control Laws Project (Spatial Filtering)|
|Data||Addresses (File Geodatabase)
Zoning (MapInfo TAB)
Roads (AutoCAD DWG)
|Overall Goal||To find all residential addresses within 50 meters of an arterial highway|
|Demonstrates||Methods of conditional filtering|
As you know, city councillors have voted to amend noise control laws and local residents living in affected areas must be informed of these changes.
You have been recommended by your manager to take on the task and there's a tight deadline.
In the first part of the project you created a workspace to convert addresses from Geodatabase to Excel, mapping the schema at the same time.
This exercise is the second part of the project: locating all affected residents. You must locate all single-family residences within 50 metres of a major highway and filter out all others from the stream of address data.
1) Start Workbench
Start Workbench (if necessary) and open the workspace from Exercise 1. Alternatively you can open C:\FMEData2017\Workspaces\DesktopBasic\Transformers-Ex2-Begin.fmw
The workspace already has a reader to read addresses, transformers to edit the address schema, and a writer to write data to an Excel spreadsheet.
2) Add Reader (Roads data)
Use Readers > Add Reader to add a reader for the roads data. The roads data will be used to determine distance from an arterial route.
|Reader Format||Autodesk AutoCAD DWG/DXF|
When prompted, select only the feature type (layer) called Arterial.
3) Add Reader (Zoning data)
Use Readers > Add Reader to add a reader for zoning data. The zoning data will be used to determine whether an address is single-family residential or not.
|Reader Format||MapInfo TAB (MITAB)|
Ensure the feature types on the canvas are laid out in the order Arterial - Zones - PostalAddress; with attribute lists hidden the workspace will now look like this:
Feel free to inspect all of the source data to familiarize yourself with the contents.
4) Add Tester Transformer
Add a Tester transformer to the Zoning feature type.
This Tester will be used to filter residential zones from the other zoning areas. All single-family residential zones will start with RS, so the Tester should be set up like this:
The important thing is to set up the tests using the “Begins With” predicate.
|Miss Vector says...|
|So... why the Tester? Why not use the AttributeFilter? Do you know?|
5) Add SpatialFilter
Add a SpatialFilter transformer to the workspace. This will be used to test each address to show whether that address falls inside one of the filtered residential zones.
- Connect the Tester:Passed output to the SpatialFilter:Filter port
- Connect the AttributeManager:Output port to the SpatialFilter:Candidate port
6) Set up SpatialFilter
Set up the SpatialFilter parameters as follows:
|Filter Type||Multiple Filters||There are multiple zoning areas|
|Pass Criteria||Pass Against One Filter||A single address cannot be in all zones|
|Spatial Predicates to Test||Filter Contains Candidate||Find addresses that the zones contain|
7) Add Inspectors
Now let's test what we have so far. Add Inspectors to the SpatialFilter Passed and Failed output ports, and the Tester:Passed port.
Save and run the workspace. Inspect the output to prove that it has worked as expected. The only area features will be the residential zones, and SpatialFilter:Passed (address) features will fall inside these areas.
8) Add Bufferer
Now we can determine which of the filtered addresses fall within 50 metres of an arterial route.
The SpatialFilter does not have a test for "within X distance" therefore we'll have to set that up a little differently. Add a Bufferer transformer to the workspace. Connect it to the Arterial roadsdata:
Set the Bufferer Buffer Amount parameter to be 50.
Optionally you can add a Dissolver transformer after the Bufferer, to merge all the buffer features together.
The results of the translation will be the same (in terms of addresses selected) but the data will look better in the FME Data Inspector.
9) Add SpatialFilter
Add a second SpatialFilter transformer. The buffered arterial routes are the Filter. The prefiltered addresses are the Candidates:
As before, set the parameters to test for candidates contained by a filter, using multiple filters but only a single pass is required.
10) Run Workspace
Attach some Inspector transformers to show you the output from various transformers. Save and run the workspace. The output (zoomed in) should look like this:
11) Connect Output
As a final step, reconnect the Excel spreadsheet output, and set a fixed value for the Event field:
Re-run the workspace and check the output to confirm the dataset has been written correctly. There should be 148 records in the spreadsheet, ready to send to the administration department for a bulk mailing.
By completing this exercise you have learned how to: