moshen / node-googlemaps

A simple way to query the Google Maps API from Node.js
MIT License
559 stars 148 forks source link

fixed multiple paths #149

Open CharlyGeen opened 6 years ago

CharlyGeen commented 6 years ago

When parsing the path array each next path must be transformed to &path= The first path is transformed correctly but each next path is not. Removing the .join('|') will fix this bug.

See https://developers.google.com/maps/documentation/static-maps/intro#URL_Parameters -> Feature Parameters -> path:

"path (optional) defines a single path of two or more connected points to overlay on the image at specified locations. This parameter takes a string of point definitions separated by the pipe character (|). You may supply additional paths by adding additional path parameters. Note that if you supply a path for a map, you do not need to specify the (normally required) center and zoom parameters. For more information, see Google Static Maps API Paths below."

-> "You may supply additional paths by adding additional path parameters." and so each URL parameter "path" has the following format:

&path=

markshapiro commented 6 years ago

the unit test for parsePathsTest is failing, fixable buy defining array instead of concatenated string as expected result https://github.com/moshen/node-googlemaps/blob/master/test/unit/utils/parsePathsTest.js#L66