Question

Alteryx Process


Badge

Hi,

 

Im trying to emulate an Alteryx process, but I dont quite know how to do it.

 

Here is the video to show a summary of how to do it https://www.youtube.com/watch?v=nmbWf6-PFhE

 

And here is the test data

 

<area shape="poly" alt="" coords="496,172, 496,232, 566,232, 566,121, 496,172" href="BLUE">

 

The process is taking a shape from adobe illustrator, exporting to HTML (as above) then extracting each of the above into a csv that can be read in tableau and produce a shape.

 

Ideally from this

 

<area shape="poly" alt="" coords="496,172, 496,232, 566,232, 566,121, 496,172" href="rrrr">

 

to this

 

BLUE,X,496,Y,172

BLUE,X,496,Y,232

BLUE,X,566,Y,232

BLUE,X,566,Y,121

BLUE,X,496,Y,172

 

There maybe multiple variables in the amount of X and Y coordinates per shape.

 

Anyone got any ideas on how to do this?

 

Thanks

 

Chris


3 replies

Badge

Sorry. Should have said. The rrrrr above should read BLUE

Badge +3

Hello,

The FMEs version of "split text to rows" is the AttributeSplitter followed by a list exploder, same question: https://knowledge.safe.com/questions/35589/split-a-row-into-multiple-rows-by-a-field-with-del.html

The last part he's doing with the multi row formula is basically the FMEs Counter:

I'm stuck on the last part with the color "BLUE". You would have to parse it out somehow, brain freeze...

Userlevel 1
Badge +11

Hi @fordy,

This is definitely possible to do in FME. As @davidrasner5 mentions, you will likely have to work with some lists, the AttributeSplitter and the ListExploder being helpful transformers in this process.

Here are some of the steps to get the workflow you're looking for:

  1. I read in the line as a textfile in the TextFile reader

  2. Used an HTMLExtractor to grab the coordinates and the colour values. For me, setting up this transformer correctly was probably the hardest part (thanks @debbiatsafe!)

     

  3. Since we grab those as List Attributes, we want to explode the list into attributes in our table by using the AttributeExploder on the coordinates. I use a second AttributeExploder for the colour

  4. Next, I use an AttributeSplitter on the coordinates list with the delimiter set to ', ' or 'comma+space' which creates a new list of coordinate pairs. I have named it _coords

  5. Explode this list (_coords) into attributes.

  6. What's left now is to concatenate it in the format you want. I did this using a StringReplacer and a StringConcatenator. My output looks like this:

     

My final workspace then looks like this:

 

Alternatively though, you had mentioned wanting to bring these coordinates as polygons into Tableau. We actually have a tableau writer that you could write directly into instead. To do that, I believe you could create well known text (WKT) from your coordinates to write into Tableau as one possibility. This Q&A might be helpful for creating WKT. There's also some tableau tutorials here.

Reply