Skip to content

Commit

Permalink
support for missing tile plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
chelm committed Mar 16, 2015
1 parent f42a57b commit 61e9767
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
13 changes: 10 additions & 3 deletions controller/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,18 +235,25 @@ var Controller = function( Github, BaseController ){
}
req.params.name = req.params.file;
Github.tileGet( req.params, data[layer], function( err, tile ){
if ( err ){
return res.status(err.code || 500).send( err.message || 'Unknown error while creating the tile' );
}

if (req.params.format == 'pbf') {
res.setHeader('content-encoding', 'deflate');
}
if ( req.params.format == 'png' || req.params.format == 'pbf'){
res.sendFile( tile );
} else {
}
else {
if ( callback ){
res.send( callback + '(' + JSON.stringify( tile ) + ')' );
} else {
}
else {
if (typeof tile == 'string'){
res.sendFile( tile );
} else {
}
else {
res.json( tile );
}
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "koop-github",
"version": "0.1.11",
"version": "0.1.12",
"description": "A github wrapper for koop ",
"main": "index.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "mocha test/"
"test": "mocha test/ -t 20000"
},
"dependencies": {
"geohub": "0.3.2",
Expand Down
4 changes: 2 additions & 2 deletions test/model-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var should = require('should'),
config = require('config'),
koop = require('koop-server/lib');
koop = require('koop/lib');

var repo = 'geodata',
user = 'chelm',
Expand All @@ -9,7 +9,7 @@ var repo = 'geodata',

before(function(done){
// setup koop
koop.Cache.db = koop.PostGIS.connect( config.db.postgis.conn );
koop.Cache.db = koop.LocalDB;
var data_dir = __dirname + '/output/';
koop.Cache.data_dir = data_dir;
Github = new require('../models/Github.js')( koop );
Expand Down
10 changes: 5 additions & 5 deletions test/routes-test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
var should = require('should'),
request = require('supertest'),
config = require('config'),
koop = require('koop-server')(config),
kooplib = require('koop-server/lib');
koop = require('koop')(config),
kooplib = require('koop/lib');

before(function(done){
var provider = require('../index.js');
model = new provider.model( kooplib );
controller = new provider.controller( model );
var model = new provider.model( kooplib );
var controller = new provider.controller( model, kooplib.BaseController );
koop._bindRoutes( provider.routes, controller );
done();
});
Expand Down Expand Up @@ -62,7 +62,7 @@ describe('Koop Routes', function(){
describe('/github/colemanm/hurricanes/fl_2004_hurricanes/FeatureServer', function() {
it('should return 200', function(done) {
request(koop)
.get('/github/colemanm/hurricanes/fl_2004_hurricanes/FeatureServer')
.get('/github/chelm/geodata/us-states/FeatureServer')
.end(function(err, res){
res.should.have.status(200);
done();
Expand Down

0 comments on commit 61e9767

Please sign in to comment.