Skip to content

Instantly share code, notes, and snippets.

View clementgayvallet's full-sized avatar

Clément Gayvallet clementgayvallet

View GitHub Profile
@clementgayvallet
clementgayvallet / encode.js
Created September 10, 2019 08:56
Google Polyline Encoder
function encode(locations) {
var lastLat = 0.0;
var lastLng = 0.0;
var result = "";
for (i in locations) {
var location = locations[i];
var lat = Math.round(location[1] * 1e5);
var lng = Math.round(location[0] * 1e5);