span8
span4
span8
span4
In this demo,we will take a large dataset,transpose the attributes then create a new output with a selection of attributes.We will start with a large Excel document containing population statistics from the City of Vancouver,and transpose the data to restructure it.As we are only interested in the population totals,we will select only the statistics of interest.Then we will rename the attributes and write the data to CSV.
Optional data for overlay:local-area-boundary-shp.zip
An excel file containing 2011 population census statistics from the City of Vancouver.
CensusLocalAreaProfiles2011.xlsviewed in Excel.
1.Read in the source data,CensusLocalAreaProfiles2011.xls,using the Excel Reader.UnderParameters,集Field Names Rowto 5 andCell Rangeto 6:.
Excel Reader parameters.
2.Inspect the data with the Data Inspector.We want to make the columns into rows to make the data easier to work with.In this example,we are only interested in thepopulation totals,not everything,as that would be a lot of data.
Excel file viewed in Data Inspector,with one population total highlighted.
3.To get only the total statistics,add a Tester transformer.Set theTest Clausesto:
Left Value | Operator | Right Value |
A | Begins With | Total |
Tester parameters to filter out the statistics totals.
4.To the Tester Passed port attach anAttributeExploder.Open up the parameters for AttributeExploder,change Keep Attributes to Yes.The AttributeExploder will help us turn the attribute names (columns) into attribute values (rows).It creates one feature for each attribute value from the spreadsheet with a new pair of attributes (attribute name/attribute value).Attribute names become attribute values.
5.Add an AttributeKeeper,as we only want to keep a selection of attributes.Set Attributes to Keep toA,which represents statistic type,_attr_name,which represents the Vancouver area boundaries,and_attr_value,which represents the population totals.
6.Another Tester is used to filter out the unwanted attribute values such as format attributes.
Test Clauses:
Left Value | Operator | Right Value |
_attr_name | Begins With | xlsx_ |
_attr_name | Begins With | fme_ |
_attr_name | Like | A |
7.Connect an AttributeManager to the Failed output port of the Tester.The attributes are given more descriptive names in the AttributeManager:
Ais renamed toStatTypeas it represents statistic type
_attr_nameis renamed toAreaNameas it represents the Vancouver area boundaries
_attr_valueis renamed toStatValueas it represents the population totals
AttributeManager parameters.
8.The AttributeFilter filters attributes byAreaName.ForPossible Attribute Values,please addCMA of VancouverandVancouver CSD (City).This will filter out statistics from the whole city of Vancouver,as we are only interested in Vancouver area boundaries.
AttributeFilter parameters.
9.Add a CSV Writer,specifying an output dataset location and settingCSV File DefinitiontoAutomatic.Attach the writer feature type to the AttributeFilter
Output CSV file viewed in Data Inspector
Tutorial: GIS and Business Intelligence Data Wrangling
Testing with If-Then Conditional Statements
Build Records from Name - Value Lists
Reprojection and Spatial Overlay with FME
Creating Lists Using Transformers
ExpressionEvaluator (2014 SP4 or earlier)
Creating Density Maps with FME for Tableau
© 2019 亚搏在线Safe Software Inc |Legal