Exercise 3 | 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 |
Start Workspace | C:\FMEData2018\Workspaces\DesktopBasic\Transformers-Ex3-Begin.fmw |
End Workspace | C:\FMEData2018\Workspaces\DesktopBasic\Transformers-Ex3-Complete.fmw |
As you know, city councilors have voted to amend noise control laws and 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 meters 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 2. Alternatively you can open C:\FMEData2018\Workspaces\DesktopBasic\Transformers-Ex3-Begin.fmw
The workspace already has a FeatureReader 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 |
Reader Dataset | C:\FMEData2018\Data\Transportation\CompleteRoads.dwg |
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) |
Reader Dataset | C:\FMEData2018\Data\Zoning\Zones.tab |
With attribute lists collapsed, the workspace will now look like this:
Feel free to inspect all of the source data to familiarize yourself with the contents. You can even run the workspace to make sure all caches are up to date.
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 test with the “Begins With” operator.
Miss Vector says... |
So... why the Tester? Why not use the AttributeFilter? Do you know? |
5) Connect to FeatureReader
One way to filter data is to use a SpatialFilter transformer, and we will do this with the road features. But another method is to use filtering inside the FeatureReader transformer.
So, delete the Creator transformer and connect the Tester:Passed port to the FeatureReader:Initiator port:
6) Set up FeatureReader
Now inspect the FeatureReader's parameters. Set the Spatial Filter parameter to Initiator Contains Result:
This ensures that only addresses that fall inside a Single Family Residence zone will be read from the database. Make sure feature caching is turned on and run the workspace. Inspect the Tester:Passed and FeatureReader:PostalAddress caches to confirm that the results are correct.
7) Add Bufferer
Now we can determine which of the filtered addresses fall within 50 metres of an arterial route. This time we'll use a SpatialFilter transformer.
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 roads data:
Set the Bufferer Buffer Amount parameter to be 50.
TIP |
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. |
8) Add SpatialFilter
Add a SpatialFilter transformer. The buffered arterial routes are the Filter. The Candidate port can be connected between the FeatureReader and the AttributeSplitter:
This way the AttributeSplitter and AttributeManager are operating only on filtered features. If the SpatialFilter was connected after the AttributeManager, then data would be getting processed and then discarded.
9) Set SpatialFilter Parameters
Set up the SpatialFilter parameters as follows:
Filter Type | Multiple Filters | There are multiple buffer polygons |
Pass Criteria | Pass Against One Filter | A single address cannot be in all buffers |
Spatial Predicates to Test | Filter Contains Candidate | Find addresses contained in the arterial buffers |
That is, there are multiple road buffers, but an address only has to be inside one buffer to pass, not all of them.
10) Run Workspace
Run the workspace using Run From This on the SpatialFilter. Inspect the cached output to prove that only addresses inside both a single-family zone and a arterial road buffer have passed the filtering process.
11) Set Event Field
As a final step, open the Feature Type dialog for the Excel writer, click on the User Attributes tab, and set a fixed value for the Event field:
Turn off caching, 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.
CONGRATULATIONS |
By completing this exercise you have learned how to:
|