24 Replies Latest reply: Sep 4, 2014 6:20 AM by Ridhaa Hendricks RSS

    Google Maps API

    Juan Escobar

      Hello,

       

      I was looking some QV Dashboards and I found that I can insert a map with some information inside. How can I add this kind of object and associate the places with the information?

       

      If anyone has a demo or some code, please let me know.

       

      That will be great.

       

      Thank you very much.

        • Re: Google Maps API
          Sokkorn Cheav

          Hi Juan,

           

          To make this happen first you need coordinates (longitude / latitude)  for your location.

          See the sample attached file.

           

          Regards,

          Sokkorn

            • Google Maps API
              Juan Escobar

              Hi Sokkorn,

               

              I'm running at this time the Personal Edition so I can't open that example. I was looking at the table and I realized that I have to create something like that for Colombia.

               

              Now, which option allows me to insert the map as well and associate it with the table

               

              Thank you very much.

                • Re: Google Maps API
                  Sokkorn Cheav

                  Hi Juan,

                   

                  Let check my attached file again.

                   

                  Or try this

                  SET ThousandSep=',';
                  SET DecimalSep='.';
                  SET MoneyThousandSep=',';
                  SET MoneyDecimalSep='.';
                  SET MoneyFormat='$#,##0.00;($#,##0.00)';
                  SET TimeFormat='h:mm:ss TT';
                  SET DateFormat='M/D/YYYY';
                  SET TimestampFormat='M/D/YYYY h:mm:ss[.fff] TT';
                  SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';
                  SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';
                  //===========================================================
                  [Location]:
                  LOAD
                      RowNo()    AS ID,
                      Country, 
                      Locations, 
                      [Latitude-Degree], 
                      [Longitude-Degree], 
                      Latitude, 
                      Longitude
                  FROM
                  [Cambodia Latitude-Longitude v002.xlsx]
                  (ooxml, embedded labels, table is Sheet1);
                  //===========================================================
                  // 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_long_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';
                  
                  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];
                  

                   

                  1. Create Scatter Chart
                      . Dimension
                          - ID
                      . Expression
                          -Label1: longitude with expression =sum( round (256*pow(2,($(var_zoom)-1)))+( Longitude  *((256*pow(2,$(var_zoom)))/360)) )
                          -Label2: lattitude with expression =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())))))
                          - Locations // Pop_up text (no label)
                  2. Create List Box: maptype
                  

                  Do let me know, if this one still cannot open the file.

                   

                  Regards,

                  Sokkorn

                • Re: Google Maps API
                  Agnivesh Kumar

                  plese sen QVS file for this qvw file.

                • Re: Google Maps API

                  Hi Juan,

                   

                  Could you solve your problem? I'm trying to create a map with Colombia coordinates, I'm using "Steps to Implement Google Map in Qlikview" in QlikView PE, but it didn't work. I didn't get any symbol on the map. Could you help me?

                  • Re: Google Maps API

                    Hi Juan,

                     

                    Thanks for the file but I have Personal Edition and I can't open files. Could you share your code or tell me what exactly changed for the map work?

                     

                    Best Regards.