Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
35
igMap with Bing session
posted

Hi there,

Is it possible to use an igMap control with Bing and create a session for each user who lands on the page? Ultimately, we want to minimize the number of billable transactions when users load the map, pan, zoom, etc.

This post speaks on using sessions: https://blogs.bing.com/maps/2012/02/01/bing-maps-reporting-tips

Thanks!

Parents
  • 35
    Offline posted

    The way I have my map setup is with the following:

    I am creating a Bing map, and collecting the session key

        <script type='text/javascript'>
    
            var map, sessionKey;
    
            function GetMap() {
                map = new Microsoft.Maps.Map('#myMap');
    
                //Get a session key from the map and use with the REST services to make requests non-billable transactions.
                map.getCredentials(function (c) {
                    sessionKey = c;
                });
            }
        </script>
    
    
        <script type='text/javascript' src='https://www.bing.com/api/maps/mapcontrol?callback=GetMap&key=[MY_BING_API_KEY]' async="async" defer="defer"></script>

    Then I use that session key with the igMap

            $(chartID).igMap({
                backgroundContent: {
                    type: "bing",
                    key: sessionKey,
                    bingUrl: "https://dev.virtualearth.net/rest/v1/imagery/metadata/",
                    imagerySet: "AerialWithLabels"
                }
            })

    Is there anyway for me to know if the session key is working as intended?

Reply Children
No Data