Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I'm relatively new at Qlikview and would like to use Google Maps in my analysis.
I've two different data file in the format below:
Customer | Product | Qty | TO |
A | X | 1 | 10 |
B | Y | 2 | 20 |
C | Z | 3 | 30 |
D | W | 4 | 40 |
Customer | City | Latitude | Longitude |
A | Fredriksberg | 60,1333 | 14,3833 |
B | Hinnerup | 56,2667 | 10,0667 |
C | MALMÖ | 64,0667 | 11,2167 |
D | SJÖBO | 55,6333 | 13,7 |
This is my script:(first sheet)
SET ThousandSep=' ';
SET DecimalSep=',';
SET MoneyThousandSep='.';
SET MoneyDecimalSep=',';
SET MoneyFormat='#.##0,00 kr;-#.##0,00 kr';
SET TimeFormat='hh:mm:ss';
SET DateFormat='YYYY-MM-DD';
SET TimestampFormat='YYYY-MM-DD hh:mm:ss[.fff]';
SET MonthNames='jan;feb;mar;apr;maj;jun;jul;aug;sep;okt;nov;dec';
SET DayNames='mån;tis;ons;tor;fre;lör;sön';
SET LongMonthNames='januari;februari;mars;april;maj;juni;juli;augusti;september;oktober;november;december';
SET LongDayNames='måndag;tisdag;onsdag;torsdag;fredag;lördag;söndag';
SET FirstWeekDay=0;
SET BrokenWeeks=0;
SET ReferenceDay=4;
SET FirstMonthOfYear=1;
SET CollationLocale='sv-SE';
LOAD [Territorial Unit],
Customer,
Product,
Qty,
[TO (SEK)],
FROM
(ooxml, embedded labels);
LOAD Customer,
City,
Latitude,
Longitude
FROM
(ooxml, embedded labels, table is Blad1);
let noRows = NoOfRows('Blad1')-1;
for i=0 to $(noRows)
let a=peek('Customer',$(i),'Blad1');
let address=peek('City',$(i),'Blad1');
Data:
LOAD
'$(a)' as Customer,
'$(address)' as Address,
subfield([Response/Placemark/Point/coordinates], ',' ,1) AS longitude,
subfield([Response/Placemark/Point/coordinates], ',' ,2) AS latitude
FROM [http://maps.google.com/maps/geo?q=$(address)&output=xml&oe=utf8&sensor=false&key=XXYYZZ] (XmlSimple, Table is [kml]);
next
second sheet
// Google Maps in QlikView
// V0.85.2 - October 1st 2008 © Copyright QlikTech International AB 2008 / AES
// Google Maps Key
// get a key here http://code.google.com/apis/maps/signup.html
gmap_key = 'xx';
max_zoom_level = 17; //maximum value 17
// Variables required for calculating map
// No need to change these
var_pi180= '=pi()/180';
var_lat_offset= '0';
var_mc2= '=256*pow(2,$(var_zoom))';
var_mc1= '=256*pow(2,($(var_zoom)-1))';
var_mid_lat= '=min(latitude)+(1+var_lat_offset)*((max(latitude)-min(latitude))/2)';
var_mid_long= '=min(longitude)+(max(longitude)-min(longitude))/2';
var_zoom= '=max(aggr(if(max( round(256*pow(2,(_zoom_level -1)))+( longitude *((256*pow(2,_zoom_level ))/360)) )-min( round(256*pow(2,(_zoom_level -1)))+( longitude *((256*pow(2,_zoom_level ))/360)) ) <map_size_x AND max((256*pow(2,(_zoom_level-1)))+((0.5*log((1+(sin((latitude)*pi()/180)))/(1-(sin((latitude)*pi()/180)))))*((-256*pow(2,_zoom_level))/(2*pi()))))-min((256*pow(2,(_zoom_level-1)))+((0.5*log((1+(sin((latitude)*pi()/180)))/(1-(sin((latitude)*pi()/180)))))*((-256*pow(2,_zoom_level))/(2*pi()))))<map_size_y,_zoom_level,1),_zoom_level))';
var_maptype= '=if(isnull(only(maptype)),fieldvalue( '&chr(39)&'maptype'&chr(39)&', 1 ),maptype)';
map_size_x= '400';
map_size_y= '400';
SET HidePrefix='_' ;
// Field required for calcualting best zoom level
_zoom_level:
Load RecNo( ) as _zoom_level autogenerate(max_zoom_level);
maptype:
LOAD * INLINE [
maptype
roadmap
mobile
satellite
terrain
hybrid
];
But it doesn't work.
If anybody could help I would be very grateful! Thanks to all of you in advance!
Fabrizio
Fabrizio Fonte wrote:
But it doesn't work.
Hi,
I am afraid this doesn't really explain your issue, you need to give us a bit more to go on here and a copy of your application is always helpful in resolving the issue
What's the issue your not able to get the data ?? one thing I could see is you have not defined the table name and calling the table name in other tables try like this
Blad1:
LOAD Customer,
City,
Latitude,
Longitude
FROM
(ooxml, embedded labels, table is Blad1);
Hi Avinash,
I've tried it but doesn't seem to work.
I attach a print screen of the error message.
Thanks for your help.
Fabrizio
Hi Adam,
The issue is that I get an error message when I reload the script. I attach the print screen.
Thanks for your help,
Fabrizio
PS. How can I send or attach a copy of my application?
Ok so it looks like you need a valid google maps key?
Basically it is telling you that it cant connect to that link, so you can simply use the link in a browser and debug it that way