Comments (9)
Have you tried something like the example query in the docs here:
https://developers.google.com/maps/documentation/directions/?csw=1#Waypoints
?
You can pass either pipe separated textual destinations or lat,lng.
from node-googlemaps.
I tried calling the url directly... I will try to check this later and will let you know... Thanks though..
from node-googlemaps.
Hi!, i am trying to use the directions services with waypoints. The origin and destination are the same address and then i have two more address in an array with location like this:
var WayPoints = [{location: recogida },{location: destino}];
Where recogida and destino are both adresses.
When i call the function and i passed the waypoints array as 6th argument, appears like the directions service is not using the waypoints, because i receive a response without waypoint_order and the overview_polyline is only the origin and destination point (are the same). Is working ok?
from node-googlemaps.
@leandroz the direction function has changed:
https://github.com/moshen/node-googlemaps/blob/master/lib/googlemaps.js#L148
if you can provide a test for your case we can look into the issue
from node-googlemaps.
The problem is with the function buildUrl, stringify and how you have to pass the arguments waypoints to Google Maps.
Here is the url example from Google Maps documentation:
http://maps.googleapis.com/maps/api/directions/json?origin=Boston,MA&destination=Concord,MA&waypoints=Charlestown,MA|Lexington,MA&sensor=false
See that each waypoints is separated by |, but stringify escaped an array like:
querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' })
// returns
'foo=bar&baz=qux&baz=quux&corge='
If you prove the test with waypoints it will fail.
Thats the problem.
from node-googlemaps.
I think this is the same issue as #49
I can see a possible confusion arising when people think waypoints is an array, whereas passing a string will make it work.
Have I understood the problem correctly @leandroz ?
from node-googlemaps.
Hi @fabriziomoscon !
I am passing the waypoints like this
[{location: LatLngOrigin}, {location: LatLngDestination }]
What is the proper way to do it?
from node-googlemaps.
LatLngOrigin + "|" + LatLngDestination
Is the right way?
from node-googlemaps.
Google expects waypoints as a string of pipe separated locations. An the library doesn't have any conversion for the input you pass.
Please pass something similar to:
var waypoints = "Charlestown,MA|Lexington,MA";
from node-googlemaps.
Related Issues (20)
- can be have to path in in a map?
- missing overview_path HOT 1
- Static maps with multiple markers not working HOT 1
- Relative path not working for icon on a marker
- Query: Usage with typescript
- Maximum URL size HOT 4
- Google Maps Styles not working? HOT 2
- clock mispossitioning HOT 1
- Is there a way to calculate center for multiple points. HOT 2
- Building --prod with my ionic project
- Please update characters limit according to google. Error: Request too long for google to handle (2048 characters). But google increased it to 8192. Please update it HOT 2
- How connect PlaceAutocomplete to my input ?
- maintenance???? HOT 1
- multiple paths don't work for me HOT 1
- Google Maps Platform
- Pass X-StaticMap-API-Warning header errors in staticMap callback
- Getting error `Component filter type components=country is not supported.`
- Prototype Pollution Protection Bypass HOT 1
- Is it possible to use Google Maps Geometry in Node JS? HOT 2
- The binary output from the static map API needs to be checked.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-googlemaps.