17 Replies Latest reply: Jul 9, 2012 3:42 AM by ervin jafari RSS

    How to change zoom levels in Google Map?

      I am currently using a Google map scatter chart, but my data points are plotting to a different zoom level.

      new.JPG

      The red should completly overlay the US. How do I change the zoom levels so this is correct?

        • How to change zoom levels in Google Map?
          Ralf Becher

          Hi,

           

          there is probably an error in your axes formulas. Can you post some example?

           

          - Ralf

            • Re: How to change zoom levels in Google Map?

              X Axis:

              Static Min: =(256*pow(2,($(var_zoom)-1)))+( var_mid_long  *((256*pow(2,$(var_zoom)))/360)) -round(map_size_x/2)

               

              Static Max:  =((256*pow(2,($(var_zoom)-1)))+( var_mid_long  *((256*pow(2,$(var_zoom)))/360)) + round(map_size_x/2))

               

               

              Y Axis:

              Static Min:   =((256*pow(2,($(var_zoom)-1)))+((0.5*log((1+(sin(var_mid_lat*pi()/180)))/(1-(sin(var_mid_lat*pi()/180)))))*((-256*pow(2,$(var_zoom)))/(2*pi())))+round(map_size_y/2))

               

              Static Max:  =((256*pow(2,($(var_zoom)-1)))+((0.5*log((1+(sin(var_mid_lat*pi()/180)))/(1-(sin(var_mid_lat*pi()/180)))))*((-256*pow(2,$(var_zoom)))/(2*pi())))-round(map_size_y/2))

               

               

              Longitude:

               

              =round (256*pow(2,($(var_zoom)-1)))+( Longitude *((256*pow(2,$(var_zoom)))/360))

               

               

              Latitude:

               

              =sum((256*pow(2,($(var_zoom)-1)))+((0.5*log((1+(sin((Latitude)*pi()/180)))/(1-

              (sin((Latitude)*pi()/180)))))*((-256*pow(2,$(var_zoom)))/(2*pi()))))

                • How to change zoom levels in Google Map?

                  try where says  max_zoom_Leel = #  (Could be from 1 to 17)

                   

                   

                    • Re: How to change zoom levels in Google Map?

                      Do you mean on the script?

                      This is my script for the map

                       

                      //// 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
                      def_zoom_level = 1;
                      def_map_size = 757;
                      //// Variables required for calculating map
                      //// No need to change these
                      var_pi180= '=pi()/180';
                      var_lat_offset= '0';
                      var_long_offset= '0';
                      var_mc2= '=256*pow(2,$(var_zoom))';
                      var_mc1= '=256*pow(2,($(var_zoom)-1))';
                      var_mid_lat= '=median(Latitude)';
                      var_mid_long= '=median(Longitude)';
                      var_zoom= '=If(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)) )
                      <def_map_size 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()))))<def_map_size,_zoom_level,null()),_zoom_level))>def_zoom_level,
                      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)) ) <def_map_size 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()))))<def_map_size,_zoom_level,null()),_zoom_level)),def_zoom_level)';
                      var_maptype= '=if(isnull(only(maptype)),fieldvalue( '&chr(39)&'maptype'&chr(39)&', 4 ),maptype)';
                      //// Field required for calcualting best zoom level
                      SET HidePrefix='_' ;
                      _zoom_level:
                      Load RecNo( ) as _zoom_level autogenerate(max_zoom_level);
                      maptype:
                      LOAD * INLINE [
                      Maptype
                      roadmap
                      mobile
                      satellite
                      terrain
                      hybrid
                      ];
                      
                      • Re: How to change zoom levels in Google Map?
                        ervin jafari

                        You can change the "max_zoom_level" variable in your edit script.

                         

                        max_zoom_level = 13; //maximum 17

                      • How to change zoom levels in Google Map?
                        Ralf Becher

                        please also list all variables...

                          • How to change zoom levels in Google Map?
                            Ralf Becher

                            map_size_x

                            map_size_y

                            ?

                            • How to change zoom levels in Google Map?

                              max_zoom_level = 17
                              def_zoom_level = 1
                              def_map_size = 757

                              var_pi180= '=pi()/180'
                              var_lat_offset= '0'
                              var_long_offset= '0'
                              var_mc2= '=256*pow(2,$(var_zoom))'
                              var_mc1= '=256*pow(2,($(var_zoom)-1))'
                              var_mid_lat= '=median(Latitude)'
                              var_mid_long= '=median(Longitude)'
                              var_zoom= '=If(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)) )
                              <def_map_size 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()))))<def_map_size,_zoom_level,null()),_zoom_level))>def_zoom_level,
                              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)) ) <def_map_size 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()))))<def_map_size,_zoom_level,null()),_zoom_level)),def_zoom_level)';
                              var_maptype= '=if(isnull(only(maptype)),fieldvalue( '&chr(39)&'maptype'&chr(39)&', 4 ),maptype)'

                        • Re: How to change zoom levels in Google Map?

                          Well I just got it working. apparently it wants to be set to size 400, even if the actuall chart is not that size.

                          I changed the def_map_size to 400 and map_size_x and map_size_y to 400 and it is working fine.

                           

                          I would have thought it would need the map sizes set to the actuall size of the chart but I guess not. Thank you everyone for your help.

                          working.JPG

                          • How to change zoom levels in Google Map?

                            This is a test google maps script, try to paste this script but replace my tables for yours.

                             

                            I hope it works

                            Directory

                             

                             

                            ;
                            LOAD CVE_ENT,
                            LATITUD as latitude,
                            LONGITUD as longitude,
                            Sales
                            FROM
                            [Test.xls]
                            (
                            biff, embedded labels, table is [GeoReferencias de Capitales$]);

                            Directory ;
                            LOAD CVE_ENT,
                            NOM_ENT,
                            NOM_CAP
                            FROM
                            Entities.txt
                            (
                            txt, codepage is 1252, embedded labels, delimiter is '\t', msq);




                            // 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 = 'ABQIAAAAcp0AySnPCjkFsX1ukx37JBRd_q69DwA9dHzVTF_BRL-tjELfnhRLkdiZnQyeO2UGKF2vSlMENmZ5zQ';
                            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=         '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
                            ]
                            ;