span8
span4
span8
span4
In this exercise,we will work through setting up a simple FME Workspace to convert a MapInfo dataset containing Parks information to Tableau's TDE format.
Source datasets:
Completed workspace:exercise1-spatialdata.fmwt
Tableau template:exercise1-tableau.zip
Start FME Workbench and click on the Generate option from the Start page.
Set up the Reader and Writer as follows:
Reader Format: | MapInfo TAB |
Reader Dataset: | ...\Parks.tab |
Writer Format: | Tableau Data Extract (TDE) |
Writer Dataset: | ...\Output\ |
Click OK to generate the workspace.
Generate workspace with an MITAB Reader and a TDE Writer
It's probably a good idea to know what we are working with here to know what to do with our data.We could install MapInfo (a GIS application) on our machines and open the file directly in it,but all we really want to do is inspect our data source here.Let's use the FME Data Inspector application to look at this MapInfo dataset.To do this click on the "Parks" Feature Type in the workspace.Then click the icon with the magnifying glass on the toolbar that appears above the feature type.
Inspect the Parks Reader
The Data Inspector application will open and show us the geometries and data inside the file we are working with.
Since we only have area features in our data source,let's remove the GeometryFilter and three non-polygon feature types that were automatically added to our workspace.
Our writer is currently set up to create a file called Parks_polygon,let's change that to something nicer.Click on the cog-wheel icon (or just double click) on the writer feature type to open the properties dialog.Change the Table name parameter.Let's set it to just 'Parks' instead.
Workspace cleaned up with Reader and Writer renamed
Click File > Save As to save a copy of the 亚搏在线workflow we have built so far.
Click the green play button in the Workbench toolbar to run our data conversion to actually create our TDE file from the MapInfo dataset.
We have been given a CSV file containing information about the locations of drinking fountains in the city and would like to find out how many fountains are in each park.The drinking fountain dataset does have a Location column,but on closer inspection,the location names there don't match up with the park names from our MapInfo dataset.The CSV file does have x,y coordinates in it,maybe we can join these datasets spatially.
Click on Readers > Add Reader and set the following:
Reader Format: | CSV (Comma Separated Value) |
Reader Dataset: | ...\DrinkingFountains.csv |
Now we will setup the parameters for the Writer.Click on Parameters...For Feature Type Name(s) select From File Name(s).Under Attributes > Attribute Definition,click on manual.Set the type for x_coord to x_coordinate and y_coord to y_coordinate.This will tell FME to display each row in the CSV as a point.Click Ok.Then set the Coord.System to UTM83-10.Click Ok to add the new reader to the workspace
Add a CSV Reader to the workspace,change Coord.System to UTM83-10
In the parameters of the CSV Reader,change the type of the x_coord and y_coord
Disable the Tableau writer feature type for now by locating it on the canvas,right-clicking on it,and selecting "Disable".Connect an Inspector transformer to the output ports on each of the readers inside the workspace.Click Run to see both datasets inside the Data Inspector Application.
Workspace with the inspectors and the Parks Writer disabled
Let's use a transformer to find the water fountain points that overlap with the park areas.
Add the PointOnAreaOverlayer transformer into the workspace.
Remove Inspectors from previous step and connect the Parks feature type to the Area input port and the CSV feature type to the Point input port.Then connect the Area output port to the TDE writer.
Access the PointOnAreaOverlayer transformer Parameters.It's currently set to create an attribute called _overlaps with a count of the number of features that overlap with each other.We'll leave that as it is for now.Click OK to close the parameters dialog.
We want to add a new column to the TDE file we create with the count of the number of fountains that were found inside each park.Open the writer feature type properties dialog.Then open the User Attributes tab to look at the columns that are currently defined on the writer.
Add the _overlaps attribute to the list of columns there.You can do this either by switching the Attribute Definition to Automatic (to automatically pick up any new attributes added to the workspace) or by setting the Attribute Definition to Manual and manually typing in the name of the attribute we want to add.
User Attributes in the Writer parameters,add the attribute _overlaps
Next,go to the Parameters table,under Table > General change Table Handling: to Drop and Create.This will tell FME to delete the existing TDE file and re-create it with the new column added.
Writer parameters,change the Table Handling to Drop and Create
Enable the Tableau writer feature type by locating it on the canvas,right-clicking on it,and selecting 'Enable'.Save the modified workspace,then Run it.
Open up your data in Tableau and experiment with how you would like to display your data.
Parks.tde opened in Tableau.Each circle is a single park.Stanley Park has the most drinking fountains,with 29.
How to Prepare Data for Tableau with FME (Processing Spreadsheets)
How to Prepare Data for Tableau with FME (Merging Multiple Spreadsheets)
Reprojection and Spatial Overlay with FME
Creating Density Maps with FME for Tableau
Creating Spider Diagrams with FME for Tableau
Tutorial: Preparing Data in FME for Tableau
Tutorial: GIS and Business Intelligence Data Wrangling
Point in Polygon Calculations with the PointOnAreaOverlayer
© 2019 亚搏在线Safe Software Inc |Legal