
(async () =>{ 
var db2 = await createDb('route2')
const value = db2.all
console.log(value)
//loadRoute('route2')
//loadRoute('route2')

console.log(Object.keys(value))
console.log(Object.values(value))
var coordinates = Object.values(value)
var mystring = coordinates.toString()
console.log(mystring)
var hope = mystring.split("/")
console.log(typeof(hope))
//console.log(hope)
var my2string = hope.toString()
var comma = my2string.split(',')
console.log("this is comma:"+comma)
console.log(comma)

var newArray =[];
for (var i = 0; i < comma.length; i++) {
    var plus = 1
    //var newArray = [[]];
   //newArray[i] += [comma[i], comma[i+plus] ]
   var increment = i+1;
   console.log(i)
   console.log("increment" +increment)
   newArray.push([comma[i], comma[increment]])
   increment = increment+1
   i = i+1
    //newArray[i][i+plus] +=comma[i+plus] 
}
console.log(newArray);
var map = L.map('map').setView([49.416075235, 8.6722049], 13);        
        L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
    zoom: 44,
    attribution: '© OpenStreetMap'

}).addTo(map);

var polyline = L.polyline(newArray, {color: 'red'}).addTo(map);
map.fitBounds(polyline.getBounds());
//connectDB('route2')

})();


            

          L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
          //var marker = L.marker([49.41607523,8.67220049]).addTo(map);
          var polyline = L.polyline(newArray, {color: 'red'}).addTo(map);
          map.fitBounds(polyline.getBounds());




