Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
morenoju
Partner - Specialist
Partner - Specialist

Multilinestring in Qlik Sense Maps

Hi all,

I load LINESTRINGS as geometries for line layers in Qlik Sense native maps all the time by doing this transformation in the load script:

Replace(Replace(Replace(Replace(Replace(st_astext, 'LINESTRING(', '[['),',','],['),')',']]'),' ',','),'[,','[') as segment_location

I may have taken that piece of code from a post from @Patric_Nordstrom post 🙂

 

I'm trying to do a similar thing that works for MULTILINESTRING. Do you have any experience with it? Is it even possible? I started using another transformation but it has not worked so far. I'm getting a straight line as a result doing this:

'['& replace(replace(replace(replace(replace(st_astext,'MULTILINESTRING',''),')',']'),'(','['),', ','],['),' ',',')& ']' as segment_location

Please let me know if you have any experience with multilinestrings.

Thanks!

Labels (5)
1 Reply
Patric_Nordstrom
Employee
Employee

Haven't tested but, should be doable, the native Sense map supports MultiLineString in GeoJSON format.

WKT MultiLineString looks like this:

MULTILINESTRING ((10 10, 20 20, 10 40),
(40 40, 30 30, 40 20, 30 10))

(https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry)

The native Sense map supports MultiLineString in GeoJSON format:

[
        [[10, 10], [20, 20], [10, 40]], 
        [[40, 40], [30, 30], [40, 20], [30, 10]]
    ]

 (https://en.wikipedia.org/wiki/GeoJSON)

in short:

  1. Remove 'MULTILINESTRING '
  2. Replace between lines: '), (' to ']],[['
  3. Replace between coordinates: ', ' to '],['
  4. Replace inside coordinates:  ' '  to ','
  5. Replace start and end on lines: '((' to '[[' and ')) to ']]'
  6. And enclose with start and end brackets '[' ']'