Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to convert from BNG to Lat Long?

Hi,


I have map data in the form of Northings and Eastings, and would like to convert this to Lat and Long so I can display on a Map.

I know there are online tools to do this, but does anyone know a Qlik Sense solution/tool I can use?

Thanks,

8 Replies
rittermd
Master
Master

I am not aware of any QS tool to do that.  I would simply convert the data to Long/Lat and then bring that into your QS app via script.

cfitzpatrick69
Partner - Contributor II
Partner - Contributor II

Many years ago I converted a piece of Java code that did the conversion into a QlikView Javascript macro if that's any good? Conversion from/to: lat-long, Eastings/northings and OS grid ref at a rate of about 100,000 a second.

Anonymous
Not applicable
Author

Hi Chris, can you please share the code please.

Regards,

ASP

RonaldDoes
Partner - Creator III
Partner - Creator III

The wikipedia article shows the conversion formula you'll want to use:

Universal Transverse Mercator coordinate system - Wikipedia

Anonymous
Not applicable
Author

Thanks Ronald, 2 questions

1) I needed something for British co-ordinate system will UTM to Lat/Lon work?

2) If it works can i code the formula given on wiki into Qlik Code?

Regards,

Anwar

cfitzpatrick69
Partner - Contributor II
Partner - Contributor II

Hi Anwar

Sure

I've attached a QVW that does the conversion (only for The Globe Theatre in London but you get the idea) via a (JScript) macro.

Enjoy !

anwar_pardawala
Partner - Contributor II
Partner - Contributor II

This is Awesome Chris thanks, Only Question is how to the same in Qliksense?

kevmuskoka
Contributor
Contributor

I have tried this code in Qlik Sense from the above post, but can't find much information on ENToLatLng in the community or online. Is this something built into Qlik Sense or do I need to add actual code somewhere ?

LOAD 
*,
longitude2 & ',' & latitude2 as LatLonCoor 
;
Load *,
SubField(LatLng, '_', 1) as latitude2,
SubField(LatLng, '_', 2) as longitude2
;
Load *,
ENToLatLng(latitude, longitude) as LatLng;

but I get the following Error when trying to load the data:

Started loading data
 
The following error occurred:
Unexpected token: '(', expected one of: ',', ':', 'OPERATOR_PLUS', 'OPERATOR_MINUS', 'OPERATOR_MULTIPLICATION', 'OPERATOR_DIVISION', 'OPERATOR_STRING_CONCAT', ...
 
The error occurred here:
Load *, ENToLatLng>>>>>>(<<<<<<latitude, longitude) as LatLng
 
Data has not been loaded. Please correct the error and try loading again.