moshen / node-googlemaps

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

multiple paths don't work for me #151

Closed markshapiro closed 6 years ago

markshapiro commented 6 years ago

currently if I specify 2 paths:

 path: [
    {   points: ['52.52,13.4050', '52.53,13.4050', '52.53,13.4150', '52.52,13.4050'],  },
    {  points: ['52.52,13.4250', '52.53,13.4250', '52.53,13.4350', '52.52,13.4250'],  },
  ],

it joins the the encoded paths with | and passes in single "path" parameter (&path=|) this shows the whole world map instead of polygons, but passing both encodings in separate path parameters shows them both polygons correctly. for example try the current library result url: https://maps.googleapis.com/maps/api/staticmap?size=500x500&path=enc%3A_yp_IgdypAo%7D%40%3F%3Fo%7D%40n%7D%40%3F%3Fn%7D%40%7Cenc%3A_yp_Iga%7DpAo%7D%40%3F%3Fo%7D%40n%7D%40%3F%3Fn%7D%40&key= VS separated in 2 path parameters: https://maps.googleapis.com/maps/api/staticmap?size=500x500&path=enc%3A_yp_IgdypAo%7D%40%3F%3Fo%7D%40n%7D%40%3F%3Fn%7D%40&path=enc%3A_yp_Iga%7DpAo%7D%40%3F%3Fo%7D%40n%7D%40%3F%3Fn%7D%40&key=

it starts working when change code by removing the 2nd join: https://github.com/moshen/node-googlemaps/blob/95d591b0544f1032c22a0285deaa8ad115e9b3a2/lib/utils/parsePaths.js#L51

markshapiro commented 6 years ago

already is here https://github.com/moshen/node-googlemaps/pull/149