Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I'm trying to read a csv file with a column called linkPoints that looks like this:
40.74047,-74.009251 40.74137,-74.00893 40.7431706,-74.008591 40.7462304,-74.00797 40.74812
My plan was to load it using:
LOAD '[[' & replace(linkPoints,' ','],[') & ']]' as linkGeometry,
However, the problem seems to be that the linkPoints column has the points in lat lon format instead of lon lat.
Is there any workaround to get the lines displayed in Qlik? Can I somehow flip latitude and longitude?
Thanks
Hello, this is an interesting problem. I think I have a solution for you, or something close to it.
We just need to break this problem down into chunks.
Load
LineID,
SubField(Points,' ') as Point;
Load
LineID,
SubField(Point,',',1) as lat,
SubField(Point,',',2) as lon,
if(Previous(LineID) = LineID, peek(SequenceID) + 1, 1) as SequenceID;
Load
LineID,
SubField(Points,' ') as Point;
Load
LineID,
SequenceID,
GeoMakePoint(lat,lon) as GeoPoint;
Load
LineID,
SubField(Point,',',1) as lat,
SubField(Point,',',2) as lon,
if(Previous(LineID) = LineID, peek(SequenceID) + 1, 1) as SequenceID;
Load
LineID,
SubField(Points,' ') as Point;
LineTable:
Load
LineID,
'[' & Concat(GeoPoint,',', SequenceID) & ']' as LineGeometry
Group By LineID;
Load
LineID,
SequenceID,
GeoMakePoint(lat,lon) as GeoPoint;
Load
LineID,
SubField(Point,',',1) as lat,
SubField(Point,',',2) as lon,
if(Previous(LineID) = LineID, Peek(SequenceID) + 1, 1) as SequenceID;
Load
LineID,
SubField(Points,' ') as Point;
Load
*
Inline [
LineID| Points
1| 40.74047,-74.009251 40.74137,-74.00893 40.7431706,-74.008591 40.7462304,-74.00797
](delimiter is |);
I'm sure there are other ways to deal with this. This post by @Patric_Nordstrom describes another method.
https://community.qlik.com/t5/Qlik-GeoAnalytics-Documents/From-Points-into-Lines/ta-p/1481413
I hope this helped.