From a99600b708713cc15325dfd8d4888234dde1a839 Mon Sep 17 00:00:00 2001 From: MueJosh <145150281+MueJosh@users.noreply.github.com> Date: Wed, 10 Jul 2024 16:36:59 +0200 Subject: [PATCH 1/3] Update index.html Removing comma with dashes in the first row of all cells. new export for CSV removing quote marks so other programs can handle the data correctly CSV = Comma-separated values and not quotation-seperated values --- index.html | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/index.html b/index.html index d0d11da..928ab24 100644 --- a/index.html +++ b/index.html @@ -77,7 +77,7 @@
- Version 1.11
+ Version 1.1



@@ -191,30 +191,31 @@ console.error(e); return; } - + // With valid JSON, attempt to load waypoints and create list. if (typeof data.timelineObjects == "undefined") { alert("Invalid data: must contain 'timelineObjects' array."); return; } - + // Iterate all objects inside timelineObjects, adding all 'placeVisit' objects as locations. for (let d of data.timelineObjects) { if (typeof d.placeVisit == "undefined") { continue; } // Skip this object. const place = d.placeVisit; - + // Load the object as a location: let l = $("#lstLocations .location.template").clone(true); $("#lstLocations").append(l); - + l.removeClass('template'); l.prop('locationData', place); // Save the data structure with the object. - l.find('.location-name').text(place.location.address); + + // Replace commas with dashes in the first row cells + l.find('.location-name').text(place.location.address.replace(/,/g, '-')); const start = moment(place.duration.startTimestamp); const end = moment(place.duration.endTimestamp); - - l.find('.arrived').text(start.format('Y-M-D H:m:s')); - l.find('.departed').text(end.format('Y-M-D H:m:s')); + l.find('.arrived').text(start.format('Y-M-D H:m:s').replace(/,/g, '-')); + l.find('.departed').text(end.format('Y-M-D H:m:s').replace(/,/g, '-')); l.find('.duration').text(end.diff(start, 'minutes') + " min"); l.find('.longitude').text(place.location.longitudeE7 / 10000000.0); l.find('.latitude').text(place.location.latitudeE7 / 10000000.0); @@ -279,21 +280,21 @@ let results = ""; if (format === "csv") { - results = `"Address","Arrival","Departure","Duration","Description"`; + results = "Address,Arrival,Departure,Duration,Description"; if (includeCoordinates) { - results += `,"Longitude","Latitude"`; + results += ",Longitude,Latitude"; } - results += `\n`; + results += "\n"; // Iterate location list, extracting all selected items. $(".locations .location").not('.template').each(function() { let el = $(this); if (el.find('.selected').is(':checked')) { - results += `"${el.find('.location-name').text()}","${el.find('.arrived').text()}","${el.find('.departed').text()}","${el.find('.duration').text()}","${el.find('.description').val()}"`; + results += `${el.find('.location-name').text()},${el.find('.arrived').text()},${el.find('.departed').text()},${el.find('.duration').text()},${el.find('.description').val()}`; if (includeCoordinates) { - results += `,"${el.find('.longitude').text()}","${el.find('.latitude').text()}"`; + results += `,${el.find('.longitude').text()},${el.find('.latitude').text()}`; } - results += `\n`; + results += "\n"; } }); } else if (format === "gpx") { @@ -324,10 +325,10 @@ } // Return file: - const blob = new Blob([results], { type: format === "csv" ? "text/csv": "application/xml" }); + const blob = new Blob([results], { type: "text/csv" }); const link = document.createElement('a'); link.href = window.URL.createObjectURL(blob); - link.download = `results.${format}`; // Corrected syntax for setting filename + link.download = `results.${format}`; document.body.appendChild(link); link.click(); document.body.removeChild(link); @@ -410,4 +411,3 @@ - From cad6b12932bb66b414200a711433ab7b77734a4d Mon Sep 17 00:00:00 2001 From: MueJosh <145150281+MueJosh@users.noreply.github.com> Date: Mon, 23 Sep 2024 19:42:31 +0200 Subject: [PATCH 2/3] Create CSV_OSRM.html HTML Program working with the exported CSV from GoogleTimelineMapper. Delete Contents in the CSV and route the points with OSRM (or other routing services- e.g your own OSRM Server) Export function for KML, GPX and GeoJSON The core function works but it has some issues with the export --- routing/CSV_OSRM.html | 677 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 677 insertions(+) create mode 100644 routing/CSV_OSRM.html diff --git a/routing/CSV_OSRM.html b/routing/CSV_OSRM.html new file mode 100644 index 0000000..35458d1 --- /dev/null +++ b/routing/CSV_OSRM.html @@ -0,0 +1,677 @@ + + + + + + OSRM Routing by MueJosh + + + + +
+

