osm_conversion csv
This commit is contained in:
parent
7bc952b614
commit
ed246fc4bf
@ -53,17 +53,13 @@ overpassDataJson['elements'].forEach((elem) => {
|
|||||||
lines_csv.push(line_properties)
|
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 keys = Object.keys(elem)
|
||||||
let csv_line = '';
|
let csv_line = '';
|
||||||
let ii = 0;
|
|
||||||
keys.forEach(keyName => {
|
keys.forEach(keyName => {
|
||||||
csv_line += elem[keyName]
|
csv_line += elem[keyName]
|
||||||
if(ii < 1? '': ', '){
|
csv_line += ';'
|
||||||
csv_line += ','
|
|
||||||
}
|
|
||||||
ii++
|
|
||||||
console.log("ii, elem[keyName]", ii, elem[keyName])
|
console.log("ii, elem[keyName]", ii, elem[keyName])
|
||||||
|
|
||||||
})
|
})
|
||||||
@ -75,7 +71,8 @@ writeCSVOutput();
|
|||||||
function 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)
|
console.log("content", content)
|
||||||
fs.writeFile('output/' + exportFileName, content, function (err, data) {
|
fs.writeFile('output/' + exportFileName, content, function (err, data) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
ref,way_id,speedlimit,highway
|
ref;way_id;speedlimit;highway;
|
||||||
94160_113859326https://www.openstreetmap.org/way/13859326,50,primary,Avenue de la Porte de Vincennes,
|
94160_1;13859326;https://www.openstreetmap.org/way/13859326;50;primary;Avenue de la Porte de Vincennes;
|
||||||
,94160_217075650https://www.openstreetmap.org/way/17075650,30,secondary,Avenue Courteline,
|
,94160_2;17075650;https://www.openstreetmap.org/way/17075650;30;secondary;Avenue Courteline;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user