Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello all,
I am a very novice QlikView user. I have been following some threads on how to display maps inside of a Qlikview screen.
My code appears to work, but I am not able to return any data.
Below is the full code structure I am using and it successfully loads the data, populates the array and passes the string into the URL call. But no data is returned to populate the map.
Any help would be greatly appreciated.
Thank you in advance,
Table1:
LOAD Quantity,
Customer,
City
FROM
(ooxml, embedded labels, table is Sheet1);
let noRows = NoOfRows('Table1')-1;
for i=0 to $(noRows)
let a=peek('Customer',$(i),'Table1');
let b=peek('Quantity',$(i),'Table1');
let address=peek('City',$(i),'Table1');
Data:
LOAD
'$(a)' as Customer,
'$(b)' as Quantity,
'$(address)' as Address,
subfield([Response/Placemark/Point/coordinates], ',' ,1) AS longitude,
subfield([Response/Placemark/Point/coordinates], ',' ,2) AS latitude
FROM [https://www.google.com/maps/embed/v1/place?key=AIzaSyC741BDXPTfBTYENutOUhuXhDIUFkyS0kfik&q=$(address)] (XmlSimple, Table is [kml]);
next
// 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
];
I don't see where you actually call the Google maps API. Usually, it;s done in the Chart background color (chart properties, Colors tab).
It would be easier to troubleshoot if you posted your sample document.
cheers,
Oleg Troyansky
www.masterssummit.com - take your QlikView skills to the next level!
Thank for looking into this Oleg.
Please find attached the sample document.
So, If I understand correctly, the peace that doesn't work is the load from the Google Maps API call... Honestly, I've never seen the API used this way. I typically use the API to get the image of the map, when the coordinates are
Based on the Google description, this API returns the image of the map and not the coordinates. Any of my attempts to retrieve anything from this API resulted in "Cannot open the HTML File" error...
Further search on the Google Maps API page tells me that the API that returns coordinates, is called Geocoding Service. Check it out here:
Geocoding service - Google Maps JavaScript API v3 — Google Developers
cheers,
Oleg Troyansky
www.masterssummit.com