Skip to main content
Question

Merging two lists

  • September 2, 2015
  • 2 replies
  • 357 views

Hi all,

 

 

I have features containing two lists obtained from Matcher. First list named _fromPolygon contains just yes/no elements. Second one named _SYMBOL has values of integer type. I need to select minimal value from _SYMBOL but based on other list. If in _fromPolygon I don't have 'no', then I ned to simply minimal _SYMBOL value. If _fromPolygon contains 'no' values, then I need to get minimal _SYMBOL value where corresponding _fromPolygon is 'no'.

Example:

 

Feature  |       _fromPolygon       |       _SYMBOL       |       wanted value

 

   1          yes, no, yes, no, no           2, 9, 2, 5, 3                     3

 

   2          yes, yes, yes, yes               2, 3, 1, 5                       1

 

   3          no, no, no, no, no, no         2, 3, 2, 5, 3                     2

 

 

I combined ListSorter and ListSearcher but allways get lost when trying to merge two lists in order to get Feature 1 situation done.

What are your suggestions and ideas for achieving this? I had few, but all gone bad!

 

 

Thanks!

2 replies

takashi
Influencer
  • September 3, 2015
Hi,

 

 

One possible ways is:

 

 

Takashi

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • September 3, 2015
If you say the lists came from a matcher, and a matcher can make only 1 list from SingleMatched output, i assume you used 2 matchers(?) on same data set?

 

Then if you have same sorting order prior to entering the matcher, you should be able to merge the lists  using the "match_id" attribute as group_by in a featuremerger. This attribute is also created by the SingleMatched output.

 

(actually it is more like merging 2 lists to the same object as true listmerging is actually something else)

 

 

For the rest, either what Takashi says after his featuremerger or something like this:

 

To test you only need to create a histogram of from polygon. A listelementcounter on this histogram.

 

This way you have wether or not there are 2 distinct values and thier count.

 

Use Listsearcher  to find the index of "no" and listindexer to retrieve its value.

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