+ + CSV Editor and OSRM Routing + +

+ + + + + + + + + + + + + + + +
+
+
+
+
+ + + + + + + +
+
+
+
+
+ + + + From 8de88fbe8cccb05ff1d892c0c993af0c7c1d7794 Mon Sep 17 00:00:00 2001 From: MueJosh <145150281+MueJosh@users.noreply.github.com> Date: Mon, 23 Sep 2024 19:49:50 +0200 Subject: [PATCH 3/3] Update index.html undo my mistake :) --- index.html | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/index.html b/index.html index 928ab24..6789183 100644 --- a/index.html +++ b/index.html @@ -77,7 +77,7 @@
- Version 1.1
+ Version 1.11



@@ -191,31 +191,30 @@ console.error(e); return; } - + // With valid JSON, attempt to load waypoints and create list. if (typeof data.timelineObjects == "undefined") { alert("Invalid data: must contain 'timelineObjects' array."); return; } - + // Iterate all objects inside timelineObjects, adding all 'placeVisit' objects as locations. for (let d of data.timelineObjects) { if (typeof d.placeVisit == "undefined") { continue; } // Skip this object. const place = d.placeVisit; - + // Load the object as a location: let l = $("#lstLocations .location.template").clone(true); $("#lstLocations").append(l); - + l.removeClass('template'); l.prop('locationData', place); // Save the data structure with the object. - - // Replace commas with dashes in the first row cells - l.find('.location-name').text(place.location.address.replace(/,/g, '-')); + l.find('.location-name').text(place.location.address); const start = moment(place.duration.startTimestamp); const end = moment(place.duration.endTimestamp); - l.find('.arrived').text(start.format('Y-M-D H:m:s').replace(/,/g, '-')); - l.find('.departed').text(end.format('Y-M-D H:m:s').replace(/,/g, '-')); + + l.find('.arrived').text(start.format('Y-M-D H:m:s')); + l.find('.departed').text(end.format('Y-M-D H:m:s')); l.find('.duration').text(end.diff(start, 'minutes') + " min"); l.find('.longitude').text(place.location.longitudeE7 / 10000000.0); l.find('.latitude').text(place.location.latitudeE7 / 10000000.0); @@ -280,21 +279,21 @@ let results = ""; if (format === "csv") { - results = "Address,Arrival,Departure,Duration,Description"; + results = `"Address","Arrival","Departure","Duration","Description"`; if (includeCoordinates) { - results += ",Longitude,Latitude"; + results += `,"Longitude","Latitude"`; } - results += "\n"; + results += `\n`; // Iterate location list, extracting all selected items. $(".locations .location").not('.template').each(function() { let el = $(this); if (el.find('.selected').is(':checked')) { - results += `${el.find('.location-name').text()},${el.find('.arrived').text()},${el.find('.departed').text()},${el.find('.duration').text()},${el.find('.description').val()}`; + results += `"${el.find('.location-name').text()}","${el.find('.arrived').text()}","${el.find('.departed').text()}","${el.find('.duration').text()}","${el.find('.description').val()}"`; if (includeCoordinates) { - results += `,${el.find('.longitude').text()},${el.find('.latitude').text()}`; + results += `,"${el.find('.longitude').text()}","${el.find('.latitude').text()}"`; } - results += "\n"; + results += `\n`; } }); } else if (format === "gpx") { @@ -325,10 +324,10 @@ } // Return file: - const blob = new Blob([results], { type: "text/csv" }); + const blob = new Blob([results], { type: format === "csv" ? "text/csv": "application/xml" }); const link = document.createElement('a'); link.href = window.URL.createObjectURL(blob); - link.download = `results.${format}`; + link.download = `results.${format}`; // Corrected syntax for setting filename document.body.appendChild(link); link.click(); document.body.removeChild(link); @@ -410,4 +409,3 @@ -