Exercise 2 Methodology
Data Addresses (Esri Geodatabase)
Crime Data (CSV - Comma Separated Value)
Parks (MapInfo TAB)
Overall Goal Work on Vancouver Walkability Project
Demonstrates Methodology Best Practice
Start Workspace C:\FMEData2018\Workspaces\DesktopBasic\BestPractice-Ex2-Begin.fmwt
End Workspace C:\FMEData2018\Workspaces\DesktopBasic\BestPractice-Ex2-Complete.fmwt

Continuing from the previous exercise, you have been assigned to a project to calculate the "walkability" of each address in the city of Vancouver. Walkability is a measure of how easy it is to access local facilities on foot. The initial workspace analyzed crime in the area, and you added a section to calculate the distance to the nearest park.

Now we can extend the project to see if each address falls inside a noise-control area.



1) Add Reader
Our first task is to read noise-control area data. This can be found in the following dataset:

Reader Format OGC GeoPackage
Reader Dataset C:\FMEData2018\Data\Planning\PlanningRestrictions.gpkg

We'll try to improve performance by using a FeatureReader transformer to read this data, using the Addresses as a trigger; so place a FeatureReader transformer and connect it up to the AttributeRenamer.

Inspect the transformer's parameters. Set the Reader parameters as above. Read only the NoiseControlArea feature type and set the Spatial Filter parameter to Initiator is Within Result:

Reading the data this way may benefit performance because we're only reading noise control areas that we know addresses fall inside. We'll see...


2) Overlay Addresses and Noise Control Zones
To do the overlay, add a PointOnAreaOverlayer transformer. Connect FeatureReader:<Initiator> to the Point input port, and FeatureReader:NoiseControlArea to the Area input port:

Inspect the parameters and turn on the Merge Attributes option. Run the workspace using Run to This; sadly the workspace takes a long time to run, so press the Stop button to cancel the translation.


3) Add Creator
It's clear that the current setup is not the best solution. A polygon feature is output from the FeatureReader for every address that overlaps it, causing the PointOnAreaOverlayer to slow down. Our gamble has failed.

So, add a Creator transformer to trigger the FeatureReader, and disconnect it from the AttributeRenamer, leaving other connections intact:

Check the FeatureReader parameters and reset the Spatial Filter parameter to <No Spatial Filter>.

Now re-run this part of the workspace and inspect the output to ensure some address features are receiving AreaID, AreaName, and AreaDescription attributes.


4) Set a Numeric Value
To help with assessing walkability, we'll give each different zone a numeric value, relative to the benefit they would provide residents walking through the city:

Schedule F 50
Schedule C 200
Intermediate 100

One technique would be to use Tester and AttributeCreator transformers, like so:

However, this is a case of duplication. This approach is hard to maintain; each new schedule would require an additional Tester/AttributeCreator combination.

So, instead of that place an AttributeValueMapper transformer connected to the PointOnAreaOverlayer:Point output port:

Inspect the AttributeValueMapper's parameters. Set it up to map from AreaName to NoiseZoneScore, with a default value of zero (0):

Now set up the mapping using the values in the table shown above:

You can either set this up manually (by typing in the values) or automatically (by using the Import button).

Put a bookmark around this section of the workspace and run it. Inspect the cached results to prove that addresses are being given the correct value.


5) Clean Output
Because there are so many excess attributes cluttering the display, inspecting the output becomes hard. These attributes can hardly be helping the performance of the workspace either - even if that's mitigated by using caches during development.

Check the size of the template file BestPractice-Ex2-Begin.fmwt. You'll see that it is nearly 46mb in size, which is fairly large for a template. Save the workspace now, and the file would likely be even larger. It's not a problem to have a large template file, but it does indicate a lot of data is being cached and that this could affect the workspace's performance.

One aspect of data is the number of attributes and lists. To remove some of this excess information, place an AttributeRemover transformer at the end of the workspace.

Inspect its parameters and set them up to remove any attributes and lists that you suspect are not required in the output.

One item of interest is a list attribute called CrimeList{}, which doesn't appear necessary for any part of this translation. Track down its source by pressing Ctrl+F and searching for that phrase. You will find it is being created by the Aggregator transformer.

Check the parameters for the Aggregator transformer and turn off the Generate List parameter, to prevent the list from being created. This step will cause many caches to become stale, but we will re-run the workspace shortly to solve this.


5) Collapse Bookmarks
Another source of excess caching are transformers producing output that we don't need to inspect. These can be prevented by hiding these transformers within a collapsed bookmark.

So, pass through the workspace collapsing bookmarks where we know the transformers within it are producing the correct output:

You may wish to rename some of the ports on the bookmarks to clarify what they do:


6) Re-Run Workspace
Now re-run the workspace by clicking on the AttributeRemover and choosing Run to This.

The workspace will run and data will be cached, but only at the output point of bookmarks. Also attributes unnecessary to the output will be removed.

Save the workspace as a new template and check the option to include caches. This way the workspace will be ready to continue later.

Check the file size of the new template. It should be considerably smaller (around 14mb).


CONGRATULATIONS
By completing this exercise you have learned how to:
  • Assess reader performance and when the FeatureReader is not a good choice
  • Avoid duplicating transformers to improve maintenance and scalability
  • Remove unnecessary attributes to improve performance
  • Track down unnecessary lists and remove them
  • Improve performance by collapsing bookmarks to prevent excess caching

results matching ""

    No results matching ""