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!
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?
Hi Drew,
You are using the igMap corresponding API as expected. If the requests to download map image tiles are successful and the igMap renders the images, then yes, your key is working. If by "working as intended" you mean staying in the same Bing Maps session, this is out of my competence to say - but it seems you are correctly doing what is suggested in the Bing Maps blog - use the corresponding session key.