Google directions node usage example

784 views
Skip to first unread message

Artem Pastukhov

unread,
May 27, 2015, 8:43:48 AM5/27/15
to node...@googlegroups.com
Hello!

Can someone provide google directions usage example?

I fill node config with my api key, origin as 52.6799577/39.5792643 and destination as 52.7315763/39.4743149, but i'm always getting { "code": 400, "message": "Please supply an destination value", "status": "MISSING_VALUES" }

Mark Setrem

unread,
May 28, 2015, 7:16:33 AM5/28/15
to node...@googlegroups.com
It's not working for me either.  Also a quick scan at the code shows the same error message in 2 places in the code (directions.js) which probably isn't as helpful as it could be!

Looking at the console.log I get this:

node-red-0 (out): { error_message: 'This API project is not authorized to use this API. Please ensure that this API is activated in the APIs Console: Learn more: https://code.google.com/apis/console',

node-red-0 (out):   routes: [],

node-red-0 (out):   status: 'REQUEST_DENIED' }


so it looks like the instructions aren't right.


One thing that the instructions fail to do is to actually enable that API!


In the Google Developer Console under "Api & auth" select "APIs"

Search for "Directions API" click on it and then click "Enable API"


Using your example and replacing the "/" for a "," 

 I get { routes: [], status: 'ZERO_RESULTS' }


But using an origin of "Pratt’s Bottom, Kent" and destination of "Sandy Balls, Hampshire" I get directions returned so at least the node works,

 even if the instructions and error reporting are suboptimal!








Dave C-J

unread,
May 28, 2015, 8:30:03 AM5/28/15
to node...@googlegroups.com
Mark,

to speed this up ... which two places ? 

Thanks

Dave C-J

unread,
May 28, 2015, 8:48:23 AM5/28/15
to node...@googlegroups.com
Ah got it... wtf !

Mark Setrem

unread,
May 28, 2015, 8:52:21 AM5/28/15
to node...@googlegroups.com
:) its the second one that's being triggered and is incorrect although main issue is missing enabling API :)

I opened a GitHub issue for this and a second one for another issue I was having with same node.

Dave C-J

unread,
May 28, 2015, 9:32:14 AM5/28/15
to node...@googlegroups.com
Well it does all the hard work of working out what the error is and then ignores it and reports the wrong thing ...
Yup - fix inbound any sec.

Dave C-J

unread,
May 28, 2015, 9:33:10 AM5/28/15
to node...@googlegroups.com
Also the lat lon format should be lat,lon     not lat/lon .... so info updated on that also.

Artem Pastukhov

unread,
May 29, 2015, 5:51:12 AM5/29/15
to node...@googlegroups.com

it's working  after i change "/" to "," in coords.

You should also enable google directions api in developers console.
Reply all
Reply to author
Forward
0 new messages