terriajs-ogr2ogr
Version:
ogr2ogr wrapper w/ multiple format support
13 lines (11 loc) • 547 B
JavaScript
var path = require('path'),
ogr2ogr = require(path.resolve(__dirname + '/../')),
fs = require('fs');
// Use options ["--config", "SHAPE_RESTORE_SHX", "TRUE"] to recreate the shx file if it doesn't exist
var st = ogr2ogr(path.resolve(__dirname + '/../test/samples/sample.lonely.shp'))
.options(["--config", "SHAPE_RESTORE_SHX", "TRUE"])
.exec(function(er, data) {
if (er) console.error(er)
console.log(data);
fs.unlinkSync(path.resolve(__dirname + '/../test/samples/sample.lonely.shx'));
})