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';
var ogr = require('./../ogr');
var Ogr = require('./../ogr');
function CsvFormat() {}
CsvFormat.prototype = new ogr('csv');
CsvFormat.prototype = new Ogr('csv');
CsvFormat.prototype._contentType = "text/csv; charset=utf-8; header=present";
CsvFormat.prototype._fileExtension = "csv";

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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