This commit is contained in:
Daniel García Aubert 2019-01-16 15:58:11 +01:00
parent 4dec5dc992
commit 23d76393cd
10 changed files with 24 additions and 22 deletions

View File

@ -1,10 +1,10 @@
'use strict'; 'use strict';
var ogr = require('./../ogr'); var Ogr = require('./../ogr');
function CsvFormat() {} function CsvFormat() {}
CsvFormat.prototype = new ogr('csv'); CsvFormat.prototype = new Ogr('csv');
CsvFormat.prototype._contentType = "text/csv; charset=utf-8; header=present"; CsvFormat.prototype._contentType = "text/csv; charset=utf-8; header=present";
CsvFormat.prototype._fileExtension = "csv"; CsvFormat.prototype._fileExtension = "csv";

View File

@ -1,10 +1,10 @@
'use strict'; 'use strict';
var ogr = require('./../ogr'); var Ogr = require('./../ogr');
function GeoPackageFormat() {} function GeoPackageFormat() {}
GeoPackageFormat.prototype = new ogr('gpkg'); GeoPackageFormat.prototype = new Ogr('gpkg');
GeoPackageFormat.prototype._contentType = "application/x-sqlite3; charset=utf-8"; GeoPackageFormat.prototype._contentType = "application/x-sqlite3; charset=utf-8";
GeoPackageFormat.prototype._fileExtension = "gpkg"; GeoPackageFormat.prototype._fileExtension = "gpkg";

View File

@ -1,10 +1,10 @@
'use strict'; 'use strict';
var ogr = require('./../ogr'); var Ogr = require('./../ogr');
function KmlFormat() {} function KmlFormat() {}
KmlFormat.prototype = new ogr('kml'); KmlFormat.prototype = new Ogr('kml');
KmlFormat.prototype._contentType = "application/kml; charset=utf-8"; KmlFormat.prototype._contentType = "application/kml; charset=utf-8";
KmlFormat.prototype._fileExtension = "kml"; KmlFormat.prototype._fileExtension = "kml";

View File

@ -4,12 +4,12 @@ var step = require('step');
var fs = require('fs'); var fs = require('fs');
var spawn = require('child_process').spawn; var spawn = require('child_process').spawn;
var ogr = require('./../ogr'); var Ogr = require('./../ogr');
function ShpFormat() { function ShpFormat() {
} }
ShpFormat.prototype = new ogr('shp'); ShpFormat.prototype = new Ogr('shp');
ShpFormat.prototype._contentType = "application/zip; charset=utf-8"; ShpFormat.prototype._contentType = "application/zip; charset=utf-8";
ShpFormat.prototype._fileExtension = "zip"; ShpFormat.prototype._fileExtension = "zip";

View File

@ -1,10 +1,10 @@
'use strict'; 'use strict';
var ogr = require('./../ogr'); var Ogr = require('./../ogr');
function SpatiaLiteFormat() {} function SpatiaLiteFormat() {}
SpatiaLiteFormat.prototype = new ogr('spatialite'); SpatiaLiteFormat.prototype = new Ogr('spatialite');
SpatiaLiteFormat.prototype._contentType = "application/x-sqlite3; charset=utf-8"; SpatiaLiteFormat.prototype._contentType = "application/x-sqlite3; charset=utf-8";
SpatiaLiteFormat.prototype._fileExtension = "sqlite"; SpatiaLiteFormat.prototype._fileExtension = "sqlite";

View File

