|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! You may click the Parameters buttons in the Generate Workspace dialog to check the reader/writer parameters, but none of them need changing in this exercise. Note that the writer needs only a folder and not a specific file name.
2) Rename Feature Type
FME creates a workspace where the destination schema matches the source. However, the end user of the data has requested parts of the schema are cleaned up.
Inspect the writer feature type parameters. 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:
3) Update Attributes
Now inspect the user attributes. They will look like this:
These must be cleaned up so that unnecessary information is removed. Other attributes need to be updated and some extra ones added to store the calculation results. So carry out the following actions:
|Rename Attribute||from: NeighborhoodName||to: Neighborhood|
|Change Type (VisitorCount)||from: smallint||to: integer|
|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:
Now when the workspace is run the output will be named ParksMaintenanceData.tab and will contain an updated attribute schema.
4) Un-Expose Source Attributes
The workspace will now look like this:
|Objects on the canvas 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. The brown markers around the feature types are called bookmarks. They too can be resized to better fit their contents.|
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.
Inspect the User Attributes tab on the reader feature type parameters. It will look like this:
Uncheck the check box for the following attributes, which we do not need:
This is 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. You can still run this workspace just to see what the output looks like anyway.
By completing this exercise you have learned how to: