span8
span4
span8
span4
A common GIS operation is to merge (or dissolve) polygons together;for example two (or more) polygons have their shared boundary removed to become a single polygon.
For example, I might have a dataset of polygons representing the provinces of Canada.I want to dissolve them together in order to get a single polygon representing Canada as a whole.
The transformer to carry out this operation in FME is called the Dissolver.Often polygons need to be dissolved according to some attribute value and the "Group-By" parameter in the Dissolver allows this to happen.
Note that polygons do not have to have exact boundaries to be dissolved.It is equally possible to dissolve polygons whose boundary overlaps;either those whose boundaries naturally overlap, or those whose boundaries are meant to coincide but are badly defined.
The source datasets for these examples are an Excel spreadsheet of election results and a polygon dataset in GML format representing election boundaries.
This example will merge the election results onto the election boundaries so that neighboring boundaries won by the same candidate/party can be dissolved together.
1.Start FME Workbench and begin with an empty canvas.Select Readers > Add Reader from the menubar.
Set the data format to GML (Geography Markup Language).Select the attached GML file as the source dataset.When prompted select only the VotingDivisions feature type (layer) to add to the workspace.
2.Once more select Readers > Add Reader from the menubar.This time set the format to Microsoft Excel and select the attached Excel file as the source.When prompted, select only the PartyResults sheet to add to the workspace.
3.Add a FeatureMerger transformer to the workspace.Connect the VotingDivisions feature type to the Requestor port and the PartyResults feature type to the Supplier port:
Open the parameters dialog and select the Division attribute under the Requestor and Supplier Join attributes:
This will merge all of the attributes from the PartyResults table (Supplier) on to the VotingDivision polygons (Requestor) where the Division attribute is a match.
4.We'll want to inspect the output of the Dissolver in a way that each party's wins are colored differently, so add a FeatureColorSetter transformer connected to the FeatureMerger:Merged port.
Open the parameters dialog.设置随机并设置Randomi的配色方案ze Based On parameter to "Attributes".Select the Winner attribute (which was copied from the PartyResults table) as the attribute to randomize by:
This will color each polygon the same where it was won by the same party.
5.Attach an Inspector transformer and run the workspace.You should find each polygon is colored according to the winner, but adjacent polygons of the same color are not (yet) merged:
6.Now add a Dissolver transformer into the workspace, before the FeatureColorSetter:
Open the parameters dialog.Under the Group-By parameter select the Winner attribute.This will ensure that polygons are only merged where the value of the Winner attribute is a match.
Under the Attributes to Sum parameter select the attributes Party1, Party2, Party3.These attributes represent the number of votes per area, per party.By selecting them here the votes of each dissolved polygon will be added together.
Re-run the workspace.The result will now look like this:
Notice that adjoining areas - where they were won by the same party - have been dissolved together.Also notice that the number of votes for each party in each dissolved area have been added together to provide a new value for the single dissolved polygon.
Point in Polygon Calculations with the PointOnAreaOverlayer
Determining Spatial Relationships
Coordinate Systems and Measurements with the Reprojector
Distance Measurements with the LengthCalculator
Buffering features for Spatial Relationship Analysis
Shortest Route Calculations with the ShortestPathFinder
© 2020 Safe Software Inc |Legal