diff --git a/app/models/formats/ogr.js b/app/models/formats/ogr.js index 29d0a7c1..ad505a6d 100644 --- a/app/models/formats/ogr.js +++ b/app/models/formats/ogr.js @@ -60,10 +60,10 @@ OgrFormat.prototype.toOGR = function(options, out_format, out_filename, callback var ogr2ogr = global.settings.ogr2ogrCommand || 'ogr2ogr'; var dbhost = dbopts.host; - var dbport = dbopts.port; - var dbuser = dbopts.user; + var dbport = dbopts.port; + var dbuser = dbopts.user; var dbpass = dbopts.pass; - var dbname = dbopts.dbname; + var dbname = dbopts.dbname; var that = this; @@ -72,7 +72,7 @@ OgrFormat.prototype.toOGR = function(options, out_format, out_filename, callback var pg; // Drop ending semicolon (ogr doens't like it) - sql = sql.replace(/;\s*$/, ''); + sql = sql.replace(/;\s*$/, ''); step ( @@ -162,7 +162,7 @@ OgrFormat.prototype.toOGR = function(options, out_format, out_filename, callback } if (options.cmd_params){ - ogrargs.concat(options.cmd_params); + ogrargs = ogrargs.concat(options.cmd_params); } ogrargs.push('-nln', out_layername); @@ -318,7 +318,7 @@ ExportRequest.prototype.sendFile = function (err, filename, callback) { }) .on('error', function(e) { console.log("Can't send response: " + e); - that.ostream.end(); + that.ostream.end(); callback(); }); } else { diff --git a/app/models/formats/ogr/geopackage.js b/app/models/formats/ogr/geopackage.js index a3cf287c..bc287b89 100644 --- a/app/models/formats/ogr/geopackage.js +++ b/app/models/formats/ogr/geopackage.js @@ -16,6 +16,7 @@ GeoPackageFormat.prototype._fileExtension = "gpkg"; GeoPackageFormat.prototype._needSRS = true; GeoPackageFormat.prototype.generate = function(options, callback) { + options.cmd_params = ['-lco', 'FID=cartodb_id']; this.toOGR_SingleFile(options, 'GPKG', callback); }; diff --git a/test/acceptance/export/geopackage.js b/test/acceptance/export/geopackage.js index b7a9f5bf..981b0fdc 100644 --- a/test/acceptance/export/geopackage.js +++ b/test/acceptance/export/geopackage.js @@ -68,6 +68,7 @@ describe('geopackage query', function(){ assert.equal(err, null); assert.equal(row.cartodb_id, 1); assert.equal(row.name, 'Hawai'); + assert.equal(row.fid, undefined); done(); }); assert.notEqual(dqr, undefined);