Skip to main content
Solved

Matching two datasets and keeping the highest point?


alfons
Contributor
Forum|alt.badge.img+7

Hello

 

I have several point data sets (different Excel files) that I would like to clean up. I would like to delete points with the same position (X,Y) and only keep the point with the highest height (Z).

I am currently deleting points with the same position with the Matcher Transformer. This works wonderfully. Now I have not yet found a way to say that the highest point at the location cannot be deleted. Is there a way in FME to influence the selection of the points to be deleted when cleaning different data sets? The height of the objects is available both as attributes and as 3D coordinates.

Thanks a lot

Best answer by nielsgerrits

One way to do this is to use the CoordinateExtractor to get the _x, _y and _z from each point. Then use a Sorter to sort on _z numeric descending. Then use a Sampler set to 1st N features, group by _x and _y. This will let only one of the points through, which will be the one with the highest _z value as the were sorted this way.

 

This will only work if the coordinates matches exactly. With the Matcher this can be fixed using the Vector Tolerance parameter. As an alternative, you can use the Matched outputport from the Matcher, sort on _z numeric descending. Then use a Sampler set to 1st N features, group by _match_id.

View original
Did this help you find an answer to your question?

3 replies

nielsgerrits
VIP
Forum|alt.badge.img+54
  • Best Answer
  • September 1, 2023

One way to do this is to use the CoordinateExtractor to get the _x, _y and _z from each point. Then use a Sorter to sort on _z numeric descending. Then use a Sampler set to 1st N features, group by _x and _y. This will let only one of the points through, which will be the one with the highest _z value as the were sorted this way.

 

This will only work if the coordinates matches exactly. With the Matcher this can be fixed using the Vector Tolerance parameter. As an alternative, you can use the Matched outputport from the Matcher, sort on _z numeric descending. Then use a Sampler set to 1st N features, group by _match_id.


alfons
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • September 1, 2023

Thanks a lot @nielsgerrits​ 

 

Both suggestions work perfectly. Especially the second suggestion was important in my case, because the coordinates differ slightly in parts. I can compensate for this with the tolerance function in the Matcher. Thanks a lot for the superfast help.


nielsgerrits
VIP
Forum|alt.badge.img+54
alfons wrote:

Thanks a lot @nielsgerrits​ 

 

Both suggestions work perfectly. Especially the second suggestion was important in my case, because the coordinates differ slightly in parts. I can compensate for this with the tolerance function in the Matcher. Thanks a lot for the superfast help.

Cheers :)


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings