Skip to content

Commit

Permalink
insert partial should actually send the error when it fails
Browse files Browse the repository at this point in the history
  • Loading branch information
chelm committed Feb 10, 2015
1 parent d7cf6c7 commit 1fa4b25
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ module.exports = function( config ) {
next();
});

// save the koop log onto the app
app.log = koop.log;

return app;

};
4 changes: 2 additions & 2 deletions lib/PostGIS.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)+'"';
}
Expand Down Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions lib/Tiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ mapnik.pools = {};

var Tiles = function( koop ){

this.mapnikHeader = '<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" background-color="transparent" buffer-size="50"><Style name="polygon" filter-mode="first"><Rule><PolygonSymbolizer fill="darkblue" fill-opacity=".75"/></Rule></Style><Style name="point"><Rule><MarkersSymbolizer fill="#55AADD" opacity=".75" width="10.5" stroke="white" stroke-width="2" stroke-opacity=".25" placement="point" marker-type="ellipse" allow-overlap="true"/></Rule></Style><Style name="linestring"> <Rule><LineSymbolizer stroke="darkgrey" stroke-width="3" /><LineSymbolizer stroke="white" stroke-width="1.5" /></Rule></Style><Style name="multilinestring"><Rule><LineSymbolizer stroke="darkgrey" stroke-width="3" /><LineSymbolizer stroke="white" stroke-width="1.5" /></Rule></Style><Style name="multipolygon" filter-mode="first"><Rule><PolygonSymbolizer fill="darkblue" fill-opacity=".75"/></Rule></Style>';
this.mapnikHeader = '<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" background-color="transparent" buffer-size="20"><Style name="polygon" filter-mode="first"><Rule><PolygonSymbolizer fill="darkblue" fill-opacity=".75"/></Rule></Style><Style name="point"><Rule><MarkersSymbolizer fill="#55AADD" opacity=".75" width="10.5" stroke="white" stroke-width="2" stroke-opacity=".25" placement="point" marker-type="ellipse" allow-overlap="true"/></Rule></Style><Style name="linestring"> <Rule><LineSymbolizer stroke="darkgrey" stroke-width="3" /><LineSymbolizer stroke="white" stroke-width="1.5" /></Rule></Style><Style name="multilinestring"><Rule><LineSymbolizer stroke="darkgrey" stroke-width="3" /><LineSymbolizer stroke="white" stroke-width="1.5" /></Rule></Style><Style name="multipolygon" filter-mode="first"><Rule><PolygonSymbolizer fill="darkblue" fill-opacity=".75"/></Rule></Style>';

this.mapnikFooter = '</Map>';

Expand All @@ -41,7 +41,7 @@ var Tiles = function( koop ){

tableQuery = this.buildTableQuery( table, fields);

var layer = '<Layer name="'+name+'" maxzoom="'+minZoom+'" minzoom="'+maxZoom+'" buffer-size="50" status="on" srs="+proj=latlong +datum=WGS84">';
var layer = '<Layer name="'+name+'" maxzoom="'+minZoom+'" minzoom="'+maxZoom+'" buffer-size="20" status="on" srs="+proj=latlong +datum=WGS84">';
layer += '<StyleName>' + type + '</StyleName>';
layer += '<Datasource><Parameter name="type">postgis</Parameter>';
layer += '<Parameter name="host">'+Cache.db.client.host+'</Parameter>';
Expand Down Expand Up @@ -69,7 +69,7 @@ var Tiles = function( koop ){
}
} else if ( data.layers ){
data.layers.forEach(function(layer){
var lyr = '<Layer name="'+layer.name+'" buffer-size="50" status="on" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"><StyleName>'+layer.style+'</StyleName> <Datasource> <Parameter name="file">'+layer.file+'</Parameter> <Parameter name="layer">OGRGeoJSON</Parameter> <Parameter name="type">ogr</Parameter></Datasource></Layer>';
var lyr = '<Layer name="'+layer.name+'" buffer-size="20" status="on" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"><StyleName>'+layer.style+'</StyleName> <Datasource> <Parameter name="file">'+layer.file+'</Parameter> <Parameter name="layer">OGRGeoJSON</Parameter> <Parameter name="type">ogr</Parameter></Datasource></Layer>';
layers.push(lyr);
});
}
Expand Down Expand Up @@ -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
});
}

Expand Down

0 comments on commit 1fa4b25

Please sign in to comment.