Skip to content

Commit

Permalink
Mover list.csv a su correspondiente carpeta automáticamente
Browse files Browse the repository at this point in the history
  • Loading branch information
jessisena committed Mar 22, 2018
1 parent f607e29 commit fd36915
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Ejecutar:
npm run step1 -- --area=[bbox] --ciudad=nombreciudad
```

* Ejemplo: **npm run step1 -- --area=[ 2.0875,41.2944,2.2582,41.4574] --ciudad=barcelona**
* Ejemplo: **npm run step1 -- --area=[2.0875,41.2944,2.2582,41.4574] --ciudad=barcelona**


Se generan dos ficheros:
Expand Down
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ tilereduce = tilereduce(opts)
.on('end', function(error){
fs.writeFile( path.join(__dirname, `data/${ciudad}/${ciudad}_streets.geojson`), JSON.stringify(finalGeojson), function(err) {});
console.log(`${num} tiles has been processed.`);
fs.copyFileSync(path.join(__dirname, `data/list.csv`), path.join(__dirname, `data/${ciudad}/list.csv`));
fs.unlinkSync(path.join(__dirname, `data/list.csv`));
console.log('list.csv was copied to folder destination.');
console.log('--------------------- END RESULTS -----------------------');
});

Expand Down
4 changes: 2 additions & 2 deletions map.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function writeFileMapNames(){
for (let item of mapNames.keys()){
mapNamesString += '\', \''+item;
};
fs.writeFile(path.join(__dirname, `data/${folder}/mapNames.txt`), '['+mapNamesString+']', function(err) {});
fs.writeFile(path.join(__dirname, `data/mapNames.txt`), '['+mapNamesString+']', function(err) {});
}


Expand All @@ -56,7 +56,7 @@ function clip(lines, tile) {

function cleanLines (lines) {

const logStream = fs.createWriteStream( path.join(__dirname, `data/${folder}/list.csv`), {encoding: 'utf8', flags: 'a'});
const logStream = fs.createWriteStream( path.join(__dirname, `data/list.csv`), {encoding: 'utf8', flags: 'a'});

lines.features = lines.features.filter(function(line){

Expand Down

0 comments on commit fd36915

Please sign in to comment.