Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Enriquemmesteo
Creator
Creator

Create Line Map visualization from coordinates

Hello everyone,

The case is this: 

We have a file with many fields with the information of train stations. Some of those fields relevant to this issue are "Station","Line","Latitude","Longuitude".

These coordenates belong to each of the stations. A line is conformed by various stations. Here is a little example:

STATIONS.JPG

What I currently do is add this line in the script GeoMakePoint([Latitude],[Longitude]) as Coordinates

and then in the map visualization I add Coordinates as point layer. If I have Coordinates in the data of the visualization it shows all the points.  If I use the Line as dimension, it only shows a few of the points.

But really what I need to do is create a line layer instead of a point layer on the map visualization. I need a visualization showing lines joining all the dots for each "Line". In the previous example it would show a 3 lines conformed by joining the coordinates of their stations.

Anyone can help me with this?

Thanks in advance!

Labels (2)
12 Replies
lironbaram
Partner - Master III
Partner - Master III

hi 

you can create the line in the script or in the map 

for calculating the line in the front end, use this expression and line as dimension

='[[' & concat(Coordinates,',',Station) & ']]'

 

Enriquemmesteo
Creator
Creator
Author

Im kinda lost here. Where should that expression go to create the line layer for the map visualization?

I guess some intermediate steps could be required to join all stations from the same "Line" with their coordenates to display a line in the map, and I suppose this can't be done if we don't know the order. In the example :

To create a line for the "Line" 1: we need to join the coordinates for A, B,C in that order because A,C,B would be a different line. 

lironbaram
Partner - Master III
Partner - Master III

hi 

you put this expression in the location field of the line layer 

as for the order the line is built using the station name for the order 

 

Enriquemmesteo
Creator
Creator
Author

Hi Liron, I've tried this but it says Invalid dimension and no lines are shown in the map. I've tried some teaks to the formula but nothing works.

Any ideas what is going on?invaliddim.JPG

lironbaram
Partner - Master III
Partner - Master III

hi 

as the dimension you should use the line field 

then use this expression in the location field 

Enriquemmesteo
Creator
Creator
Author

Thanks Lionbaram, it worked but needs more work from our part to prepare the data correctly. These stations needs to be ordered to form the lines correctly in the map visualization

sfbi
Creator
Creator

thank you... helped me a lot!

snowman
Contributor III
Contributor III

Hi,

I have the same requirement, and may I know if your expression should be added to the Location field (under Location section) of both Start point and End point  or somewhere else ? 

 

Thanks

snowman
Contributor III
Contributor III

Sorry, I got it.  The expression should be added in the Line geometry field.

However as @Enriquemmesteo said the stations are not all in right sequence. Can the expression be modified if a new column of station sequence (SEQ) is added so that the line would be in the right sequence of stations ?

Thanks