Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

initial zoom size of google map

Hi All,

Thanks for your time,

could anyone please help on how we can increase the initial zoom size of the map - that is when we open the file

this is what  I have now

ss1.png

since it is very small we were asked to increase the zoom size so that something similar like below

ss2.png

I have the qvw file but it is too big

Thanks

Rj

4 Replies
Highlighted
Partner
Partner

Re: initial zoom size of google map

Hi,

go under the properties of the chart:

- Cololor->Dynamic Image:

Here you have something like this:

- ='http://maps.google.com/staticmap?center='  &  num(var_mid_lat, '##############', '.', ',' )   &  ','  &  num(var_mid_long, '##############', '.', ',' )   &  '&zoom=$(var_zoom)'  &  '&maptype='&var_maptype  &  '&size='&map_size_x&'x'&map_size_y  &  '&key='&gmap_key & '&.jpg'  

The zoom parameter influences the zoom level. Try to give a look on it...

Cheers,

Patric

Highlighted
Contributor III
Contributor III

Re: initial zoom size of google map

Hi Patric

I the variable used for zoom size is only effective when we click on the map - I think this is what the zoom is used for

(Please correct me if I am wrong) - but what I want is the initial zoom that is as soon as we open the qvw file we see the map right? - this is what I was referring to

I have two different maps one for emp location and another for where the requirement is - that's why using two different set of variables
gmap_key = ;
max_zoom_level = 10; //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=    '640';
map_size_y=    '400';
var_mid_lat2= '=min(Latitude2)+(1+var_lat_offset)*((max(Latitude2)-min(Latitude2))/2)';
var_mid_long2= '=min(Longitude2)+(max(Longitude2)-min(Longitude2))/2';
var_zoom2= '=max(aggr(if(max( round(256*pow(2,(_zoom_level -1)))+( Longitude2  *((256*pow(2,_zoom_level ))/360)) )-min( round(256*pow(2,(_zoom_level -1)))+( Longitude2  *((256*pow(2,_zoom_level ))/360)) ) <map_size_x AND max((256*pow(2,(_zoom_level-1)))+((0.5*log((1+(sin((Latitude2)*pi()/180)))/(1-(sin((Latitude2)*pi()/180)))))*((-256*pow(2,_zoom_level))/(2*pi()))))-min((256*pow(2,(_zoom_level-1)))+((0.5*log((1+(sin((Latitude2)*pi()/180)))/(1-(sin((Latitude2)*pi()/180)))))*((-256*pow(2,_zoom_level))/(2*pi()))))<map_size_y,_zoom_level,1),_zoom_level))';
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
]
;

thanks a lot for your time, sorry I was off for couple of days

Rj

Highlighted
Creator II
Creator II

Re: initial zoom size of google map

Hi Patric

I the variable used for zoom size is only effective when we click on the map - I think this is what the zoom is used for

(Please correct me if I am wrong) - but what I want is the initial zoom that is as soon as we open the qvw file we see the map right? - this is what I was referring to

I have two different maps one for emp location and another for where the requirement is - that's why using two different set of variables
gmap_key = ;
max_zoom_level = 10; //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=    '640';
map_size_y=    '400';
var_mid_lat2= '=min(Latitude2)+(1+var_lat_offset)*((max(Latitude2)-min(Latitude2))/2)';
var_mid_long2= '=min(Longitude2)+(max(Longitude2)-min(Longitude2))/2';
var_zoom2= '=max(aggr(if(max( round(256*pow(2,(_zoom_level -1)))+( Longitude2  *((256*pow(2,_zoom_level ))/360)) )-min( round(256*pow(2,(_zoom_level -1)))+( Longitude2  *((256*pow(2,_zoom_level ))/360)) ) <map_size_x AND max((256*pow(2,(_zoom_level-1)))+((0.5*log((1+(sin((Latitude2)*pi()/180)))/(1-(sin((Latitude2)*pi()/180)))))*((-256*pow(2,_zoom_level))/(2*pi()))))-min((256*pow(2,(_zoom_level-1)))+((0.5*log((1+(sin((Latitude2)*pi()/180)))/(1-(sin((Latitude2)*pi()/180)))))*((-256*pow(2,_zoom_level))/(2*pi()))))<map_size_y,_zoom_level,1),_zoom_level))';
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
];

thanks a lot for your time, sorry I was off for couple of days

Rj

Highlighted
Specialist
Specialist

Re: initial zoom size of google map

Remove unwanted Longitude and Latitude records.

Hope you have latitude and longitude information for all countries in application that should be the reason it is showing the world map.