Skip to content

help(map-directions-renderer): Can't display multiple routes #26693

Open
@brendan343

Description

@brendan343

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

hi real beginner here with this but i'm trying to display all the routes on the maps using the below as per the documentation within the html:
<map-directions-renderer *ngIf="(dResultTransit | async) as directionsResults1" [directions]="directionsResults1"></map-directions-renderer>

i have the request to provide route alternatives:
let request: google.maps.DirectionsRequest = { origin: this.origin, destination: this.destination, travelMode: google.maps.TravelMode.TRANSIT, provideRouteAlternatives: true, transitOptions: { modes: transitMode, routingPreference: this.transitPreference }, }

this is followed with providing the dResultTransit as defined:
dResultTransit: Observable<google.maps.DirectionsResult | undefined> | undefined;

this.dResultTransit = this.DirectionsServiceTransit.route(this.TransitRequest()).pipe(map(response => response.result));

Reproduction

Steps to reproduce:

  1. I tried different travel modes and turning off the provide route alternatives to ensure the displaying of the routes is correct
  2. I tried using different machines and os and i am getting the same result

Expected Behavior

I expect 4 routes to be displayed as per below
image

Actual Behavior

however, this is only currently displaying 1 route.
image

Environment

  • Angular: 15.0.5
  • CDK/Material: 15.1.4
  • Browser(s): Google Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): macOS and Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: google-maps

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions