Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
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 (1)
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 '[' ']'