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:\FMEData2019\Workspaces\DesktopBasic\Transformers-Ex3-Begin.fmw |
End Workspace | C:\FMEData2019\Workspaces\DesktopBasic\Transformers-Ex3-Complete.fmw |
As you know, city councillors 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 FME Workbench
Start FME Workbench (if necessary) and open the workspace from Exercise 2. Alternatively you can open C:\FMEData2019\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 Roads Data Reader
Use Readers > Add Reader to add a reader for the roads data. The roads data will be used to the determine distance from an arterial route.
Reader Format | Autodesk AutoCAD DWG/DXF |
Reader Dataset | C:\FMEData2019\Data\Transportation\CompleteRoads.dwg |
When prompted, select only the feature type called Arterial.
3) Add Zoning Data Reader
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:\FMEData2019\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 a 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.
5) Connect Tester to the 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 the 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 to the FeatureReader. Inspect the Tester:Passed and FeatureReader:PostalAddress caches to confirm that the results are correct.
For the Tester, there should be 19 features coming from the Tester:Passed output port. The FeatureReader:PostalAddress output port will now only have 1853 features, compared to the 13597 features before we filtered by zone.
7) Add a Bufferer Transformer
Now we can determine which of the filtered addresses fall within 50 meters of an arterial route. First, we will need to add a Bufferer transformer to set the 50-meter distance around the roads.
Add a Bufferer transformer to the workspace. Connect it to the Arterial roads data:
Set the Bufferer Buffer Amount parameter to be 50.
8) Add a SpatialFilter Transformer
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 the Workspace
Run the workspace by pressing F5 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.
If you have more than 148 rows in the final spreadsheet, remember to set the Excel Writer parameters to Overwrite Existing File to Yes.
CONGRATULATIONS |
By completing this exercise you have learned how to:
|