Solved

Use of ListElementFilter to match geometry line length to text line length

  • 21 September 2018
  • 3 replies
  • 3 views

Badge

Hi FMErs,

I have a question related to the use of the ListElementFilter transformer by @takashi that is a continuation of this question. I'm open to any recommendations for alternate transformers that may be able to match the conditions, but I cannot find any to date.

Attributes for line length, line name, line date have been successfully extracted from an initial text string.

Attributes for line geometry such as total length, start x,y, end x,y and azimuth have been successfully extracted from the autocad polyline.

Now trying to match the text to the correct polyline using a combination of

1) Proximity (neighbour finder within 5m, line as base, text as candidate generating list of potential matches shown Figure 1), and

2) Length (by matching geometry length to text sourced length)

Referring to Figure 1 - A previous attempt using the first match only, and testing line length with a 1m tolerance yields about 50% success.

In attempt 2, using a list of all potential matches within 5m, I get a list of up to 10 matches. A sample is shown in Figure 2 from the data inspector.

On trying to use the ListElementFilter in either numeric value, numeric range mode or exact match mode I'm trying to extract the attribute values for HoleT_Name and Date from the list whose list attribute Potentials{}.HoleT_Leng = tot_length. Rounding each value to the nearest metre is OK.

I'm not sure if I have the ListElementFilter set up correctly, but would appreciate any assistance.

If more than one match is still found when testing for line length matches, a further level of detail test of checking azimuth of text and line could be applied using the same process ??

Thanks in advance.

 

The neighbour finder generates list potentials{} with attributes {}.HoleTLeng , {}.Date , {}.HoleT_Name

ListElementCounter counts the number of potential matches found by the neighbour finder for each line.

Figure 1

Figure 2 - Data Inspector result of list matches. Agree both tot_length and text length need rounding to the nearest whole metre.

icon

Best answer by mark2atsafe 13 November 2018, 22:37

View original

3 replies

Badge

You could either explode the list using the listexploder or use a loop in a custom transformer to iterate over all of the potential results and calculate which is closest to your tot_length.

Userlevel 4
Badge +25

I'm unsure what the ListElementFilter is doing, because it uses a lengthy Tcl script that I don't really want to have to look through in detail! And I don't know what parameters you currently have set up (what is your Match Expression?)

However, from the documentation I would suggest using the Numeric Range operation, using a range of say 1 metre (or 0.1 metres) around the tot_length value.

So, open the ListElementFilter parameters. Set the Filter Type to Numeric Range. Under Match Expression, open the text editor dialog. In the text editor enter:

(@Evaluate(@Value(tot_length)-1),@Evaluate(@Value(tot_length)+1))

That, I believe, will filter out records that are outside the range of +/-1m, leaving only records that match your required value. If you want to go with 0.1m instead then just change the "1"s to "0.1"s.

Note: OK, I just tried this and it didn't like the expression. But you can create an attribute with the AttributeManager using the above expression (which works fine) and pass it to the Match Expression as an attribute value.

Now, what the transformer produces in terms of output... the screenshot (Figure 2) shows the Table View window, so it is definitely not a list. You cannot view list attributes in the Table View window. So you may have to try and figure out what it is doing there. To me it seems that the transformer removes all but one list record, so explode the list after this point (or just copy the values from the list). Basically click the record in the Table View and inspect the list values in the Feature Information window.

The other option is, as @Pratsch suggests, to ignore the ListElementFilter and simply explode the list of results, calculating the difference between tot_length and potential lengths with the ExpressionEvaluator, and using a Tester to keep only the value with the smallest difference.

Badge

I'm unsure what the ListElementFilter is doing, because it uses a lengthy Tcl script that I don't really want to have to look through in detail! And I don't know what parameters you currently have set up (what is your Match Expression?)

However, from the documentation I would suggest using the Numeric Range operation, using a range of say 1 metre (or 0.1 metres) around the tot_length value.

So, open the ListElementFilter parameters. Set the Filter Type to Numeric Range. Under Match Expression, open the text editor dialog. In the text editor enter:

(@Evaluate(@Value(tot_length)-1),@Evaluate(@Value(tot_length)+1))

That, I believe, will filter out records that are outside the range of +/-1m, leaving only records that match your required value. If you want to go with 0.1m instead then just change the "1"s to "0.1"s.

Note: OK, I just tried this and it didn't like the expression. But you can create an attribute with the AttributeManager using the above expression (which works fine) and pass it to the Match Expression as an attribute value.

Now, what the transformer produces in terms of output... the screenshot (Figure 2) shows the Table View window, so it is definitely not a list. You cannot view list attributes in the Table View window. So you may have to try and figure out what it is doing there. To me it seems that the transformer removes all but one list record, so explode the list after this point (or just copy the values from the list). Basically click the record in the Table View and inspect the list values in the Feature Information window.

The other option is, as @Pratsch suggests, to ignore the ListElementFilter and simply explode the list of results, calculating the difference between tot_length and potential lengths with the ExpressionEvaluator, and using a Tester to keep only the value with the smallest difference.

Thanks @mark2catsafe and @Pratsch, I found that sequentially checking each lists' text length with a separate length tester, then list indexing to extract all elements from the matched list number worked. It was a bit cumbersome, but to someone looking at the workspace it would make sense i.e. test list 1 , if match list extract 1 , else test list 2 , if match list extract 2 , else test 3 , etc.

Your finding that the ListElementFilter " tried this and it didn't like the expression. " was similar to my initial experience and the reason for the question in the first place, but absolutely agree that any of the methods suggested here would work !

Cheers

Pat

 

Reply