none
Bing map 8 not taking some lat/long values RRS feed

  • Question

  • Bing map API v8 is not taking longitude and latitude values of certain cities. These very values are working fine against API v7.

    What is missing with v8? Any help is appreciated.

    here is my simple code.

    <!DOCTYPE html>
    <html>
    <head>
        <title></title>
        <meta charset="utf-8" />
        <script  type='text/javascript'  src='http://www.bing.com/api/maps/mapcontrol'></script> 
        <script type='text/javascript'>
    
            var infobox, map;
            var lat; var long;
            var lat = 42.8607025; var long = -83.01992;
            //var lat = 42.34694; var long = -83.5327148;
            //var lat = 42.34696; var long = -83.5316544;
            var strPinNum = "";
            var arrPoints = new Array();
            var strPushPinImage = "images/MIMMapMarkerGreen.png";
            //Define an HTML template for a custom infobox.
            var infoboxTemplate = '<div class="customInfobox" style="width:250px;background: white;border: 1px solid #cecece;align:center;font-family:Arial; font-size:x-small;">{description}</div>';
    
            function GetMap() {
                map = new Microsoft.Maps.Map('#myMap', {
                    credentials: 'Bing Maps Key'
                });
    
                for (var i = 0; i < 5; i++) {
                    if (i == 0) {                    
                        lat = 42.34694; long = -83.5327148;
                    }
                    if (i == 1) {                    
                        lat = 42.34696; long = -83.5316544;
                    }
                    if (i == 2) {                    
                        lat = 40.34729; long = -83.53115;
                    }
                    if (i == 3) {                    
                        lat = 42.3442841; long = -83.54211;
                    }
                    if (i == 4) {
                        lat = 42.44695; long = -83.5134659;
                    }
    
                    var ll = new Microsoft.Maps.Location(lat, long);
    
                    arrPoints[i] = ll;
    
                    var center = map.getCenter();
    
                    strPinNum = "" + (i + 1);           
    
                    //Create custom Pushpin
                    var pin = new Microsoft.Maps.Pushpin(ll, {
                        icon: strPushPinImage,
                        text: strPinNum,
                        subTitle: 1,
                        textOffset: new Microsoft.Maps.Point(0, 1),
                    });
    
                    //Add the pushpin to the map
                    map.entities.push(pin);
                }
            }     
    
        </script>
    </head>
    <body onload ="GetMap()">
        <div id="myMap" style=";width:600px;height:400px;margin:200px"></div>
    </body>
    </html>
    


    Thursday, September 8, 2016 7:34 PM

Answers

  • To test I commented out "icon: strPushPinImage," since I don't have your image. I see all the pushpins render, although pins 1, 2,4, and 5 are all really close together and as such overlap a lot. Zooming in I can see all the pushpins. Looking at your coordinate values, they are very close together. I don't see anything wrong here. V7 had a different icon that had a lot of white space around it which might have helped you see some of it.

    [Blog] [twitter] [LinkedIn]


    Friday, September 9, 2016 1:03 AM