3 Replies Latest reply: Nov 4, 2013 5:40 AM by Gysbert Wassenaar RSS

    google maps does not appear in QV

      Hi all,

       

      I always use a google map in qv. But recently, the image no longer appears. When I look at properties/colors then I see the following link:

       

      ='https://maps.google.com/staticmap?center='&Replace(var_mid_lat_c,',','.')&','&Replace(var_mid_long_c,',','.')&'&zoom=$(var_zoom_c)'&'&maptype='&var_maptype&'&size='&def_map_size_w&'x'&def_map_size_h&'&.jpg'

       

      1.JPG.jpg

       

      does anyone know why the image is no longer visible? I think it has to do with the link.

       

      Greetings,

       

      Hans Steenhuis

        • Re: google maps does not appear in QV
          Gysbert Wassenaar

          That looks like you're using the old V2 api which has been deprecated. You'll need to use the V3 api now.

          See this discussion: http://community.qlik.com/message/335685#335685

            • Re: google maps does not appear in QV

              Thanks a lot for your comment. I change the code in:

               

              ='http://maps.google.com/staticmap?key='& gmap_key & '&center='&Replace(var_mid_lat_c,',','.')&','&Replace(var_mid_long_c,',','.')&'&zoom=$(var_zoom_c)'&'&maptype='&var_maptype&'&size='&def_map_size_w&'x'&def_map_size_h&'&.jpg'

               

              In the Load screen is the folowing code:

               

              def_map_size =   '624';

              def_zoom_level = '6';

              def_map_size_h = '624';

              def_map_size_w = '624';

              var_lat_offset = '0';

              // var_mid_long_c = '=median(longitude)';

              var_mid_long_c = '=min(longitude)+(max(longitude)-min(longitude))/2';

              // var_mid_lat_c =  '=median(latitude)';

              var_mid_lat_c =  '=min(latitude)+((max(latitude)-min(latitude))/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_n =  '=if(isnull(only(maptype)),fieldvalue( '&chr(39)&'maptype'&chr(39)&', 1 ),maptype)';

              var_maptype =  '=if(isnull(only(maptype)),fieldvalue( '&chr(39)&'maptype'&chr(39)&', 1 ),maptype)';

              var_maptype_z =  '=fieldvalue( '&chr(39)&'maptype'&chr(39)&', 5 )'

              var_zoom_c =     '=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)-1';

              var_zoom_1 =     '=var_zoom_c + 1';

              var_XMin_c =     '=((256*pow(2,((var_zoom_c)-1)))+((var_mid_long_c)*((256*pow(2,(var_zoom_c)))/360))-(def_map_size*0.5))';

              var_XMax_c =     '=((256*pow(2,((var_zoom_c)-1)))+((var_mid_long_c)*((256*pow(2,(var_zoom_c)))/360))+(def_map_size*0.5))';

              var_YMin_c =     '=((256*pow(2,((var_zoom_c)-1)))+((0.5*log((1+(sin((var_mid_lat_c)*pi()/180)))/(1-(sin((var_mid_lat_c)*pi()/180)))))*((-256*pow(2,(var_zoom_c)))/(2*pi())))+(def_map_size*0.5))';

              var_YMax_c =     '=((256*pow(2,((var_zoom_c)-1)))+((0.5*log((1+(sin((var_mid_lat_c)*pi()/180)))/(1-(sin((var_mid_lat_c)*pi()/180)))))*((-256*pow(2,(var_zoom_c)))/(2*pi())))-(def_map_size*0.5))';

               

              // 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-c = '=min(latitude)+(1+var_lat_offset)*((max(latitude)-min(latitude))/2)';

              // var_mid_long-c = '=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';

               

              // 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

              ];

               

               

              Coordinaten:

              LOAD @1 as PostcodePAT,

                   Replace(@2, '.', ',') as latitude,

                   Replace(@3, '.', ',') as longitude

              FROM

              [..\Data\Google maps\pccoord.csv]

              (txt, codepage is 1252, no labels, header is 1 line, delimiter is ';', msq);

               

              I have the folowing code from Google:

               

              Key for browser apps (with referers)

              API key:

              AIzaSyCeibKbBQWHiW9kggXuo9WUL3xRf0-fkY8

              Referers:

              Any referer allowed

              Activated on: Nov 4, 2013 1:03 AM

               

              What will I have to change?

               

              Greetings,

               

              Hans