Question

Matching Polygons


Badge +1

Hi, I have two different feature classes which contain many polygons that are very similar in size and shape. I want to assign the attributes of polygons from Feature Class 2 to similar polygons in Feature Class 1.

I tried to use SpatialFilter by buffering one set of polygons and then using the "Contains" predicate to attach attributes of the second set of polygons of similar shape to the first set. However, the buffer that I used to make sure I get all the similar ones (5m) then attaches attributes of some smaller polygons that fit within the buffer, which I don't want.

Is there any other type of transformer I could use where I set a percentage of the shape that is the same to be matched (eg. 90% of polygon A from Feature Class 1, is the same as 90% of polygon B from Feature Class 2)? I tried Matcher and matching the interior vertices, but this didn't work as none of them matched.

I'm using FME Desktop 2015.

Thanks,


3 replies

Userlevel 2
Badge +12

How about replacing the polygons by centerpoints (CenterpointReplacer or InsidepointReplacer) and then using the NeighborFinder or NeighborPairFinder to match the closest points?

That will eliminate small differences.

You can store and retrieve the actual polygon geometry in an attribute using GeometryExtractor and GeometryReplacer during the matching process.

Badge +22

I think erik_jan's is probably the better way to go for your current scenario, however for those interested in determining the percent overlap of features a long time ago I created a custom transformer that returned a list of all the features that overlapped the current feature and the percentage of each.

As I recall I used an AreaOnAreaOverlayer (with List), ArealCalculator then dropped the geometry and Cloned one feature for each overlapping part, promoted the attributes for that part, removed the part from the list and then exploded the list.

 

This gives a feature with an ID attribute (use a counter ahead of the AoAOverlayer if you don't have a unique ID), the foreign key (ID of the feature that it overlaps it) and the area of overlap.

 

Two features overlapping each other would produce two features A overlaps B by 30sqkm and B overlaps A by 30sqkm. Three features overlapping each other (think 3circle venn diagram) would produce 12 features: A overlaps B by 25 sq.km; A overlaps B by 6sqkm; A overlaps C by 20 sqkm; A overlaps C by 6sqkm; B overlaps A by 25 sq.km; B overlaps A by 6sqkm; B overlaps C by 17 sqkm; B overlaps C by 6sqkm; C overlaps A by 20 sq.km; C overlaps A by 6sqkm; C overlaps B by 17 sqkm; C overlaps B by 6sqkm;

These features are sent to the supplier port of a featureMerger, with the original features as the requestor, joined on the ID attribute and generating a list.

 

In the venn diagram example Feature A would end up with

overlaps{0}.fkey: B

 

overlaps{0}.area: 25

 

overlaps{1}.fkey: B

 

overlaps{1}.area: 6

 

overlaps{2}.fkey: C

 

overlaps{2}.area: 20

 

overlaps{3}.fkey: C

 

overlaps{3}.area: 6

Collapse the histogram to

overlaps{0}.fkey: B

 

overlaps{0}.area: 31

 

overlaps{1}.fkey:C

 

overlaps{1}.area: 26

 

then calculate the percent overlap by dividing the overlapping area by the area of the feature.

Badge +1

Thanks Eric and JDH, I will give the Centerpoints method a go, it seems fairly straight forward :)

Reply