@ -2,12 +2,12 @@
var _ = require('underscore'); var _ = require('underscore');
var pg = require('./../pg'); var Pg = require('./../pg');
var ArrayBufferSer = require("../../bin_encoder"); var ArrayBufferSer = require("../../bin_encoder");
function BinaryFormat() {} function BinaryFormat() {}
BinaryFormat.prototype = new pg('arraybuffer'); BinaryFormat.prototype = new Pg('arraybuffer');
BinaryFormat.prototype._contentType = "application/octet-stream"; BinaryFormat.prototype._contentType = "application/octet-stream";
@ -40,6 +40,8 @@ BinaryFormat.prototype.transform = function(result, options, callback) {
try { try {
var i; var i;
var r;
var n;
var t; var t;
// get header types (and guess from name) // get header types (and guess from name)
for(i = 0; i < headersNames.length; ++i) { for(i = 0; i < headersNames.length; ++i) {
@ -62,8 +64,8 @@ BinaryFormat.prototype.transform = function(result, options, callback) {
var data = [header]; var data = [header];
for(i = 0; i < headersNames.length; ++i) { for(i = 0; i < headersNames.length; ++i) {
var d = []; var d = [];
var n = headersNames[i]; n = headersNames[i];
for(var r = 0; r < total_rows; ++r) { for(r = 0; r < total_rows; ++r) {
var row = rows[r][n]; var row = rows[r][n];
if(headerTypes[i] > ArrayBufferSer.BUFFER) { if(headerTypes[i] > ArrayBufferSer.BUFFER) {
row = new ArrayBufferSer(headerTypes[i] - ArrayBufferSer.BUFFER, row); row = new ArrayBufferSer(headerTypes[i] - ArrayBufferSer.BUFFER, row);

View File

@ -2,14 +2,14 @@
var _ = require('underscore'); var _ = require('underscore');
var pg = require('./../pg'); var Pg = require('./../pg');
const errorHandlerFactory = require('../../../services/error_handler_factory'); const errorHandlerFactory = require('../../../services/error_handler_factory');
function GeoJsonFormat() { function GeoJsonFormat() {
this.buffer = ''; this.buffer = '';
} }
GeoJsonFormat.prototype = new pg('geojson'); GeoJsonFormat.prototype = new Pg('geojson');
GeoJsonFormat.prototype._contentType = "application/json; charset=utf-8"; GeoJsonFormat.prototype._contentType = "application/json; charset=utf-8";

View File

@ -2,7 +2,7 @@
var _ = require('underscore'); var _ = require('underscore');
var pg = require('./../pg'); var Pg = require('./../pg');
const errorHandlerFactory = require('../../../services/error_handler_factory'); const errorHandlerFactory = require('../../../services/error_handler_factory');
function JsonFormat() { function JsonFormat() {
@ -10,7 +10,7 @@ function JsonFormat() {
this.lastKnownResult = {}; this.lastKnownResult = {};
} }
JsonFormat.prototype = new pg('json'); JsonFormat.prototype = new Pg('json');
JsonFormat.prototype._contentType = "application/json; charset=utf-8"; JsonFormat.prototype._contentType = "application/json; charset=utf-8";

View File

@ -1,6 +1,6 @@
'use strict'; 'use strict';
var pg = require('./../pg'); var Pg = require('./../pg');
var svg_width = 1024.0; var svg_width = 1024.0;
var svg_height = 768.0; var svg_height = 768.0;
@ -24,7 +24,7 @@ function SvgFormat() {
this._streamingStarted = false; this._streamingStarted = false;
} }
SvgFormat.prototype = new pg('svg'); SvgFormat.prototype = new Pg('svg');
SvgFormat.prototype._contentType = "image/svg+xml; charset=utf-8"; SvgFormat.prototype._contentType = "image/svg+xml; charset=utf-8";
SvgFormat.prototype.getQuery = function(sql, options) { SvgFormat.prototype.getQuery = function(sql, options) {

View File

@ -1,6 +1,6 @@
'use strict'; 'use strict';
var pg = require('./../pg'); var Pg = require('./../pg');
var _ = require('underscore'); var _ = require('underscore');
var geojson = require('./geojson'); var geojson = require('./geojson');
var TopoJSON = require('topojson'); var TopoJSON = require('topojson');
@ -9,7 +9,7 @@ function TopoJsonFormat() {
this.features = []; this.features = [];
} }
TopoJsonFormat.prototype = new pg('topojson'); TopoJsonFormat.prototype = new Pg('topojson');
TopoJsonFormat.prototype.getQuery = function(sql, options) { TopoJsonFormat.prototype.getQuery = function(sql, options) {
return geojson.prototype.getQuery(sql, options) + ' where ' + options.gn + ' is not null'; return geojson.prototype.getQuery(sql, options) + ' where ' + options.gn + ' is not null';