Exercise 1 | Grounds Maintenance Project - Schema Editing |
Data | City Parks (MapInfo TAB) |
Overall Goal | Calculate the size and average size of each park in the city, to use in Grounds Maintenance estimates for grass cutting, hedge trimming, etc. |
Demonstrates | Structural Transformation, Schema Editing |
Start Workspace | None |
End Workspace | C:\FMEData2017\Workspaces\DesktopBasic\Transformation-Ex1-Complete.fmw |
You have just landed a job as technical analyst in the GIS department of your local city.
The team responsible for maintaining parks and other grassed areas needs to know the area and facilities of each park in order to plan their budget for the upcoming year. You have been assigned to this project and will use FME to provide a dataset of this information.
The first step in this example is to rename existing attributes and create new ones in preparation for the later area calculations.
1) Start Workbench
Use the Generate Workspace dialog to create a workspace using these parameters:
Reader Format | MapInfo TAB (MITAB) |
Reader Dataset | C:\FMEData2017\Data\Parks\Parks.tab |
Writer Format | MapInfo TAB (MITAB) |
Writer Dataset | C:\FMEData2017\Output\Training |
Yes! Here we write back to the same format of data we are reading from!
2) Update Attributes
FME creates a workspace where the destination schema matches the source. However, the end user of the data has requested the attributes get cleaned up so that unnecessary information is removed. Also others need to be renamed and some extra ones added to store the calculation results.
Click the writer feature type to have its parameters appear in the Parameter Editor window (or open the Feature Type Properties dialog by clicking the feature type's Properties button). Click the User Attributes tab to open a list of the destination attributes. The Parameter Editor dialog will look like this:
In turn, carry out the following actions:
Delete Attribute | RefParkID | |
Delete Attribute | EWStreet | |
Delete Attribute | NSStreet | |
Delete Attribute | DogPark | |
Delete Attribute | Washrooms | |
Delete Attribute | SpecialFeatures | |
Rename Attribute | from: NeighborhoodName | to: Neighborhood |
Add Attribute | ParkArea | type: Float |
Add Attribute | AverageParkArea | type: Float |
...and click the Parameter Editor "Apply" button. The attribute list should now look like this:
3) Rename Feature Type
Now click back on the Parameters tab.
Click in the field labelled Table Name (remember this label is format-specific and in MapInfo we deal with "tables") and change the name from Parks to ParksMaintenanceData.
Don't forget to click the Apply button to accept these changes.
Now when the workspace is run the output will be named ParksMaintenanceData.tab and will contain only the specified attributes.
4) Un-Expose Source Attributes
The workspace will now look like this:
TIP |
Feature type objects can be resized (as in the above screenshot) if the feature type name or attribute names are too large to be displayed properly at the default size. |
Notice there are several source attributes that are not going to be used in the workspace or sent to the output. We can tidy the workspace by hiding these.
Display the feature type properties for the reader (either the Properties dialog or in the Parameter Editor window) and click the User Attributes tab to open a list of the source attributes. It will look like this:
Uncheck the check box for the following attributes, which we do not need:
- RefParkID
- EWStreet
- NSStreet
- Washrooms
- SpecialFeatures
This is basically the list of attributes we deleted, except for DogParks, which we will make use of in the translation.
Click Apply/OK to confirm the changes.
5) Save the Workspace
Save the workspace – it will be completed in further examples. It should now look like this:
Police Chief Webb-Mapp says... |
Some Writer attributes (ParkArea and AverageParkArea) have red connection arrows because there is nothing yet to map to them, while another (Neighborhood) is just unconnected.
That's OK. I'll let you off with a caution if you promise to connect them later. And you can still run this workspace just to see what the output looks like anyway. |
CONGRATULATIONS |
By completing this exercise you have learned how to:
|