Skip to content

Commit

Permalink
Add KML Generation Utility
Browse files Browse the repository at this point in the history
  • Loading branch information
erssebaggala committed Oct 24, 2019
1 parent d7b1713 commit f049dc5
Show file tree
Hide file tree
Showing 18 changed files with 4,146 additions and 32 deletions.
11 changes: 11 additions & 0 deletions background/background-process.html
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,17 @@ <h1>Background process</h1>
log.error(err)
sendLogToUI(task,'error', "Error occured while combining csv files. Check logs for details.");
}

//Generate KML
try{
if(task === 'generate_kml'){
const result = await utils.generateKML(options);
sendLogToUI(task, result.status, result.message);
}
}catch(err){
log.error(err)
sendLogToUI(task,'error', "Error occured while generating KML file. Check logs for details.");
}
}


Expand Down
12 changes: 12 additions & 0 deletions background/background-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const tems = window.require('./tems');
const csvToExcelCombiner = window.require('./csv-to-excel-combiner');
const EXCEL = window.require('./excel');
const bodaPM= window.require('./boda-pm');
const KML = window.require('./kml');

//Fix PATH env variable on Mac OSX
if(process.platform === 'darwin'){
Expand Down Expand Up @@ -1642,6 +1643,17 @@ async function combinedCSVsIntoExcel(csvDirectory, excelFormat, combined, output
}
}

async function generateKML(options){
try{
const fileName = await KML.generate(options, 'kml' );
return {status: 'success', message: fileName };
}catch(e){
log.error(e);
return {status: 'error', message: `Error occured while generating KML file. Check logs for details.`};
}
}

exports.generateKML = generateKML;
exports.combinedCSVsIntoExcel = combinedCSVsIntoExcel;
exports.clearBaselineReference = clearBaselineReference;
exports.importGISFile = importGISFile;
Expand Down
1 change: 1 addition & 0 deletions background/bg-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,3 +350,4 @@ exports.checkStyleCondition = checkStyleCondition;
exports.COMP_OPERATORS = COMP_OPERATORS;
exports.COMP_VALUE_TYPES = COMP_VALUE_TYPES;
exports.COMP_PROPERTIES = COMP_PROPERTIES;
exports.cssColorToARGB = cssColorToARGB;
Loading

0 comments on commit f049dc5

Please sign in to comment.