none
Directions Module maptype label issue RRS feed

  • Question

  • Hi, 

    I have noticed an issue when switching to the Grey or Dark road type after putting driving directions on the map. I tested in the interactive SDK with the following code:

    var map = new Microsoft.Maps.Map(document.getElementById('myMap'), {
        credentials: 'Your Bing Maps Key',
        center: new Microsoft.Maps.Location(47.606209, -122.332071),
        zoom: 12
    });
    Microsoft.Maps.loadModule('Microsoft.Maps.Directions', function () {
        var directionsManager = new Microsoft.Maps.Directions.DirectionsManager(map);
        // Set Route Mode to driving
        directionsManager.setRequestOptions({ routeMode: Microsoft.Maps.Directions.RouteMode.driving });
        var waypoint1 = new Microsoft.Maps.Directions.Waypoint({ address: 'Redmond', location: new Microsoft.Maps.Location(47.67683029174805, -122.1099624633789) });
        var waypoint2 = new Microsoft.Maps.Directions.Waypoint({ address: 'Seattle', location: new Microsoft.Maps.Location(47.59977722167969, -122.33458709716797) });
        directionsManager.addWaypoint(waypoint1);
        directionsManager.addWaypoint(waypoint2);
        // Set the element in which the itinerary will be rendered
        directionsManager.setRenderOptions({ itineraryContainer: document.getElementById('printoutPanel') });
        directionsManager.calculateDirections();
        
        map.setMapType('cg');
    });

    And I get the following js error:

    7d67c250.js?bu=rms+answers+Maps+AnonymousBegin*MapDelay.en*TemplatingPluginStart*Template*ControlTe…:1 Uncaught TypeError: Cannot read property 'x' of null
        at n.getBounds (7d67c250.js?bu=rms+answers+Maps+AnonymousBegin*MapDelay.en*TemplatingPluginStart*Template*ControlTe…:1)
        at Function.n.getIconBounds (dc4032f2.js?bu=rms+answers+Maps+AnonymousBegin*LabelsPluginStart*LabelKey*LabelRegionBounds*Label*I…:1)
        at i._getIconRegion (dc4032f2.js?bu=rms+answers+Maps+AnonymousBegin*LabelsPluginStart*LabelKey*LabelRegionBounds*Label*I…:1)
        at i._initializeLabelRegions (dc4032f2.js?bu=rms+answers+Maps+AnonymousBegin*LabelsPluginStart*LabelKey*LabelRegionBounds*Label*I…:1)
        at i.n.initializePosition (dc4032f2.js?bu=rms+answers+Maps+AnonymousBegin*LabelsPluginStart*LabelKey*LabelRegionBounds*Label*I…:1)
        at t.computeRenderables (dc4032f2.js?bu=rms+answers+Maps+AnonymousBegin*LabelsPluginStart*LabelKey*LabelRegionBounds*Label*I…:1)
        at t._processPrimitivesChangedMessage (dc4032f2.js?bu=rms+answers+Maps+AnonymousBegin*LabelsPluginStart*LabelKey*LabelRegionBounds*Label*I…:1)
        at t._processMessage (dc4032f2.js?bu=rms+answers+Maps+AnonymousBegin*LabelsPluginStart*LabelKey*LabelRegionBounds*Label*I…:1)
        at Object.i [as action] (dc4032f2.js?bu=rms+answers+Maps+AnonymousBegin*LabelsPluginStart*LabelKey*LabelRegionBounds*Label*I…:1)
        at n._tick (1c0485c0.js?bu=rms+answers+Maps+AnonymousBegin*MapCore.en*MapCoreBegin*LabelOptions*LocalStorageCac…:1)

    Tuesday, July 11, 2017 2:09 PM

Answers