CartoDB-SQL-API/lib/models/formats/ogr/geopackage.js

26 lines
831 B
JavaScript
Raw Normal View History

2018-10-24 21:42:33 +08:00
'use strict';
2019-01-16 22:58:11 +08:00
var Ogr = require('./../ogr');
2016-04-27 22:56:06 +08:00
function GeoPackageFormat() {}
2019-01-16 22:58:11 +08:00
GeoPackageFormat.prototype = new Ogr('gpkg');
2016-04-27 22:56:06 +08:00
GeoPackageFormat.prototype._contentType = "application/x-sqlite3; charset=utf-8";
GeoPackageFormat.prototype._fileExtension = "gpkg";
// As of GDAL 1.10.1 SRID detection is bogus, so we use
// our own method. See:
// http://trac.osgeo.org/gdal/ticket/5131
// http://trac.osgeo.org/gdal/ticket/5287
// http://github.com/CartoDB/CartoDB-SQL-API/issues/110
// http://github.com/CartoDB/CartoDB-SQL-API/issues/116
// Bug was fixed in GDAL 1.10.2
GeoPackageFormat.prototype._needSRS = true;
GeoPackageFormat.prototype.generate = function(options, callback) {
2017-01-12 02:02:45 +08:00
options.cmd_params = ['-lco', 'FID=cartodb_id'];
2016-04-27 22:56:06 +08:00
this.toOGR_SingleFile(options, 'GPKG', callback);
};
module.exports = GeoPackageFormat;