|Exercise 7||Managing Writer Feature Types|
|Data||City Parks (MapInfo TAB)
Walking Trail (CSV)
Water Fountains (File Geodatabase)
Car Parking (OpenStreetMap)
|Overall Goal||Create a set of data for mapping a recreational event|
|Demonstrates||Adding Writer Feature Types|
Let's finish up your work on the fundraising walk project.
In this part of the project we’ll finalize the output requirements.
1) Start Workbench
Start Workbench (if necessary) and open the workspace from Exercise 6. Alternatively you can open C:\FMEData2017\Workspaces\DesktopBasic\Components-Ex7-Begin.fmw (for 2017.0) or C:\FMEData2017\Workspaces\DesktopBasic\Components-Ex7-Begin.1.fmw (for 2017.1).
2) Add Writer
If you recall, one late change was to change the writer format. The organizers have decided to go with SpatiaLite instead of KML. So add a SpatiaLite Writer with the following parameters:
|Add Feature Type(s)||Table Definition: Copy from Reader|
Click OK. When prompted select all the following reader feature types to copy onto the writer:
|If you're using FME2017.1 the dialog will show GML files for amenities and highways, rather than OSM.|
This will give a series of writer feature types. The highway_unclassified feature type isn't needed because we will write all road features to the same table.
Now all that is to do is do some schema mapping.
3) Map Schema
Make the following connections:
|FeatureTypeFilter Port||Writer Feature Type|
4) Tidy Connections
Right now some connections overlap. This isn't a good idea as it makes the workspace harder to interpret. So check the parameters for the FeatureTypeFilter. Use the arrow buttons to move feature types up and down in the list until all connections are separated out:
5) Tidy Feature Types
One last task is tidy up some of the writer feature types.
Firstly delete all writer feature types that aren't being used (RoutePoint, TrackPoint, Metadata, WayPoint, Track). You can do this using Tools > Remove > Unattached on the menubar.
Secondly rename all Writer feature types to something more user friendly, for example:
- Rename highway_primary to roads
- Rename amenity_parking to parking
- Rename CSV to trail
- Rename drinkingfountains to fountains
NB: All feature type and attribute names in SpatiaLite are lower case.
Finally let's clean up and connect some of the writer feature type attributes. The simplest way to connect most of them is to right-click a connection and choose Auto Connect Attributes:
This works because most of the attributes have the same name, just a different case, and FME can figure that out automatically. If the attributes have a completely different name, then you would have to connect them manually; or you can just delete from the writer schema any attributes we don't really need.
Re-run the workspace and examine the SpatiaLite output in the FME Data Inspector. It should look like this:
That is the end of this project. The SpatiaLite database can now be passed on to the organziers to produce the actual event map.
Oh! Now that we dropped the KML output dataset, the Python script we wrote probably won't work!
If you have time, and have experience of Python, why not edit the script to support copying the GPX and SpatiaLite output datasets to the "shared" folder?
By completing this exercise you have learned how to: