|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|
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)|
|Writer Format||MapInfo TAB (MITAB)|
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.
Open the Feature Type Properties dialog for the writer feature type by clicking the Properties button. Click the User Attributes tab to open a list of the destination attributes. It will look like this:
In turn, carry out the following actions:
|Rename Attribute||from: NeighborhoodName||to: Neighborhood|
|Add Attribute||ParkArea||type: Float|
|Add Attribute||AverageParkArea||type: Float|
After these edits the attribute list should look like this:
3) Rename Feature Type
Now click back on the General 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.
Click OK to accept these changes.
Now when the workspace is run the output will be named ParksMaintenanceData.tab
4) Un-Expose Source Attributes
The workspace will now look like this:
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.
Open the Feature Type Properties dialog for the Reader feature type by clicking the Properties button. 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:
This is basically the list of attributes we deleted, except for DogParks, which we will make use of in the translation.
Click OK to close the dialog.
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.
By completing this exercise you have learned how to: