Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Unable to replicate google map..

Steps for beginners to implement Google Maps in Qlikview

Trying to use a map for a chart...I am having problems with both examples.  Can't get Google image to show and when I copy and use another file the image shows but cant get coordinates to match?  Locations are in US. I see scatter plot of lat and long are relatively correct, but not sure why they are loading negative coordinates as positive?

qvw attached...

1 Solution

Accepted Solutions
Not applicable
Author

I figured it out; there was problem with the API image script;  the thread below fixed it; hopefully it will work when I load put app into use.

thanks,us map.GIF

corrected version:

='http://maps.googleapis.com/maps/api/staticmap?center='  &  num(var_mid_lat, '##############', '.', ',' )  &  ','  &  num(var_mid_long, '##############', '.', ',' )  &  '&zoom=$(var_zoom)'  &  '&size='&map_size_x&'x'&map_size_y  &  '&sensor=false'  &  '&maptype='&var_maptype

Google Map Disappeared!

View solution in original post

4 Replies
fred_s
Partner - Creator III
Partner - Creator III

Hi Alex,

There was something wrong with your script.

Replace the Google maps script with the following

Grtz Fred

// Google Maps in QlikView

// V0.9 - 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 = 5; //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=        '600';

map_size_y=     '600';

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

];

fred_s
Partner - Creator III
Partner - Creator III

Hi Alex,

There was something wrong with your script.

Replace the Google maps script with the following

Grtz Fred

// Google Maps in QlikView

// V0.9 - October 1st 2008  © Copyright QlikTech International AB 2008 / AES

// Google Maps Key

gmap_key = 'xx';

max_zoom_level = 5; //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=        '600';

map_size_y=     '600';

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

];

jpenuliar
Partner - Specialist III
Partner - Specialist III

Have a look at this tutorial,:

http://community.qlik.com/docs/DOC-5709

Not applicable
Author

I figured it out; there was problem with the API image script;  the thread below fixed it; hopefully it will work when I load put app into use.

thanks,us map.GIF

corrected version:

='http://maps.googleapis.com/maps/api/staticmap?center='  &  num(var_mid_lat, '##############', '.', ',' )  &  ','  &  num(var_mid_long, '##############', '.', ',' )  &  '&zoom=$(var_zoom)'  &  '&size='&map_size_x&'x'&map_size_y  &  '&sensor=false'  &  '&maptype='&var_maptype

Google Map Disappeared!