none
Customizing Waypoint/Viapoint Pushpins and Labels in V8 RRS feed

  • Question

  • I'm currently migrating an application from V7 to V8 and what I had done in the was to hide the waypoints and viapoints. I just used custom icon pushpins to mark start/end/via points on the route.

    var map = new Microsoft.Maps.Map(document.getElementById('myMap'), {
        credentials: bingMapCredentials,
        showDashboard: false
    });
    
    var directionsManager = new Microsoft.Maps.Directions.DirectionsManager(map);
    // Specify handlers for the 2 possible outcomes of the route calculation
    Microsoft.Maps.Events.addHandler(directionsManager, 'directionsError', displayError);
    Microsoft.Maps.Events.addHandler(directionsManager, 'directionsUpdated', processSuccess);
    
    directionsManager.setRenderOptions({
        waypointPushpinOptions: { visible: false },
        viapointPushpinOptions: { visible: false },
        autoUpdateMapView: false
    });

    I can't find the waypointPushpinOptions or viapointPushpinOptions in the documentation for setRenderOptions(DirectionsRenderOptions Object). Is there a way to hide the waypointPushpins or viapointPushpins?

    There is also text being displayed with the longitude and latitude of the waypoint/viapoint beside the pushpins. Is there a way to hide this text as well?


    • Edited by Tom Conneely Thursday, May 11, 2017 11:40 AM More specific title
    Thursday, May 11, 2017 11:22 AM

Answers

  • You can't find these in the documentation as they are not currently supported. customization of the route style has only just been added to the experimental branch of V8. The following options can be used to customize the route rendering: waypointPushpinOptions, firstWaypointPushpinOptions, lastWaypointPushpinOptions, drivingPolylineOptions, walkingPolylineOptions, transitPolylineOptions

    [Blog] [twitter] [LinkedIn]

    Monday, May 15, 2017 4:23 PM
  • Are you using the experimental branch? This isn't yet supported in the main release branch. It will be added in a couple of weeks.

    [Blog] [twitter] [LinkedIn]

    Wednesday, May 17, 2017 12:49 AM
  • This is coming soon. I've already seen the code for this. Think it may still be in review or queued to be added to the experimental branch after the team finishes pushing out an update to the release branch early next week. There will be another update to the release branch in the not too distant future as well.

    [Blog] [twitter] [LinkedIn]

    Thursday, June 8, 2017 1:52 AM

All replies

  • You can't find these in the documentation as they are not currently supported. customization of the route style has only just been added to the experimental branch of V8. The following options can be used to customize the route rendering: waypointPushpinOptions, firstWaypointPushpinOptions, lastWaypointPushpinOptions, drivingPolylineOptions, walkingPolylineOptions, transitPolylineOptions

    [Blog] [twitter] [LinkedIn]

    Monday, May 15, 2017 4:23 PM
  • I have tried setting the waypointPushpinOptions and viapointPushpinOptions visible to false and there is some strange behaviour even when I try it with the Bing Maps V8 Interactive SDK

    When I ran the following code on the Bing Maps V8 Interactive SDK instead of the waypoints disappearing, the appearance changes and the name of the waypoint appears both above and below. This happens for both the experimental and released branches

    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'),
    		waypointPushpinOptions: {visible: false},
    		viapointPushpinOptions: {visible: false}
    	});
        directionsManager.calculateDirections();
    });
    

    Is the option to remove the waypoint and viapoint markers available or is it coming soon?

    Tuesday, May 16, 2017 11:18 AM
  • Are you using the experimental branch? This isn't yet supported in the main release branch. It will be added in a couple of weeks.

    [Blog] [twitter] [LinkedIn]

    Wednesday, May 17, 2017 12:49 AM
  • I checked the Bing Maps V8 SDK using both the released and experimental branches using the code above and it had similar behaviour. The waypoint pushpins were not removed.
    Wednesday, May 17, 2017 8:45 AM
  • The team just checked this in yesterday. It likely will take a day or two for it to roll out to the experimental branch.

    [Blog] [twitter] [LinkedIn]

    Wednesday, May 17, 2017 5:02 PM
  • I've had a look at the experimental branch over the past 2 weeks and while the text error looks to be resolved I still can't hide the default pushpins and use my own custom pushpins.

    When I ran the following code on the Bing Maps V8 Interactive SDK I can still see the default pushpins when they should be hidden.

    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'),
    		waypointPushpinOptions: {visible: false},
    		viapointPushpinOptions: {visible: false}
    	});
        directionsManager.calculateDirections();
    });

    Will this be added to the experimental branch soon? Will this be fixed before V7 is deprecated at the end of this month?

    Wednesday, June 7, 2017 7:57 AM
  • This is coming soon. I've already seen the code for this. Think it may still be in review or queued to be added to the experimental branch after the team finishes pushing out an update to the release branch early next week. There will be another update to the release branch in the not too distant future as well.

    [Blog] [twitter] [LinkedIn]

    Thursday, June 8, 2017 1:52 AM