Exercise 2 | Adding Readers |
Data | City Parks (MapInfo TAB) Walking Trail (CSV) |
Overall Goal | Create a set of data for mapping a recreational event |
Demonstrates | Readers and Reader Parameters |
Start Workspace | C:\FMEData2016\Workspaces\DesktopBasic\Components-Ex2-Begin.fmw |
End Workspace | C:\FMEData2016\Workspaces\DesktopBasic\Components-Ex2-Complete.fmw |
Let's continue your work on the fundraising walk project.
In case you forgot, the city is hosting a fundraising walk for a major charity and you have been tasked with using FME to put together the data that will form the event map.
In this part of the project we’ll add another of the source datasets to the workspace as a Reader. This format will need close inspection of the Reader parameters to make sure we're reading the data correctly.
1) Start Workbench
Start Workbench (if necessary) and open the workspace from Exercise 1. Alternatively you can open C:\FMEData2016\Workspaces\DesktopBasic\Components-Ex2-Begin.fmw
2) Add Reader
The existing workspace already has a Reader for MapInfo (parks) data. Now let's add one for the most important dataset - the walk trail. This was walked by a colleague and captured on his GPS device.
Select Readers > Add Reader from the menubar in Workbench. When prompted fill in the following details (but don't press OK):
Reader Format | CSV (Comma Separated Value) |
Reader Dataset | C:\FMEData2016\Data\GPS\WalkingTrail.csv |
Now press the Parameters button. This brings up a parameters dialog that is rather large and looks like this:
The dialog includes various parameters for this Reader and a preview of what the source dataset looks like. By default the Separator Character should be a comma (change it to a comma if it is not) and the File Has Field Names parameter should be turned on.
In the lower part of the dialog - under Schema Attributes - change the type of the Latitude attribute to a Y_Coordinate and the Longitude attribute to an X_Coordinate:
By setting these parameters FME will convert the plain-text CSV data into true spatial features. Click OK to close this dialog and OK again to close the Add Reader dialog.
Mr. Statistics-Calculator says... |
Some things just won't wait. It's important to set these parameters now as they affect how the schema is depicted on the canvas. If I mess this up I'd have to delete the Reader and re-add it. That's not an efficient use of time and resources. |
3) Check Reader Parameters
Locate the Reader in the Navigator window and expand the list of parameters to see what there is:
Notice that some of the parameters we set earlier are no longer available. That's because they specified how to define the feature type schema, and it's too late to set them now.
Other parameters we could set, but don't really need to (the data should already be sorted in the correct order, for example, so we don't need to apply the sort parameter).
4) Add Reprojector
The one issue with the CSV data is that it is in a Latitude/Longitude coordinate system, and not the same UTM system as used by the parks data. Let's fix that by adding a Reprojector transformer to the workspace:
Open the Reprojector parameters dialog and set it to reproject from LL83 to UTM83-10
5) Run Workspace
Feel free to add Inspector transformers and run the workspace to inspect what we have created so far.
Tiles Courtesy of MapQuest
CONGRATULATIONS |
By completing this exercise you have learned how to:
|