none
How to create a link that could open Bing maps application on a windows phone ? RRS feed

  • Question

  • Hi !

    I have developped a web site in ASP.NET / VB.NET with a map in one of its page. I have used the Bing maps API with AJAX.

    This works fine.

    On the map, I have put one PUSHPIN with an INFOBOX that is a location of something and an other PUSHPIN that is my location (the location of my phone under Windows phone 7.5).

    I have the GPS coordinates of my two pushpins.

    My problem is :

    I would like to put a link called "itineraire" into the INFOBOX of my first PUSHPIN that opens the Bing Maps application on my windows phone so that the user can get the way to go to any location from his location. If this is not possible, at least, the link could just open the Bing Maps application of the windows phone, positionned on the first location so that the user could click on the button to get the way from his position to the location.

    How could I do this ???

    <html>
    <head>
    <title>test bing maps</title>
    <script charset="UTF-8" type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&mkt=fr-fr"></script>
        <script type="text/javascript">
            var map = null;
            var myCredential = "xxxxxxxxxxxxxx";
            var mapOptions = {
                credentials: myCredential,
                mapTypeId: Microsoft.Maps.MapTypeId.road,
                center: new Microsoft.Maps.Location(43.62807, 0.87578),
                zoom: 10
            }
     
            function GetMap() {
                    // Initialize the map
                    map = new Microsoft.Maps.Map(document.getElementById("mapDiv"), mapOptions);
     
                    ////////////////////////////////////////////////////////////////////////////
                    // AD A PIN ON THE MAP
                    // Retrieve the location of the map center 
                    var PosCarte = map.getCenter();
                    var PosMyPin = new Microsoft.Maps.Location(43.62807, 0.87578);
     
                    // Add a pin to the center of the map
                    var pinOptions = {
                        //text: '.',
                        icon: 'http://www.mywebsite/images/MyPin.png',
                        width: 40, //50
                        height: 43, //57
                        draggable: false
                    }
                    var pin = new Microsoft.Maps.Pushpin(PosMyPin, pinOptions);
                    map.entities.push(pin);
     
                    ////////////////////////////////////////////////////////////////////////////
                    //ADD AN INFOBOX
                    // Create the infobox for the pushpin
                    pinInfobox = new Microsoft.Maps.Infobox(pin.getLocation(),
                        {
                            title: 'Mon PushPin',
                            description: 'Exemple de texte dans mon infobox.',
                            visible: false,
                            offset: new Microsoft.Maps.Point(0, 15)
                        });
                    Microsoft.Maps.Events.addHandler(pin, 'click', displayInfobox);
                    Microsoft.Maps.Events.addHandler(map, 'viewchange', hideInfobox);
                    map.entities.push(pinInfobox);           
                    ////////////////////////////////////////////////////////////////////////////
            }
            function displayInfobox(e) {
                pinInfobox.setOptions({ visible: true });
            }
            function hideInfobox(e) {
                pinInfobox.setOptions({ visible: false });
            }
        </script>
    </head>
    <body onload="GetMap();">
     
        <form id="form1" name="form1" action="" method="get" enctype="application/x-www-form-urlencoded">
            <input type="button" value="Calculate Route" onclick="ClickRoute()" />    
        </form>
    </body>
    </html>

    Thursday, October 18, 2012 2:18 PM

Answers