Skip to main content

Attribute Splitter and List Exploder? or is there a better way?

So this is probably going to be a bit of a challenge: a WKT string can contain comma's too... So the AttributeSplitter by itself is not going to work

 

You can try a StringReplacer with a regular expression to look for the regex \\), \\w, which would supposedly find the comma's separating the various geometries, but I think they'd find comma's separating the parts of multi-geometries too.

 

I'm a bit rusty on regular expressions, just out of curiousity, what kinds of geometry can be in there?


So this is probably going to be a bit of a challenge: a WKT string can contain comma's too... So the AttributeSplitter by itself is not going to work

 

You can try a StringReplacer with a regular expression to look for the regex \\), \\w, which would supposedly find the comma's separating the various geometries, but I think they'd find comma's separating the parts of multi-geometries too.

 

I'm a bit rusty on regular expressions, just out of curiousity, what kinds of geometry can be in there?

Agree with @Hans van der Maarel​ ,​  @phild​ if you could provide an example that would be great


Assuming the commas to split on are only those that are outside brackets you could use regex to replace the commas with e.g. a colon, and then use an attributesplitter on this followed by a list exploder. Then a geometry replacer to build the geometries

,(?!o^()]*\))

 


Thanks to all. @Hans van der Maarel​ the geometries are building polygons and turns out they are sperated by ),( as each WKT string starts and stops so I was able to use a string searcher and replace that with )#( to give me a unique delimiter. @hkingsbury​ sorry, but customer data so can not share. @ebygomm​ thanks for the tip.


Reply