locked
PushPins not loading on some Maps RRS feed

  • Question

  • We are working on the transition from Bing Maps v7 to v8.  We use the map to draw a flight line and then pushpins to indicate points along the flight path.  For some of our maps everything loads perfect, for others only the flight path will load.  For the maps that only display the flight path, when the maps loads the Bing Map controls (change view, zoom, etc.) also don't show up right away, it takes about 10 seconds.  Additionally, the labels for cities, streets, etc. also don't ever load.

    I have reviewed the data closely and there are no nulls or anything different about the datasets that load and the ones that don't.  Any suggestions?


    Tuesday, October 31, 2017 11:09 PM

All replies

  • A couple of things to try. First make sure you are using a supported browser IE11, Edge, Chrome or safari on mac. Next, ensure you are using the callback in the map script URL to call you function for loading the map. This ensures that the map API is downloaded and ready to be used. If you still have issues, try putting the map into lite mode by adding liteMode: true as a map option when loading. This will have the labels render on the map tiles server side similarly to v7 and should help loading speed.


    [Blog] [twitter] [LinkedIn]

    Wednesday, November 1, 2017 1:20 AM
  • I have tried in Edge, Chrome and FireFox, same result in all 3.  

    Tried adding LiteMode and that didn't have any effect.

    Scrutinized the data and don't see any difference in the maps that load correctly (flight path and indications) and the ones that only load the flight path.

    Code:

    <script charset="UTF-8" type="text/javascript" src="http://www.bing.com/api/maps/mapcontrol"></script>

    <body onload="GetMap();">

     <script type="text/javascript">
         var map;
         function GetMap() {
             var ua = window.navigator.userAgent;
             var msie = ua.indexOf("MSIE ");
             var ver;
             var mapOptions;

             if (msie > 0) {     // If Internet Explorer, return version number
                 ver = parseInt(ua.substring(msie + 5, ua.indexOf(".", msie)));
             } else {                // If another browser, return 0
                 ver = 0;
             }

             if (ver < 7 && ver > 0) {
                 mapOptions = {
                     credentials: "xxx", mapTypeId: Microsoft.Maps.MapTypeId.auto,
                     enableClickableLogo: false, enableSearchLogo: false, height: 600, width: 800, disableScrollWheelZoom: true, offset: 1, liteMode: true
                 };
             } else {
                 mapOptions = {
                     credentials: "xxx", mapTypeId: Microsoft.Maps.MapTypeId.auto,
                     enableClickableLogo: false, enableSearchLogo: false, disableScrollWheelZoom: true, offset: 1, liteMode: true
                 };
             }
             map = new Microsoft.Maps.Map(document.getElementById('mapDiv'), mapOptions);

             Microsoft.Maps.Events.addHandler(map, 'viewchange', hideInfobox);

             DrawEffects();
         }

    DrawEffects Pushpin code

    MapScript.Append("var loc = new Microsoft.Maps.Location(" + yC + "," + xC + ");")
                    MapScript.Append("var pushpin = new Microsoft.Maps.Pushpin(loc);")
                    MapScript.Append("Microsoft.Maps.Pushpin.prototype.title = null;")
                    MapScript.Append("pushpin.title = 'Marker " + cRow("Marker") + "';")

                    If Not IsDBNull(cRow("MarkerDT")) Then
                        MapScript.Append("var myDesc = 'FlightDate(MST): " + CStr(cRow("MarkerDT")) + "<br>';")
                    Else
                        MapScript.Append("var myDesc = 'FlightDate(MST): <br>';")
                    End If
                    MapScript.Append("myDesc = myDesc + 'Indication Size: " + cRow("Size") + "<br>';")
                    MapScript.Append("myDesc = myDesc + 'Description: " + cRow("Visual") + "<br>';")
                    MapScript.Append("myDesc = myDesc + 'Wind: " + cRow("Wind") + "<br>';")
                    MapScript.Append("myDesc = myDesc + 'Lat: " + CStr(yC) + " Long:" + CStr(xC) + " <br>';")
                    MapScript.Append("Microsoft.Maps.Pushpin.prototype.description = null;")
                    MapScript.Append("pushpin.description = myDesc;")
                    MapScript.Append("Microsoft.Maps.Pushpin.prototype.Image = null;")
                    MapScript.Append("pushpin.Image = '" + GetExistingThumb(m_clientFK, m_UniqID, cRow("Marker")) + "';")
                    MapScript.Append("Microsoft.Maps.Pushpin.prototype.Link = null;")
                    MapScript.Append("pushpin.Link = 'ImgDetail.aspx?UID=" + CStr(m_User) + "&CFID=" + CStr(m_CFID) + "&MID=" + cRow("Marker") + "&UNIQ=" + m_UniqID + "';")
                    MapScript.Append("pushpinClick = Microsoft.Maps.Events.addHandler(pushpin, 'mouseover', displayEventInfo);")
                    MapScript.Append("Microsoft.Maps.Events.addHandler(map, 'viewchangestart', closeInfoBox);")
                    MapScript.Append("map.entities.push(pushpin);")

    Wednesday, November 1, 2017 2:20 PM
  • Maybe a timeout issue?  I took the code to draw the flight line out and the pushpins load fine, seems like I can only load one or the other for these maps that have hundreds of miles on the flight path. Never had any issues loading with v7.
    • Edited by TimLasen Wednesday, November 1, 2017 2:38 PM
    Wednesday, November 1, 2017 2:37 PM
  • I'm not sure on this, haven't seen this before. Can't test at the moment as away on vacation without computer. Tty adding all pushpins and the flight path to and array first then adding that array to the map.

    [Blog] [twitter] [LinkedIn]

    Thursday, November 2, 2017 4:17 AM