Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4996848bdc | ||
|
|
aa7ae575d0 | ||
|
|
9603703908 | ||
|
|
e44104254e | ||
|
|
58b536036f | ||
|
|
a68e095400 | ||
|
|
53b28b35f1 | ||
|
|
58f92ae947 | ||
|
|
e506014763 | ||
|
|
7c5e7e94e9 | ||
|
|
e6747ebb78 | ||
|
|
2a87ad19c9 | ||
|
|
ba62f0bf30 | ||
|
|
08369a666d | ||
|
|
f771d41788 | ||
|
|
9dda95ee8e | ||
|
|
63483a3155 | ||
|
|
bca5191ad9 | ||
|
|
245d9765a9 | ||
|
|
e8134dfeb0 |
@@ -43,7 +43,7 @@ Static images
|
||||
* ``fill`` - color to use as the fill (e.g. ``red``, ``rgba(255,255,255,0.5)``, ``#0000ff``)
|
||||
* ``stroke`` - color of the path stroke
|
||||
* ``width`` - width of the stroke
|
||||
* ``padding`` - "percetange" padding for fitted endpoints (area-based and path autofit)
|
||||
* ``padding`` - "percentage" padding for fitted endpoints (area-based and path autofit)
|
||||
|
||||
* value of ``0.1`` means "add 10% size to each side to make sure the area of interest is nicely visible"
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ Just run ``docker run --rm -it -v $(pwd):/data -p 8080:80 klokantech/tileserver-
|
||||
|
||||
Additional options (see :doc:`/usage`) can be passed to the TileServer GL by appending them to the end of this command. You can, for example, do the following:
|
||||
|
||||
* ``docker run ... klokantech/tileserver-gl my-tiles.mbtiles`` -- explicitly specify which mbtiles to use (if you have more in the folder)
|
||||
* ``docker run ... klokantech/tileserver-gl --mbtiles my-tiles.mbtiles`` -- explicitly specify which mbtiles to use (if you have more in the folder)
|
||||
* ``docker run ... klokantech/tileserver-gl --verbose`` -- to see the default config created automatically
|
||||
|
||||
npm
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tileserver-gl",
|
||||
"version": "2.5.0",
|
||||
"version": "2.6.0",
|
||||
"description": "Map tile server for JSON GL styles - vector and server side generated raster tiles",
|
||||
"main": "src/main.js",
|
||||
"bin": "src/main.js",
|
||||
@@ -31,7 +31,7 @@
|
||||
"cors": "2.8.5",
|
||||
"express": "4.16.4",
|
||||
"glyph-pbf-composite": "0.0.2",
|
||||
"handlebars": "4.0.12",
|
||||
"handlebars": "4.1.2",
|
||||
"http-shutdown": "^1.2.0",
|
||||
"morgan": "1.9.1",
|
||||
"pbf": "3.1.0",
|
||||
|
||||
@@ -81,6 +81,7 @@ section {
|
||||
}
|
||||
.item img {
|
||||
position: absolute;
|
||||
display: block;
|
||||
margin: 30px;
|
||||
width: 128px;
|
||||
height: 128px;
|
||||
|
||||
13
src/main.js
13
src/main.js
@@ -43,7 +43,7 @@ var opts = require('commander')
|
||||
'Disable Cross-origin resource sharing headers'
|
||||
)
|
||||
.option(
|
||||
'-u|--public_url',
|
||||
'-u|--public_url <url>',
|
||||
'Enable exposing the server on subpaths, not necessarily the root of the domain'
|
||||
)
|
||||
.option(
|
||||
@@ -54,6 +54,14 @@ var opts = require('commander')
|
||||
'-s, --silent',
|
||||
'Less verbose output'
|
||||
)
|
||||
.option(
|
||||
'-l|--log_file <file>',
|
||||
'output log file (defaults to standard out)'
|
||||
)
|
||||
.option(
|
||||
'-f|--log_format <format>',
|
||||
'define the log format: https://github.com/expressjs/morgan#morganformat-options'
|
||||
)
|
||||
.version(
|
||||
packageJson.version,
|
||||
'-v, --version'
|
||||
@@ -73,7 +81,10 @@ var startServer = function(configPath, config) {
|
||||
bind: opts.bind,
|
||||
port: opts.port,
|
||||
cors: opts.cors,
|
||||
verbose: opts.verbose,
|
||||
silent: opts.silent,
|
||||
logFile: opts.log_file,
|
||||
logFormat: opts.log_format,
|
||||
publicUrl: publicUrl
|
||||
});
|
||||
};
|
||||
|
||||
@@ -89,7 +89,7 @@ module.exports = function(options, repo, params, id, styles, publicUrl) {
|
||||
source.getTile(z, x, y, function(err, data, headers) {
|
||||
if (err) {
|
||||
if (/does not exist/.test(err.message)) {
|
||||
return res.status(204).send(err.message);
|
||||
return res.status(204).send();
|
||||
} else {
|
||||
return res.status(500).send(err.message);
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ module.exports = function(options, repo, params, id, publicUrl, dataResolver) {
|
||||
format = parts[5].split('.')[1];
|
||||
source.getTile(z, x, y, function(err, data, headers) {
|
||||
if (err) {
|
||||
//console.log('MBTiles error, serving empty', err);
|
||||
if (options.verbose) console.log('MBTiles error, serving empty', err);
|
||||
createEmptyResponse(sourceInfo.format, sourceInfo.color, callback);
|
||||
return;
|
||||
}
|
||||
@@ -263,6 +263,18 @@ module.exports = function(options, repo, params, id, publicUrl, dataResolver) {
|
||||
styleJSON.glyphs = 'fonts://' + styleJSON.glyphs;
|
||||
}
|
||||
|
||||
(styleJSON.layers || []).forEach(function(layer) {
|
||||
if (layer && layer.paint) {
|
||||
// Remove (flatten) 3D buildings
|
||||
if (layer.paint['fill-extrusion-height']) {
|
||||
layer.paint['fill-extrusion-height'] = 0;
|
||||
}
|
||||
if (layer.paint['fill-extrusion-base']) {
|
||||
layer.paint['fill-extrusion-base'] = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var tileJSON = {
|
||||
'tilejson': '2.0.0',
|
||||
'name': styleJSON.name,
|
||||
|
||||
@@ -41,12 +41,11 @@ function start(opts) {
|
||||
|
||||
app.enable('trust proxy');
|
||||
|
||||
if (process.env.NODE_ENV == 'production') {
|
||||
app.use(morgan('tiny', {
|
||||
skip: function(req, res) { return opts.silent && (res.statusCode == 200 || res.statusCode == 304) }
|
||||
}));
|
||||
} else if (process.env.NODE_ENV !== 'test') {
|
||||
app.use(morgan('dev', {
|
||||
if (process.env.NODE_ENV !== 'test') {
|
||||
var defaultLogFormat = process.env.NODE_ENV == 'production' ? 'tiny' : 'dev';
|
||||
var logFormat = opts.logFormat || defaultLogFormat;
|
||||
app.use(morgan(logFormat, {
|
||||
stream: opts.logFile ? fs.createWriteStream(opts.logFile, { flags: 'a' }) : process.stdout,
|
||||
skip: function(req, res) { return opts.silent && (res.statusCode == 200 || res.statusCode == 304) }
|
||||
}));
|
||||
}
|
||||
@@ -198,7 +197,7 @@ function start(opts) {
|
||||
name: styleJSON.name,
|
||||
id: id,
|
||||
url: utils.getPublicUrl(opts.publicUrl, req) +
|
||||
'/styles/' + id + '/style.json' + query
|
||||
'styles/' + id + '/style.json' + query
|
||||
});
|
||||
});
|
||||
res.send(result);
|
||||
|
||||
Reference in New Issue
Block a user