Question

Extract specific part of aggregate by index

  • 13 December 2016
  • 10 replies
  • 23 views

Badge +22
  • Contributor
  • 1963 replies

Is there a way to extract a specific part of an aggregate by it's index other than deaggregating and testing the resulting features to find the one where _part_number = index.

I'm thinking there might be a way to use XQuery/GeometryPartExtractor


10 replies

Userlevel 1
Badge +12

Not really an answer as its just a different way of doing it, but what about using the GeometryExtractor to record the geometry as an attribute,before the aggregation (assuming you are doing this in a step prior) and then just using a ListIndexer and a GeometryReplacer to get the specific geometry you want.

Badge +22

Not really an answer as its just a different way of doing it, but what about using the GeometryExtractor to record the geometry as an attribute,before the aggregation (assuming you are doing this in a step prior) and then just using a ListIndexer and a GeometryReplacer to get the specific geometry you want.

I have done that in the past, when I was creating the aggregate at a prior stage in the workflow.

 

 

In this particular case, the data input is already aggregated.

 

 

Userlevel 2
Badge +17

Hi @jdh, yes, you can use the GeometryPartExtractor (Advanced Editor). This is a possible syntax if the input geometry is a one level aggregate or a Multi geometry. Just be aware that a part of the aggregate has to be specified with 1-based index.

(: extract the 2nd part from a one level aggregate or a multi :)
number(/geometry/geometry[2]/@fme_id)
Badge +22

Hi @jdh, yes, you can use the GeometryPartExtractor (Advanced Editor). This is a possible syntax if the input geometry is a one level aggregate or a Multi geometry. Just be aware that a part of the aggregate has to be specified with 1-based index.

(: extract the 2nd part from a one level aggregate or a multi :)
number(/geometry/geometry[2]/@fme_id)
Thank you.   That's exactly what I needed.
Badge +22

Hi @jdh, yes, you can use the GeometryPartExtractor (Advanced Editor). This is a possible syntax if the input geometry is a one level aggregate or a Multi geometry. Just be aware that a part of the aggregate has to be specified with 1-based index.

(: extract the 2nd part from a one level aggregate or a multi :)
number(/geometry/geometry[2]/@fme_id)
Minor issue with the advanced editor, when you reference a feature attribute using the left panel it does not wrap the attribute name in quotes as required.  

 

{fme:get-attribute(x)}  instead of {fme:get-attribute("x")}

 

Userlevel 2
Badge +17
Minor issue with the advanced editor, when you reference a feature attribute using the left panel it does not wrap the attribute name in quotes as required.

 

{fme:get-attribute(x)} instead of {fme:get-attribute("x")}

 

yeah, have to say it's a kind of bug. @daleatsafe, please fix it.
Userlevel 4
Badge +13
yeah, have to say it's a kind of bug. @daleatsafe, please fix it.

 

Seems like a quick fix...thanks for pointing it out.
Badge +22

 

Seems like a quick fix...thanks for pointing it out.
There should be a case for it, as I pointed it out to support this morning.

 

 

Userlevel 4
Badge +13
There should be a case for it, as I pointed it out to support this morning.

 

 

And the fix is going in as I type this. Wish everything was that easy.... Thanks for pointing it out.

 

 

Badge +9
And the fix is going in as I type this. Wish everything was that easy.... Thanks for pointing it out.

 

 

Quick update, the fix is available in the latest FME 2017 beta (b17212+).

 

 

Reply