Solved

Chopper vertex counter

  • 11 October 2018
  • 9 replies
  • 13 views

I am using a chopper to extract vertices from lines. I want to get the order of these vertices for each line and have that stored in an attribute that I would like to copy to a csv along with the coordinates. I was able to get the coordinates but not the vertex order. What is the work around for this?

icon

Best answer by ebygomm 12 October 2018, 10:02

View original

9 replies

Userlevel 2
Badge +17

Hi @amina, you can use the Counter to add sequential number to the vertices output from the Chopper. If you set the counter name containing a value of unique ID attribute of the input lines, count number sequence will be created for each original line separately.

Userlevel 1
Badge +10

If you just want to extract the coordinates then a coordinate extractor followed by a list exploder is another option, the element index attribute in the list exploder gives the vertex position

If you just want to extract the coordinates then a coordinate extractor followed by a list exploder is another option, the element index attribute in the list exploder gives the vertex position

Thank you for your help - I am trying the list exploder and attaching that after coordinate extractor. with indices{} as the list attribute but I am only getting 0 for the element index.. help will be appreciated thank you so much

Userlevel 2
Badge +17

Thank you for your help - I am trying the list exploder and attaching that after coordinate extractor. with indices{} as the list attribute but I am only getting 0 for the element index.. help will be appreciated thank you so much

Do you perhaps still have the Chopper in the workflow? If you adopt the CoordinateExtractor and the ListExploder, you don't need to use the Chopper any longer.

 

 

Thank you for your help - I am trying the list exploder and attaching that after coordinate extractor. with indices{} as the list attribute but I am only getting 0 for the element index.. help will be appreciated thank you so much

Hi @takashi

 

I originally have a feature class of lines that I want to extract the vertices and the coordinates for. I was thinking the chopper will split up by Vertex then the coordinateextractor is giving me the coordinates. The List exploder split the coordinates up. The only thing I am still missing is the Vertex number for each line. The counter is not looping through the whole set and I am not setting it up properly I believe.

If you just want to extract the coordinates then a coordinate extractor followed by a list exploder is another option, the element index attribute in the list exploder gives the vertex position

Hi @egomm I am getting for element index. What would I be missing? Thanks
Userlevel 1
Badge +10
Hi @egomm I am getting for element index. What would I be missing? Thanks

 

As @takashi mentioned, if you just want to extract the coordinates you don't need the chopper. That will turn your lines into points which of course only have one coordinate which is why the element index is showing 0.

 

 

Send the lines straight into the coordinate extractor
Userlevel 2
Badge +17

If you just want to extract the coordinates then a coordinate extractor followed by a list exploder is another option, the element index attribute in the list exploder gives the vertex position

The upper workflow is my first suggestion, assuming that the input lines have unique ID attribute called e.g. "_line_id".

 

The lower workflow is @egomm's suggestion, don't need to use the Chopper.

 

The upper workflow is my first suggestion, assuming that the input lines have unique ID attribute called e.g. "_line_id".

 

The lower workflow is @egomm's suggestion, don't need to use the Chopper.

 

@takashi

 

thank you so much I got it now- It is working like a charm the key was to assign the counter name to the unique line_id .. I am sorry to have taken so long to get this straight I have not worked in FME for years and I am just getting back to it. This forum is so great.. Thank you so much for all your help

Reply