Question

Merging two lists

  • 2 September 2015
  • 2 replies
  • 65 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

Userlevel 2
Badge +17
Hi,

 

 

One possible ways is:

 

 

Takashi
Badge +3
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.

Reply