span8
span4
span8
span4
This tutorial was created using FME 2018.If you are using FME 2019.0 or newer,please see the note at the bottom of this article for how to complete this tutorial.
Tables are a useful way of displaying data and create a tidy visualization in a slideshow.This tutorial is part three of six and will look at how to create tables and write them to PowerPoint.We will be creating a table for each food type containing the business names and locations accociated with each.
Workspaces:
PowerPointWriter-3-Tables- Begin.fmwt(Beginning workspace,continuing from the previous tutorial)
PowerPointWriter-3-Tables-Complete.fmwt (Complete workspace for parts 1 and 2)
Data:
This article contains two separate parts,the first part adds data and manipulates it in preparation for the next three tutorials in the series.The second part is table creation using the PowerPointStyler.If you are only interested in the table creation,skip to Part 2 and open the PowerPointWriter-3-Tables-Part2-Begin.fmwt workspace.
1.Open starting workspace
Open the PowerPointWriter-3-Tables-Begin.fmwt workspace.This workspace is a continuation of the previous two tutorials,so you can continue with your previous workspace if you wish.Collapse the Tutorials 1 and 2 bookmark to make more space
2.Add Street Food Vendors
Now we will add the street vendor data and start building.Add aCSV (Comma Separated Value) Readerto the canvas and select Street-Food-Vendors.csv as the dataset.Set the Coord.System to LL84.In the Parameters,change the Attribute Definition to Manual.Then set the Type for LAT to y_coordinate and then for LON set it to x_coordinate.Click OK to add the reader.
CSV Parameters to change LAT and LON to y_coordinate and x_coordinate,respectively
3.Add Area of Interest
Most of the street food vendors cluster in particular areas based on the amount of foot traffic they see in a day.Those areas have been identified and put into an Excel spreadsheet.Add aMicrosoft Excel Readerto the canvas and set AreaOfInterest.xlsx as the dataset.Set the Coord.System to LL84 and then in the Parameters ensure that the Types for Longitude and Latitude are set to x_coordinate and y_coordinate,respectively.
4.Buffer Area of Interest
If you inspect the AreaOfInterest Excel feature type,you will notice that each area is only a single point feature.We will need to create a buffer so that we can encompass the street food vendors and add the area of interest attribute to them.Add aBufferertransformer after the AreaOfInterest feature type.In the parameters set the Buffer Amount to 0.0022,then set the End Cap Style to Square and the Corner Style to Miter.The Buffer Amount is dependant on the coordinate system.
Bufferer parameters: set the Bufferer Amount to 0.0022
Connect an Inspector transformer to both the Street Food Vendors feature type and the Bufferer or Run with Cached Features and inspect both outputs.We want to ensure that our buffered area encompasses enough of the street food vendors without overlapping.
Bufferer and Street Food Vendors in the Data Inspector,note that the polygons are not overlapping
5.Overlay Street Food Vendors
Now that we have decided our buffered area is large enough,we need to filter the food vendor points and add the attribute MainArea attribute.Add aSpatialFiltertransformer to the canvas and connect the Street Food Vendors to the Candidate input port and the Buffered output port on the Bufferer to the Filter input port on the SpatialFilter.
SpatialFilter connections
In the parameters for Spatial Predicates to Test enable "Filter Contains Candidate" and "Filter Intersects Candidate" then enable Merge Attributes.
SpatialFilter Parameters,set Spatial Predicates to Test and enable Merge Attributes
6.Clean up attributes
Finally,before we can create our tables,we will need to clean up the attributes.Add anAttributeManagertransformer to the canvas and connect it to the Passed output port on the SpatialFilter.Remove all the attributes except STATUS,BUSINESS_NAME,LOCATION,DESCRIPTION,and MainArea.
Then rename the following attributes:
Input Attribute | Output Attribute |
STATUS | Status |
BUSINESS_NAME | Business Name |
LOCATION | Street Location |
DESCRIPTION | Food Type |
MainArea | District |
7.Run translation
Run the translation to ensure that the attributes are set up correctly.You should have 47 point features each with an associated District.
If you did not complete Part 1,please open the PowerPointWriter-3-Tables-Part2-Begin.fmwt workspace.
1.Sort by Business Name
We want our tables to be in alphabetical order by Business Name for each of the food types.Add aSortertransformer to the canvas and connect it to the output port on the AttributeManager.In the parameters set the Sort By Attribute to Business Name then set it to Alphabetic by Ascending order.
2.Filter attributes
The PowerPointStyler only accepts attributes in the form of a list to create tables,so we will need to create a separate list for each of the food types.To do this we will first need to filter all the food types.Add anAttributeFiltertransformer to the canvas and set Attribute to Filter By to Food Type.Next click the Import button,this will open a wizard to import attributes.Set the Reader to CSV (Comma Separated Value) and the Dataset to street_food_vendors.csv,then click Next,then Next again.On the Select Attributes dialog select DESCRIPTION for Value and then click Import.This will import all of the food types into the AttributeFilter.Then click OK to close the AttributeFilter.
AttributeFilter parameters with all the Food Types imported
3.Create a list
Now we need to create the list.Add aListBuildertransformer to the canvas and connect it to the Asian Cuisine output port on the AttributeFilter.In the ListBuilder parameters change the Add to List to All Attributes and click OK.
Connect the ListBuilder to the Asian Cuisine output port on the AttributeFilter
4.Create the table
Next,add aPowerPointStylertransformer and connect it to the ListBuilder.In the parameters set the Slide Type to Table.Then for Title click on the drop-down and select _list{}.FoodType,when the List Element Selection dialog appears type 0 and click OK.
For the Table Style you can select any style you wish,but for this tutorial,we are using Themed Style 2 Accent 5.
Finally for the Table Columns set the following parameters:
Column Header | Column Values | Column Width |
Business Name | _list{}.Business Name | 3 |
Location | _list{}.Street Location | Stretch |
You can leave Slide Order as Automatic,for now,we will change that in a minute.
PowerPointStyler_5 parameters to create a table
5.Create a table for each food type
To ensure that we have a table for each food type,we will need to duplicate the ListBuilder and PowerPointStyler.Highlight the ListBuilder and PowerPointStyler and right-click Duplicate or ctrl-D,and connect the duplicated transformers to the Comfort Food output port on the AttributeFilter.
Repeat this step 6 more times until there is a ListBuilder and PowerPointStyler for each of the Food Type attributes.
ListBuilders and PowerPointStylers for each Food Type Attribute
6.Set slide order
Now to ensure that we have the slides in the appropriate order,open each of the PowerPointStylers and set their Slide Order according to the following list:
Food Type Attribute | Slide Order |
Asian Cuisine | 5 |
Comfort Food | 6 |
European Cuisine | 7 |
Hot Dogs and Drinks | 8 |
Local Meats and Seafood | 9 |
Mexican Cuisine | 10 |
Middle Eastern Cuisine | 11 |
Soup and Sandwiches | 12 |
7.Connect everything to the PowerPoint Writer
Now that everything is set up,select all of the PowerPointStylers that are connected to the ListBuilders and then add a Junction transformer,this will ensure our workspace is nice and tidy.Then connect the Junction to the PowerPoint Writer.In addition to the Junction making the workspace tidy,you can also add a bookmark around this section of transformers and collapse it to give you more space.
Run the translation and then open up the output PowerPoint.There should be eight new slides added each with their own table.
Save your workspace and then continue on to thenexttutorial,where we will be adding a bar chart to our presentation.
Asian Cuisine and Local Meats and Seafood tables viewed in Microsoft PowerPoint
Note:Sometimes table creation isn't perfect and you will need to manually adjust the sizing within PowerPoint for your final presentation.For example,the Hot Dogs and Drinks table extends pass the slide.
Additional Note: If when you open the completed PowerPoint and it is in Master View.Click the "Close Master View" button on the ribbon to return to your output.
To complete this tutorial in FME 2019.0+,the PowerPointStyler no longer requires attribute values to be in the form of a list.Skip step 3 entirely and then for step 4,just set the Column Values in the PowerPointStyler to the attributes Business Name and Food Type.
PowerPointStyler in FME 2019.0 for table creation
Updated 2019.0 Completed Workspace: PowerpointWriter-3-Tables-Complete-2019Update.fmwt
Data Attribution
The data used here originates from open data made available by theCity of Vancouver,British Columbia.It contains information licensed under the Open Government License - Vancouver.
Getting Started with the PowerPoint Writer: Custom (Advanced)
Getting Started with the PowerPoint Writer: Title and Body
Getting Started with the PowerPoint Writer: Images
Getting Started with the PowerPoint Writer: Charts
Getting Started with the PowerPoint Writer: Maps
© 2019 亚搏在线Safe Software Inc |Legal