From ed246fc4bf6ce461106aed2a50978abe67977f90 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Wed, 3 Aug 2022 11:30:28 +0200 Subject: [PATCH] osm_conversion csv --- osm_conversion/app.js | 11 ++++------- ...ays_zone-saint-mande_date-made-2022-08-03_full.csv | 6 +++--- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/osm_conversion/app.js b/osm_conversion/app.js index 010a574e..699017ac 100644 --- a/osm_conversion/app.js +++ b/osm_conversion/app.js @@ -53,17 +53,13 @@ overpassDataJson['elements'].forEach((elem) => { lines_csv.push(line_properties) }) -let lines_out = lines_csv.map(elem => { +let lines_out = lines_csv.map(elem => { let keys = Object.keys(elem) let csv_line = ''; - let ii = 0; keys.forEach(keyName => { csv_line += elem[keyName] - if(ii < 1? '': ', '){ - csv_line += ',' - } - ii++ + csv_line += ';' console.log("ii, elem[keyName]", ii, elem[keyName]) }) @@ -75,7 +71,8 @@ writeCSVOutput(); function writeCSVOutput() { - let content = header_csv.join(',') + '\n' + lines_out; + let content = header_csv.join(';') + ';\n' + lines_out; + console.log(" ") console.log("content", content) fs.writeFile('output/' + exportFileName, content, function (err, data) { if (err) { diff --git a/osm_conversion/output/bdd-vitesses-fr-osm_ways_zone-saint-mande_date-made-2022-08-03_full.csv b/osm_conversion/output/bdd-vitesses-fr-osm_ways_zone-saint-mande_date-made-2022-08-03_full.csv index cb09dc5e..f3d14aef 100644 --- a/osm_conversion/output/bdd-vitesses-fr-osm_ways_zone-saint-mande_date-made-2022-08-03_full.csv +++ b/osm_conversion/output/bdd-vitesses-fr-osm_ways_zone-saint-mande_date-made-2022-08-03_full.csv @@ -1,3 +1,3 @@ -ref,way_id,speedlimit,highway -94160_113859326https://www.openstreetmap.org/way/13859326,50,primary,Avenue de la Porte de Vincennes, -,94160_217075650https://www.openstreetmap.org/way/17075650,30,secondary,Avenue Courteline, +ref;way_id;speedlimit;highway; +94160_1;13859326;https://www.openstreetmap.org/way/13859326;50;primary;Avenue de la Porte de Vincennes; +,94160_2;17075650;https://www.openstreetmap.org/way/17075650;30;secondary;Avenue Courteline;