node-googlemaps icon indicating copy to clipboard operation
node-googlemaps copied to clipboard

Problem with buildUrl function and waypoints

Open leandroz opened this issue 11 years ago • 4 comments

The buildUrl function is not working well when the direction service is called with the waypoints parameter, the path after calling 'path = buildUrl(path, args)' is like this:

/maps/api/directions/json?origin=Vuelta%20de%20Haedo%20-%20Avenida%20Rivadavia%2C%20Haedo%2C%20Buenos%20Aires%2C%20Argentina&destination=Vuelta%20de%20Haedo%20-%20Avenida%20Rivadavia%2C%20Haedo%2C%20Buenos%20Aires%2C%20Argentina&waypoints=&waypoints=&language=es&sensor=false

leandroz avatar Jul 23 '14 20:07 leandroz

I dig more and the problem is with querystring.stringify(). This is the google maps url example with waypoints: origin=Boston,MA&destination=Concord,MA&waypoints=Charlestown,MA|Lexington,MA&sensor=false And this is what querystring.stringify() return: origin=Boston,MA&destination=Concord,MA&waypoints=&waypoints=&sensor=false

leandroz avatar Jul 23 '14 22:07 leandroz

I saw the new version file and has the same problem, anyone?

leandroz avatar Oct 07 '14 18:10 leandroz

@leandroz I am working on a new branch where I tried to add a simple sanity check (not completed) that checks what happens passing waypoints to makeRequest https://github.com/moshen/node-googlemaps/commit/affb7d1b950b54c5e22798dfb073dc78b0a5706d

this is the uri which is going to be used by request: http://maps.googleapis.com/maps/api/directions/json?origin=Boston%2C%20MA%2C%20USA&destination=Concord%2C%20MA%2C%20USA&mode=driving&waypoints=Charlestown%2CMA%7CLexington%2CMA&sensor=false

There is nothing bad with that URI as HTTP encoding is a standard well understood by web servers.

The sanity check passes in the branch. Please feel free to extend that check to make it fail.

fabriziomoscon avatar Oct 10 '14 18:10 fabriziomoscon

@leandroz The v1.0.0 of the library is published on npm and merged into master, feel free to check if this is still an issue and update this page

fabriziomoscon avatar Jun 11 '15 10:06 fabriziomoscon