Question

Loving Google Maps API V3, but having difficulty in getting accurate driving directions and manipulating the destination address displayed when using DirectionsRenderer.

Regardless if I pass an address string or a latLng instance as the destination to DirectionsService, when I use the DirectionsRenderer to output step-by-step directions, the destination text is always the geocoded result of my original destination (i.e. the address, rather than COMPANY NAME).

Ideally, I want to pass a precise latLng destination to DirectionsService, but control the text displayed as the 'destination'.

I guess I could manually output the HTML, but part lazy, part not wanting to re-invent the wheel, would prefer to use DirectionsRenderer.

Any ideas?

Was it helpful?

Solution

You may use:

response.routes[0].legs[0].end_address="Company";

before calling

directionsDisplay.setDirections(response);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top