10 Replies Latest reply: Oct 15, 2013 7:57 AM by Daniel Viklinder RSS

    Qlikview maps enterprise

    Adam Davies

      Hi All,

       

      Did anyone ever get google maps working in Qlikview when using a crypto key?

      I've had a good look around and can't seem to find anyone who has managed it due to the need to convert the key from base64.

        • Re: Qlikview maps enterprise
          Advait Thakur

          Hi Adam,

          Which version of Google Map you are using..!! To integrate with qlikview now..use Google Map latest is API v2.

           

          Also have you tried replacing..

          Base64 crypto-key, replace "/" with "_" and replace "+" with "-".

           

          Hope this is helpful for you.

           

          Thanks

          Advait

          • Re: Qlikview maps enterprise
            Adam Davies

            Yes I can integrate it and have my maps working etc, but currently only in testing as I am using the free api key.

             

            We have paid for the enterprise key but in all honesty the instructions on how to use it threw me a bit!

             

            I've discovered the java extension for QV so I might see if I can integrate it that way,

              • Re: Qlikview maps enterprise

                I am also working on Google Map in QlikView.

                Can you give an example on how to generate the signature using the crypto key and the Client ID in QlikView?

                I am confused with it.

                  • Re: Qlikview maps enterprise
                    Adam Davies

                    Someone replied to my post on the main extensions thread:

                     

                    Sure and it's actually very straight forward. Since this extensions utilizes the javascript API which is considered a client side API you don't need to sign your urls.

                     

                    First you would have to log into your Google Maps Support Portal. There you add your urls that's allowed to use your client ID.

                    For example http://my_internal_network/

                     

                    Second open up the script.js file and change this line

                    1. Qva.LoadScript('https://maps.google.com/maps/api/js?sensor=false&callback=map_init')

                    to:

                    1. Qva.LoadScript('https://maps.googleapis.com/maps/api/js?client={gme-yourclientid}&sensor=false&callback=map_init')

                    Replace {gme-yourclientid} with your Google ID and you are done 

                     

                    One benefit of business version is that you can also track your google maps usage that's coming from qlikview.

                    Add for example &channel=qlikview to your url and every request that's coming from qlikview will be tagged and will appear in your usage report from Google.

                      • Re: Qlikview maps enterprise

                        Hi, where can I find the script.js? And should I put this file?

                          • Re: Qlikview maps enterprise
                            Adam Davies

                            Hi,

                             

                            have a read of the main extension thread, which should help!

                            http://community.qlik.com/message/334885#334885

                              • Re: Qlikview maps enterprise

                                Hi,

                                 

                                The main extension thread doesn't work for Google Enterprise version. It only works for the FREE version, where you will not able see the utilization in Google map's traffic report.

                                 

                                I have worked with my IT Apps development team and figured out a workaround on this.

                                 

                                We can't embed the crypto key page inside QlikView. So we hosted the page outside Qlikview in a webserver. The page can be a C# or java or php, etc,  Just have to download the same code from Google API developer page.
                                https://developers.google.com/maps/documentation/business/webservices

                                 

                                Then we modified the page to receive the parameters such as Client ID, Map type, size, zoom, center, etc which needed for google map. the page will take all the parameters can generate the Signature key with the new URL. And it will redirect the link to Google map. In return, the QlikView will call the page (instead of Google Map), and will able display the Google map correctly.

                                 

                                Sample PHP Code which I am using for reference:

                                 

                                 

                                 

                                <?php

                                 

                                // Encode a string to URL-safe base64

                                function encodeBase64UrlSafe($value)

                                {

                                  return str_replace(array('+', '/'), array('-', '_'), base64_encode($value));

                                }

                                 

                                // Decode a string from URL-safe base64

                                function decodeBase64UrlSafe($value)

                                {

                                  return base64_decode(str_replace(array('-', '_'), array('+', '/'),

                                    $value));

                                }

                                 

                                // Sign a URL with a given crypto key

                                // Note that this URL must be properly URL-encoded

                                function signUrl($myUrlToSign, $privateKey)

                                {

                                  // parse the url

                                  $url = parse_url($myUrlToSign);

                                 

                                  $urlPartToSign = $url['path'] . "?" . $url['query'];

                                 

                                  // Decode the private key into its binary format

                                  $decodedKey = decodeBase64UrlSafe($privateKey);

                                 

                                  // Create a signature using the private key and the URL-encoded

                                  // string using HMAC SHA1. This signature will be binary.

                                  $signature = hash_hmac("sha1",$urlPartToSign, $decodedKey,  true);

                                 

                                  $encodedSignature = encodeBase64UrlSafe($signature);

                                 

                                  return $myUrlToSign."&signature=".$encodedSignature;

                                }

                                 

                                 

                                 

                                $URL = "http://maps.googleapis.com/maps/api/staticmap?";

                                $center = "center=".$_GET["center"];

                                $zoom = "&zoom=".$_GET["zoom"];

                                $maptype = "&maptype=".$_GET["maptype"];

                                $size = "&size=".$_GET["size"];

                                $sensor = "&sensor=false";

                                $client = "&client=YOURGOOGLEMAP_CLIENTID";

                                $specialkey = "YOURGOOGLEMAP_CRYPTOKEY="

                                $URL = $URL.$center.$zoom.$maptype.$size.$sensor.$client;

                                 

                                header('Location: '.signUrl($URL, $specialkey));

                                 

                                ?>

                                 

                                Hope this helpful to anyone who is looking for the solution