I don't believe you can use negative indices within the Text Editor.
Try adding a ListElementCounter and using the output _element_count attribute to build your expression. Since the ListElementCounter starts the count at 1, you will need to subtract one from this value to get the correct index.
For example, this expression should work to get the last x value of your list:
@Value(_indices{@Evaluate(@Value(_element_count)-1)}.x)
I don't believe you can use negative indices within the Text Editor.
Try adding a ListElementCounter and using the output _element_count attribute to build your expression. Since the ListElementCounter starts the count at 1, you will need to subtract one from this value to get the correct index.
For example, this expression should work to get the last x value of your list:
@Value(_indices{@Evaluate(@Value(_element_count)-1)}.x)
Thanks @debbiatsafe, I will give that a go but even the safe doco mentions negative index values
http://docs.safe.com/fme/2019.0/html/FME_Desktop_Documentation/FME_Transformers/Transformers/coordinateextractor.htm
I don't believe you can use negative indices within the Text Editor.
Try adding a ListElementCounter and using the output _element_count attribute to build your expression. Since the ListElementCounter starts the count at 1, you will need to subtract one from this value to get the correct index.
For example, this expression should work to get the last x value of your list:
@Value(_indices{@Evaluate(@Value(_element_count)-1)}.x)
Yes, negative index is supported in a parameter setting in some transformers, but is not supported as an index of list attribute.
This workflow is possible.
Yes, negative index is supported in a parameter setting in some transformers, but is not supported as an index of list attribute.
This workflow is possible.
Thanks @takashi, very much appreciated.
Thanks @takashi, very much appreciated.
I get unreasonably annoyed at having to use two coordinate extractors for start and end features. I'd really like to be able to extract start and end in one go
https://knowledge.safe.com/idea/39951/coordinate-extractor-first-and-last-coordinates-on.html
I get unreasonably annoyed at having to use two coordinate extractors for start and end features. I'd really like to be able to extract start and end in one go
https://knowledge.safe.com/idea/39951/coordinate-extractor-first-and-last-coordinates-on.html
I'm with you on that one, just voted for the idea.
I get unreasonably annoyed at having to use two coordinate extractors for start and end features. I'd really like to be able to extract start and end in one go
https://knowledge.safe.com/idea/39951/coordinate-extractor-first-and-last-coordinates-on.html
I agree with you, voted too!
Yes, it is possible to use negative index values within CoordinateExtractor if the Mode is set to Specify Coordinate. In Specify Coordinate mode, the coordinates get extracted as feature attributes instead of a list.
Based on your screenshots, I had assumed (perhaps incorrectly) you were using the All Coordinates mode in the CoordinateExtractor and defining an expression in the Value column of the User Attributes tab of the writer feature type to get the last index value of the _indices list. for this scenario, the expression I had outlined above in combination with the ListElementCounter will work in an AttributeCreator, AttributeManager, etc.
If this is not the case, my apologies and please use @takashi's excellent answer instead.
LRS_GetRouteMeas transformer did this for me, posting here as it's somewhere I searched for a solution.
takes each Polyline and Extracts Vertex 0 and Vertex -1 only.. as shown here.