3

I'm using google directions in order to get a route with waypoints. I have the name of the waypoints from an previous call to the Places Api. The problem is that if I make this call:

https://maps.googleapis.com/maps/api/directions/json?origin=46.779704,23.577261&destination=46.564423,23.768673&waypoints=optimize:true|Belvedere,RO|Cheile+Turzii,RO&units=metric&sensor=false

it returns a route. But if Cluj-Napoca National Theatre is added to waypoints and the call looks like this:

https://maps.googleapis.com/maps/api/directions/json?origin=46.779704,23.577261&destination=46.564423,23.768673&waypoints=optimize:true|Belvedere,RO|Cheile+Turzii,RO|Cluj-Napoca+National+Theatre,RO&units=metric&sensor=false

it doesn't work. The response has no results. { "routes" : [], "status" : "ZERO_RESULTS" }

Can anyone please help me understand why isn't this working? Ps: with Cluj-Napoca+International+Airport,RO added instead of Cluj-Napoca+National+Theatre,RO waypoint it works.

sa_vedem
  • 757
  • 1
  • 7
  • 16

1 Answers1

5

You can try adding the coordinates of the waypoint, instead of adding the name of them.

DaJackal
  • 2,085
  • 4
  • 32
  • 48
  • Yes. The directions service uses the geocoder and can't find businesses, only postal addresses (including towns). – Andrew Leach May 21 '12 at 18:12
  • Using coordinates is a better approach. The JavaScript API for the DirectionsService includes a `google.maps.DirectionsWaypoint` class and it doesn't have any type of name property; it has a `location` property which is a `LatLng`. – Sean Mickey May 21 '12 at 18:43