none
Bing map key for a localhost call RRS feed

  • Question

  • Hi all,

    I got bing maps AJAX v7 to work on a local app that luanchs and shows on my mobile phone via of the phone's browser. But I used a map key targetted to a hosting server. But while testing the app, the maps simply stop showing up. I throught in might the map key. So, I tried the create a new one. The key page offers no keys to be tied to the localhost browser device.

    What can I do?

    Sincerely,

    King


    • Edited by King Coffee Monday, September 10, 2012 8:40 PM
    Monday, September 10, 2012 8:40 PM

Answers

  • Thanks Richard,

    Sorry, I found the problem. I inadvertently deleted the line that initiates the map object:

            map = new Microsoft.Maps.Map(document.getElementById("myMap"), mapSettings);

    Thanks,

    King  


    King Coffee

    • Marked as answer by King Coffee Tuesday, September 11, 2012 10:49 PM
    Tuesday, September 11, 2012 10:49 PM

All replies

  • Can you provide a bit more information around how to have the AJAX V7 control working in a local app. Did you copy the JavaScript code to your device or ar you loading it into a web browser control from the web?

    http://rbrundritt.wordpress.com

    Tuesday, September 11, 2012 7:32 AM
  • The following code is the HTML the local browser app is loading...

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <style type="text/css">
    .myMapStyle
    {
        width:100%;
        height:500px;
    }
    </style>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <script charset="UTF-8" type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>
     
    <script type="text/javascript">
        var map = null;
        function GetMap() {
            // Initialize the map
            var mapSettings = {
                // MapOptions
                credentials: "MAP KEY WAS HERE",
                // ViewOptions
                // default to roughly center of USA.
                center: new Microsoft.Maps.Location(40, -95),
                // this gives a combo arial and birdseye in v7
                mapTypeId: Microsoft.Maps.MapTypeId.birdseye, 
            padding: 1,
                zoom: 4 // shows the whole USA
            };
        }
     
        function Pin() {
            //map.entities.clear();
            map.setView({ zoom: 10, center: new Microsoft.Maps.Location(44, -73) });
            var pushpin = new Microsoft.Maps.Pushpin(map.getCenter(), null);
            map.entities.push(pushpin);
     
            Microsoft.Maps.Events.addHandler(pushpin, 'click', save);
         }
     
        save = function (e) {
            alert("SAVE");
        }
     
       function getUrlVars() {
           var vars = {};
           var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) {
               vars[key] = value;
           });
           return vars;
           // Example of value parses
           //var first = getUrlVars()['id'];
           //var second = getUrlVars()['page'];
       }
    </script>
    </head>
    <body>
        <div id="myMap" class="myMapStyle" />
        <script type="text/javascript">
            GetMap();
            //Pin();
        </script>
    </body>
    </html>
    

    King Coffee

    Tuesday, September 11, 2012 4:27 PM
  • Thanks Richard,

    Sorry, I found the problem. I inadvertently deleted the line that initiates the map object:

            map = new Microsoft.Maps.Map(document.getElementById("myMap"), mapSettings);

    Thanks,

    King  


    King Coffee

    • Marked as answer by King Coffee Tuesday, September 11, 2012 10:49 PM
    Tuesday, September 11, 2012 10:49 PM