'How to create Line string in google Maps like Here Maps?
this code is to create linestring in Here Maps, I tried to find the same thing in google maps but I couldn't
this.GetCoordinates = function (polyPoints) {
var strips = new H.geo.LineString();
for (var i = 0; i < polyPoints.length; i++) {
strips.pushPoint(new H.geo.Point(polyPoints[i].lng, polyPoints[i].lat));
}
return strips;
}
the returned stripe value in the console is like the following
Solution 1:[1]
in nodeJS:
const gpoly = require('google-polyline')
const decodedPath = gpoly.decode(encodedPath);
console.log(`decodedPath`,decodedPath); // array of [lat,lng]
in JS for browser:
const decodedPath = google.maps.geometry.encoding.decodePath(encodedPath);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | DevBab |

