Skip to content

Commit 2507831

Browse files
committed
Flatten change array
1 parent 5a5702c commit 2507831

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

pipeline/parser.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ fs.readFile(fileName, "utf8", (err, data) => {
2121
result[changesetId].forEach((element) => {
2222
const change = changesetParser.elementParser(element);
2323

24-
// do some validation here
25-
console.log(JSON.stringify(change));
24+
change.forEach((feature) => {
25+
// do some validation here
26+
console.log(JSON.stringify(feature));
27+
});
2628
});
2729
});
28-
console.log(JSON.stringify(featureCollection));
2930
});
3031
});

pipeline/process.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ seq $start_num $end_num | parallel fetchOscFunction
4848

4949
# Parse .osc files and collect into a single geojson using parser.js and jq
5050
echo 'Parsing files'
51-
for (( i=start_num; i<end_num; i++ )); do
52-
echo $i
53-
file_path="/tmp/${i}.osc"
54-
node parser.js $file_path > "/tmp/${start_date}-${start_hour}-${i}.geojsonld"
55-
done
51+
parallel -j +0 "
52+
echo {};
53+
file_path=\"/tmp/{}.osc\";
54+
node parser.js \$file_path > \"/tmp/${start_date}-${start_hour}-{}.geojsonld\"
55+
" ::: $(seq $start_num $((end_num-1)))
56+
5657
echo 'Done parsing files'
5758

5859
echo "Combining files"

0 commit comments

Comments
 (0)