diff --git a/index.js b/index.js index 4aa745997..8ab18a751 100644 --- a/index.js +++ b/index.js @@ -146,6 +146,9 @@ module.exports = function( config ) { next(); }); + // save the koop log onto the app + app.log = koop.log; + return app; }; diff --git a/lib/PostGIS.js b/lib/PostGIS.js index 85dd83d25..06ffdad98 100644 --- a/lib/PostGIS.js +++ b/lib/PostGIS.js @@ -210,7 +210,7 @@ module.exports = { var info = result.rows[0].info; var select; if (options.simplify){ - select = 'select id, feature->>\'properties\' as props, st_asgeojson(st_simplify(ST_GeomFromGeoJSON(feature->>\'geometry\'), '+options.simplify+')) as geom from "' + key+':'+(options.layer || 0)+'"'; + select = 'select id, feature->>\'properties\' as props, st_asgeojson(ST_SimplifyPreserveTopology(ST_GeomFromGeoJSON(feature->>\'geometry\'), '+options.simplify+')) as geom from "' + key+':'+(options.layer || 0)+'"'; } else { select = 'select id, feature->>\'properties\' as props, feature->>\'geometry\' as geom from "' + key+':'+(options.layer || 0)+'"'; } @@ -405,7 +405,7 @@ module.exports = { if (err){ self.log.error('insert partial ERROR %s, %s', err, key); self._query('ROLLBACK;', function(){ - callback(null, true); + callback(err, false); }); } else { self.log.debug('insert partial SUCCESS %s', key); diff --git a/lib/Tiles.js b/lib/Tiles.js index 584851cbc..779ba6de2 100644 --- a/lib/Tiles.js +++ b/lib/Tiles.js @@ -17,7 +17,7 @@ mapnik.pools = {}; var Tiles = function( koop ){ - this.mapnikHeader = ''; + this.mapnikHeader = ''; this.mapnikFooter = ''; @@ -41,7 +41,7 @@ var Tiles = function( koop ){ tableQuery = this.buildTableQuery( table, fields); - var layer = ''; + var layer = ''; layer += '' + type + ''; layer += 'postgis'; layer += ''+Cache.db.client.host+''; @@ -69,7 +69,7 @@ var Tiles = function( koop ){ } } else if ( data.layers ){ data.layers.forEach(function(layer){ - var lyr = ''+layer.style+' '+layer.file+' OGRGeoJSON ogr'; + var lyr = ''+layer.style+' '+layer.file+' OGRGeoJSON ogr'; layers.push(lyr); }); } @@ -119,8 +119,8 @@ var Tiles = function( koop ){ if ( !fs.existsSync( file ) ) { if ( !mapnik.pools[ mapKey ] ){ mapnik.pools[ mapKey ] = mapnikPool.fromString( fs.readFileSync( stylesheet, 'utf8' ), { - size: size+100, - bufferSize: 30 + size: size, + bufferSize: 20 }); }