Compare commits

...

47 Commits

Author SHA1 Message Date
Petr Sloup
e1a996a267 Minor Dockerfile fix 2016-12-19 21:45:57 +01:00
Petr Sloup
bdfa92532e Update package version to 1.3.0-beta.1 2016-12-19 21:24:14 +01:00
Petr Sloup
e14793c54b Add engines and engineStrict to package.json (close #79) 2016-12-19 21:07:39 +01:00
Petr Sloup
1c401f41a2 Update tests and links to use the new data 2016-12-15 10:51:18 +01:00
Petr Sloup
0018ed9524 Prepare for the new tile schema and compatibility checking 2016-12-14 08:37:17 +01:00
Petr Sloup
dfb07b8286 Show layer name in data viewer (close #83) 2016-12-13 08:48:28 +01:00
Petr Sloup
c1de2a7903 Upgrade MB GL JS to v0.28.0 (close #88) 2016-12-13 08:48:12 +01:00
Petr Sloup
509d32da68 Improved font serving 2016-12-09 13:19:34 +01:00
Petr Sloup
bbc14abb4a Fix sprite and glyph loading from remote URLs 2016-12-08 18:22:11 +01:00
Petr Sloup
442baee1ce Dockerfile improvements 2016-12-08 18:18:19 +01:00
Petr Sloup
0e6c9bfeb0 Improved data name autodetection 2016-12-08 09:41:39 +01:00
Petr Sloup
d3a685e51c Fix unzip bug 2016-12-07 11:03:03 +01:00
Petr Sloup
99af9eae23 Update dependencies 2016-12-06 22:16:35 +01:00
Petr Sloup
d330a9743c Minor bugfix 2016-12-06 22:16:35 +01:00
Petr Sloup
becb46ab80 Add "Style JSON" link to the front page 2016-12-06 22:16:29 +01:00
Petr Sloup
ef3f34f778 Add geojson endpoints (close #78) 2016-12-06 21:26:30 +01:00
Petr Sloup
1aaabd2dff Experimental integration of first plugin 2016-12-06 20:11:18 +01:00
Petr Sloup
bcac161a25 Minor route pattern improvement 2016-12-05 23:21:31 +01:00
Petr Sloup
9d362a5b5e Experimental static endpoints working with raw mercator coordinates 2016-12-05 23:02:48 +01:00
Petr Sloup
21883f490f Update package version to 1.2.0 2016-12-05 16:45:27 +01:00
Petr Sloup
70515947ca Merge pull request #73 from LKajan/x-ray-points
X-Ray style: add circle symbols for point layers
2016-12-05 16:42:16 +01:00
Lauri Kajan
63090802ae fixing typo 2016-11-16 11:28:15 +02:00
Lauri Kajan
131b5e2f81 added circle symbols for point layers 2016-11-16 10:16:14 +02:00
Petr Sloup
6e085af7cc Update package version to 1.1.5 2016-10-25 12:16:07 +02:00
Petr Sloup
345d96d5e6 Fix static endpoints for (near-)whole-world queries (close #63) 2016-10-21 14:49:39 +02:00
Petr Sloup
f1c835c21d Update package version to 1.1.4 2016-10-07 15:21:58 +02:00
Petr Sloup
15ed6d74bf Fix incorrect XYZ URLs (close #58) 2016-10-07 15:21:12 +02:00
Petr Sloup
a3d8240aac Do not add scale prefix when viewing raster data tiles (close #57) 2016-10-07 11:16:22 +02:00
Petr Sloup
098f057e55 Update package version to 1.1.3 2016-09-30 09:51:20 +02:00
Petr Sloup
18ba6f5059 Ignore tiling scheme of the source for internal meta urls (#54) 2016-09-30 09:50:05 +02:00
Petr Sloup
820dbdd3dd Update package version to 1.1.2 2016-09-27 17:34:39 +02:00
Petr Sloup
acd7683f18 Update dependencies 2016-09-27 17:30:24 +02:00
Petr Sloup
09859c10c1 Serve any vector/raster mbtiles, use styles only for osm2vt (close #51, #52) 2016-09-27 17:26:05 +02:00
Petr Sloup
f201deecdc Merge pull request #48 from rastapasta/patch-1
adding info for OSX setup
2016-09-22 08:55:41 +02:00
Petr Pridal
b49521d2ed Update README.md 2016-09-01 17:53:15 +02:00
Michael Straßburger
30c9bc8979 adding info for OSX setup 2016-08-29 12:31:33 +02:00
Petr Sloup
69340bbc83 Update package version to 1.1.1 2016-08-25 12:52:51 +02:00
Petr Sloup
ff9d5a8e5d Update READMEs and descriptions 2016-08-25 12:52:32 +02:00
Petr Sloup
23c2aa54d0 Update tests 2016-08-25 11:09:01 +02:00
Petr Sloup
a8fd1b38b7 Return 404 for negative zoom levels on static endpoint 2016-08-25 11:08:19 +02:00
Petr Sloup
7c28bf2b21 Update version to 1.1.0 2016-08-25 10:49:27 +02:00
Petr Sloup
f9f26f0d65 Indicate clearly when running light version on index.html 2016-08-25 10:44:29 +02:00
Petr Sloup
de60a0a076 Disable png quantization by default for now 2016-08-25 10:23:42 +02:00
Petr Sloup
90b9af3d95 Allow max image side length to be configurable 2016-08-25 09:41:33 +02:00
Petr Sloup
78aea26318 Allow @4x requests 2016-08-25 09:38:03 +02:00
Petr Sloup
292b1b6b44 Update dependencies 2016-08-25 09:28:17 +02:00
Petr Sloup
de7f5f0366 Allow and use floating-point zoom levels in the static endpoints 2016-08-25 09:22:12 +02:00
29 changed files with 910 additions and 513 deletions

1
.gitignore vendored
View File

@@ -3,5 +3,6 @@ node_modules
test_data
data
light
plugins
config.json
*.mbtiles

View File

@@ -15,9 +15,7 @@ before_install:
- sudo apt-get install -qq xvfb
install:
- npm install
- wget -O test_data.zip https://github.com/klokantech/tileserver-gl-data/archive/v0.8.zip
- unzip -q test_data.zip -d tmp_test_data
- mkdir test_data
- mv tmp_test_data/tileserver-gl-data-*/* -t test_data
- wget -O test_data.zip https://github.com/klokantech/tileserver-gl/releases/download/v1.3.0/test_data.zip
- unzip -q test_data.zip -d test_data
script:
- xvfb-run --server-args="-screen 0 1024x768x24" npm test

View File

@@ -9,6 +9,7 @@ RUN apt-get -qq update \
build-essential \
python \
libcairo2-dev \
libprotobuf-dev \
xvfb \
&& echo "deb https://deb.nodesource.com/node_4.x jessie main" >> /etc/apt/sources.list.d/nodejs.list \
&& echo "deb-src https://deb.nodesource.com/node_4.x jessie main" >> /etc/apt/sources.list.d/nodejs.list \

12
Dockerfile_light Normal file
View File

@@ -0,0 +1,12 @@
FROM node:4
MAINTAINER Petr Sloup <petr.sloup@klokantech.com>
RUN mkdir -p /usr/src/app
COPY / /usr/src/app
RUN cd /usr/src/app && npm install --production
VOLUME /data
WORKDIR /data
EXPOSE 80
CMD ["node", "/usr/src/app/", "-p", "80"]

View File

@@ -1,18 +1,46 @@
![tileserver-gl](https://cloud.githubusercontent.com/assets/59284/18173467/fa3aa2ca-7069-11e6-86b1-0f1266befeb6.jpeg)
# TileServer GL
[![Build Status](https://travis-ci.org/klokantech/tileserver-gl.svg?branch=master)](https://travis-ci.org/klokantech/tileserver-gl)
[![Docker Hub](https://img.shields.io/badge/docker-hub-blue.svg)](https://hub.docker.com/r/klokantech/tileserver-gl/)
Vector and raster maps with GL styles. Server side rendering by Mapbox GL Native. Map tile server for Mapbox GL JS, Android, iOS, Leaflet, OpenLayers, GIS via WMTS, etc.
## Quickstart
Use `npm install -g tileserver-gl` to install the package from npm.
## Get Started
Then you can simply run `tileserver-gl zurich_switzerland.mbtiles` to start the server for the given mbtiles.
Install `tileserver-gl` with server-side raster rendering of vector tiles with npm
Alternatively, you can use `tileserver-gl-light` package instead, which is pure javascript (does not have any native dependencies) and can run anywhere, but does not contain rasterization features.
```bash
npm install -g tileserver-gl
```
Or you can use `docker run -it -v $(pwd):/data -p 8080:80 klokantech/tileserver-gl` to run the server inside a docker container.
Now download vector tiles from [OSM2VectorTiles](http://osm2vectortiles.org/downloads/).
Prepared vector tiles can be downloaded from [OSM2VectorTiles](http://osm2vectortiles.org/).
```bash
curl -o zurich_switzerland.mbtiles https://osm2vectortiles-downloads.os.zhdk.cloud.switch.ch/v2.0/extracts/zurich_switzerland.mbtiles
```
Start `tileserver-gl` with the downloaded vector tiles.
```bash
tileserver-gl zurich_switzerland.mbtiles
```
Alternatively, you can use the `tileserver-gl-light` package instead, which is pure javascript (does not have any native dependencies) and can run anywhere, but does not contain rasterization on the server side made with MapBox GL Native.
## Using Docker
An alternative to npm to start the packed software easier is to install [Docker](http://www.docker.com/) on your computer and then run in the directory with the downloaded MBTiles the command:
```bash
docker run -it -v $(pwd):/data -p 8080:80 klokantech/tileserver-gl
```
This will download and start a ready to use container on your computer and the maps are going to be available in webbrowser on localhost:8080.
On laptop you can use [Docker Kitematic](https://kitematic.com/) and search "tileserver-gl" and run it, then drop in the 'data' folder the MBTiles.
## Documentation
You can read full documentation of this project at http://tileserver.readthedocs.io/.
You can read full documentation of this project at http://tileserver.readthedocs.io/.

17
README_light.md Normal file
View File

@@ -0,0 +1,17 @@
# TileServer GL light
[![Build Status](https://travis-ci.org/klokantech/tileserver-gl.svg?branch=master)](https://travis-ci.org/klokantech/tileserver-gl)
[![Docker Hub](https://img.shields.io/badge/docker-hub-blue.svg)](https://hub.docker.com/r/klokantech/tileserver-gl/)
Vector maps with GL styles. Map tile server for Mapbox Android, iOS, GL JS, Leaflet, OpenLayers, etc. without server side rendering.
## Quickstart
Use `npm install -g tileserver-gl-light` to install the package from npm.
Then you can simply run `tileserver-gl-light zurich_switzerland.mbtiles` to start the server for the given mbtiles.
See also `tileserver-gl` which contains server side rendering.
Prepared vector tiles can be downloaded from [OSM2VectorTiles](http://osm2vectortiles.org/).
## Documentation
You can read full documentation of this project at http://tileserver.readthedocs.io/.

View File

@@ -20,10 +20,12 @@ Example::
"127.0.0.1:8080"
],
"formatQuality": {
"png": 90,
"jpeg": 80,
"webp": 90
}
"webp": 90,
"pngQuantization": false,
"png": 90
},
"maxSize": 2048
},
"styles": {
"basic": {
@@ -69,6 +71,13 @@ You can use this to optionally specify on what domains the rendered tiles are ac
Quality of the compression of individual image formats. [0-100]
The value for ``png`` is only used when ``pngQuantization`` is ``true``.
``maxSize``
-----------
Maximum image side length to be allowed to be rendered (including scale factor). Default is ``2048``.
``styles``
==========

View File

@@ -15,7 +15,7 @@ Rendered tiles
==============
* Rendered tiles are served at ``/styles/{id}/rendered/{z}/{x}/{y}[@2x].{format}``
* The optional ``@2x`` (or ``@3x``) part can be used to render HiDPI (retina) tiles
* The optional ``@2x`` (or ``@3x``, ``@4x``) part can be used to render HiDPI (retina) tiles
* Available formats: ``png``, ``jpg`` (``jpeg``), ``webp``
* TileJSON at ``/styles/{id}/rendered.json``
@@ -49,6 +49,10 @@ Source data
===========
* Source data are served at ``/data/{mbtiles}/{z}/{x}/{y}.{format}``
* Format depends on the source file (usually ``png`` or ``pbf``)
* ``geojson`` is also available (useful for inspecting the tiles) in case the original format is ``pbf``
* TileJSON at ``/data/{mbtiles}.json``
TileJSON arrays

View File

@@ -27,3 +27,11 @@ Make sure you have Node v4 or higher (nvm install 4) and run::
npm install
node .
On OSX
======
Make sure to have ``pkg-config`` and ``cairo`` installed::
brew install pkg-config cairo

View File

@@ -1,7 +1,7 @@
{
"name": "tileserver-gl",
"version": "1.0.0",
"description": "Map tile server for JSON GL styles - serverside generated raster tiles",
"version": "1.3.0-beta.1",
"description": "Map tile server for JSON GL styles - vector and server side generated raster tiles",
"main": "src/main.js",
"bin": "src/main.js",
"authors": [
@@ -12,33 +12,42 @@
"url": "https://github.com/klokantech/tileserver-gl.git"
},
"license": "BSD-2-Clause",
"engines": {
"node": ">=4.2.1 <5"
},
"engineStrict": true,
"scripts": {
"test": "mocha test/**.js"
},
"dependencies": {
"async": "2.0.1",
"async": "2.1.4",
"advanced-pool": "0.3.2",
"base64url": "2.0.0",
"canvas": "1.4.0",
"clone": "1.0.2",
"color": "0.11.3",
"cors": "2.7.1",
"canvas": "1.6.2",
"clone": "2.1.0",
"color": "1.0.2",
"cors": "2.8.1",
"express": "4.14.0",
"glyph-pbf-composite": "0.0.2",
"handlebars": "4.0.5",
"mapbox-gl-native": "3.3.2",
"handlebars": "4.0.6",
"mapbox-gl-native": "3.4.2",
"mbtiles": "0.9.0",
"morgan": "1.7.0",
"node-pngquant-native": "1.0.4",
"nomnom": "1.8.1",
"request": "2.74.0",
"sharp": "0.16.0",
"pbf": "3.0.5",
"request": "2.79.0",
"sharp": "0.16.2",
"sphericalmercator": "1.0.5",
"tileserver-gl-styles": "0.3.0"
"tileserver-gl-styles": "1.0.0",
"vector-tile": "1.3.0"
},
"optionalDependencies": {
"tileshrink-gl": "./plugins/tileshrink-gl"
},
"devDependencies": {
"should": "^10.0.0",
"mocha": "^2.5.0",
"supertest": "^1.2.0"
"should": "^11.1.1",
"mocha": "^3.2.0",
"supertest": "^2.0.1"
}
}

View File

@@ -36,6 +36,16 @@ a:hover{
font-size: 32px;
text-align:center;
margin:90px 0 0 0;
position:relative;
}
.title.light:after {
content: "light";
display: block;
position: absolute;
left: 50%;
bottom: -5px;
color: #499DCE;
font-size:.8em;
}
section{
margin: 15px auto;
@@ -169,6 +179,9 @@ body {
.title{
margin: 25px 0 0 0;
}
.title.light:after {
font-size:.6em;
}
.title img{
width: 200px;
}

View File

@@ -21,13 +21,13 @@
.mapboxgl-ctrl-top-left,
.mapboxgl-ctrl-top-right,
.mapboxgl-ctrl-bottom-left,
.mapboxgl-ctrl-bottom-right { position:absolute; }
.mapboxgl-ctrl-bottom-right { position:absolute; pointer-events:none; z-index:2; }
.mapboxgl-ctrl-top-left { top:0; left:0; }
.mapboxgl-ctrl-top-right { top:0; right:0; }
.mapboxgl-ctrl-bottom-left { bottom:0; left:0; }
.mapboxgl-ctrl-bottom-right { right:0; bottom:0; }
.mapboxgl-ctrl { clear:both; }
.mapboxgl-ctrl { clear:both; pointer-events:auto }
.mapboxgl-ctrl-top-left .mapboxgl-ctrl { margin:10px 0 0 10px; float:left; }
.mapboxgl-ctrl-top-right .mapboxgl-ctrl{ margin:10px 10px 0 0; float:right; }
.mapboxgl-ctrl-bottom-left .mapboxgl-ctrl { margin:0 0 10px 10px; float:left; }
@@ -65,7 +65,7 @@
background-color: rgba(0,0,0,0.05);
}
.mapboxgl-ctrl-icon,
.mapboxgl-ctrl-icon > div.arrow {
.mapboxgl-ctrl-icon > span.arrow {
speak: none;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
@@ -80,15 +80,16 @@
}
.mapboxgl-ctrl-icon.mapboxgl-ctrl-geolocate {
padding: 5px;
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20viewBox%3D%270%200%2020%2020%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%3Cpath%20style%3D%27fill%3A%23333333%3B%27%20d%3D%27M13%2C7%20L10.5%2C11.75%20L10.25%2C10%20z%20M13.888%2C6.112%20C13.615%2C5.84%2013.382%2C6.076%2012.5%2C6.5%20C10.14%2C7.634%206%2C10%206%2C10%20L9.5%2C10.5%20L10%2C14%20C10%2C14%2012.366%2C9.86%2013.5%2C7.5%20C13.924%2C6.617%2014.16%2C6.385%2013.888%2C6.112%27%2F%3E%3C%2Fsvg%3E");
background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAyMCIgdmVyc2lvbj0iMS4xIj48cGF0aCBkPSJNMTAgNEM5IDQgOSA1IDkgNUw5IDUuMUE1IDUgMCAwIDAgNS4xIDlMNSA5QzUgOSA0IDkgNCAxMCA0IDExIDUgMTEgNSAxMUw1LjEgMTFBNSA1IDAgMCAwIDkgMTQuOUw5IDE1QzkgMTUgOSAxNiAxMCAxNiAxMSAxNiAxMSAxNSAxMSAxNUwxMSAxNC45QTUgNSAwIDAgMCAxNC45IDExTDE1IDExQzE1IDExIDE2IDExIDE2IDEwIDE2IDkgMTUgOSAxNSA5TDE0LjkgOUE1IDUgMCAwIDAgMTEgNS4xTDExIDVDMTEgNSAxMSA0IDEwIDR6TTEwIDYuNUEzLjUgMy41IDAgMCAxIDEzLjUgMTAgMy41IDMuNSAwIDAgMSAxMCAxMy41IDMuNSAzLjUgMCAwIDEgNi41IDEwIDMuNSAzLjUgMCAwIDEgMTAgNi41ek0xMCA4LjNBMS44IDEuOCAwIDAgMCA4LjMgMTAgMS44IDEuOCAwIDAgMCAxMCAxMS44IDEuOCAxLjggMCAwIDAgMTEuOCAxMCAxLjggMS44IDAgMCAwIDEwIDguM3oiIGZpbGw9IiMzMzMiLz48L3N2Zz4=");
}
.mapboxgl-ctrl-icon.mapboxgl-ctrl-compass > div.arrow {
.mapboxgl-ctrl-icon.mapboxgl-ctrl-compass > span.arrow {
width: 20px;
height: 20px;
margin: 5px;
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%2020%2020%27%3E%0A%09%3Cpolygon%20fill%3D%27%23333333%27%20points%3D%276%2C9%2010%2C1%2014%2C9%27%2F%3E%0A%09%3Cpolygon%20fill%3D%27%23CCCCCC%27%20points%3D%276%2C11%2010%2C19%2014%2C11%20%27%2F%3E%0A%3C%2Fsvg%3E");
background-repeat: no-repeat;
display: inline-block;
}
.mapboxgl-ctrl.mapboxgl-ctrl-attrib {
@@ -109,6 +110,16 @@
margin-left: 2px;
}
.mapboxgl-ctrl-scale {
background-color: rgba(255,255,255,0.75);
font-size: 10px;
border-width: medium 2px 2px;
border-style: none solid solid;
border-color: #333;
padding: 0 5px;
color: #333;
}
.mapboxgl-popup {
position: absolute;
top: 0;

File diff suppressed because one or more lines are too long

View File

@@ -37,7 +37,7 @@
container: 'map',
hash: true
});
map.addControl(new mapboxgl.Navigation());
map.addControl(new mapboxgl.NavigationControl());
function generateColor(str) {
var rgb = [0, 0, 0];
@@ -69,6 +69,16 @@
type: 'line',
paint: {'line-color': colorText}
});
layers_.push({
id: el['id'] + Math.random(),
source: 'vector_layer_',
'source-layer': el['id'],
interactive: true,
type: 'circle',
paint: {'circle-color': colorText,
'circle-radius': 3},
filter: ["==", "$type", "Point"]
});
var item = document.createElement('div');
item.innerHTML = '<div style="' +
'background:rgba(' + color[0] + ',' + color[1] + ',' + color[2] + ',1);' +
@@ -112,7 +122,9 @@
if (features) {
var html = '';
features.forEach(function(feature) {
html += JSON.stringify(feature.properties, null, 2) + '\n';
html +=
'[Layer: ' + feature.layer['source-layer'] + ']\n' +
JSON.stringify(feature.properties, null, 2) + '\n\n';
});
propertyList.innerHTML = html;
}
@@ -124,6 +136,10 @@
<div id='map'></div>
<script>
var map = L.mapbox.map('map', '/data/{{id}}.json{{&key_query}}', { zoomControl: false });
map.eachLayer(function(layer) {
// do not add scale prefix even if retina display is detected
layer.scalePrefix = '.';
});
new L.Control.Zoom({ position: 'topright' }).addTo(map);
setTimeout(function() {
new L.Hash(map);

View File

@@ -17,8 +17,8 @@
</head>
<body>
<section>
<h1 class="title"><img src="/images/logo.png" alt="TileServer GL" /></h1>
<h2 class="subtitle">Vector and raster maps with GL styles</h2>
<h1 class="title {{#if is_light}}light{{/if}}"><img src="/images/logo.png" alt="TileServer GL" /></h1>
<h2 class="subtitle">Vector {{#if is_light}}<s>and raster</s>{{else}}and raster{{/if}} maps with GL styles</h2>
<h2 class="box-header">Styles</h2>
<div class="box">
{{#each styles}}
@@ -32,8 +32,12 @@
<h3>{{name}}</h3>
<p class="identifier">identifier: {{@key}}</p>
<p class="services">
services:
{{#if serving_data}}
<a href="/styles/{{@key}}.json{{&../key_query}}">GL Style</a>
{{/if}}
{{#if serving_rendered}}
services: <a href="/styles/{{@key}}/rendered.json{{&../key_query}}">TileJSON</a>
{{#if serving_data}}| {{/if}}<a href="/styles/{{@key}}/rendered.json{{&../key_query}}">TileJSON</a>
{{/if}}
{{#if wmts_link}}
| <a href="{{&wmts_link}}">WMTS</a>

View File

@@ -29,7 +29,7 @@
style: '/styles/{{id}}.json{{&key_query}}',
hash: true
});
map.addControl(new mapboxgl.Navigation());
map.addControl(new mapboxgl.NavigationControl());
} else {
var map = L.mapbox.map('map', '/styles/{{id}}/rendered.json{{&key_query}}', { zoomControl: false });
new L.Control.Zoom({ position: 'topright' }).addTo(map);

View File

@@ -20,6 +20,7 @@ var fs = require('fs');
var packageJson = require('./package');
packageJson.name += '-light';
packageJson.description = 'Map tile server for JSON GL styles - serving vector tiles';
delete packageJson.dependencies['canvas'];
delete packageJson.dependencies['mapbox-gl-native'];
delete packageJson.dependencies['node-pngquant-native'];
@@ -29,6 +30,8 @@ delete packageJson.devDependencies;
var str = JSON.stringify(packageJson, undefined, 2);
fs.writeFileSync('light/package.json', str);
fs.renameSync('light/README_light.md', 'light/README.md');
fs.renameSync('light/Dockerfile_light', 'light/Dockerfile');
/* PUBLISH */

View File

@@ -70,10 +70,6 @@ var startWithMBTiles = function(mbtilesFile) {
}
var instance = new mbtiles(mbtilesFile, function(err) {
instance.getInfo(function(err, info) {
if (info.format != 'pbf') {
console.log('ERROR: MBTiles format is not "pbf".');
process.exit(1);
}
var bounds = info.bounds;
var styleDir = path.resolve(__dirname, "../node_modules/tileserver-gl-styles/");
@@ -82,33 +78,70 @@ var startWithMBTiles = function(mbtilesFile) {
"options": {
"paths": {
"root": styleDir,
"fonts": "glyphs",
"sprites": "sprites",
"fonts": "fonts",
"styles": "styles",
"mbtiles": path.dirname(mbtilesFile)
}
},
"styles": {},
"data": {
"osm2vectortiles": {
"mbtiles": path.basename(mbtilesFile)
}
}
"data": {}
};
var styles = fs.readdirSync(path.resolve(styleDir, 'styles'));
for (var i=0; i < styles.length; i++) {
var styleFilename = styles[i];
if (styleFilename.endsWith('.json')) {
var styleObject = {
"style": path.basename(styleFilename),
"tilejson": {
"bounds": bounds
if (info.format == 'pbf' &&
info.name.toLowerCase().indexOf('openmaptiles') > -1) {
config['data']['openmaptiles'] = {
"mbtiles": path.basename(mbtilesFile)
};
var omtV = (info.version || '').split('.');
var styles = fs.readdirSync(path.resolve(styleDir, 'styles'));
for (var i = 0; i < styles.length; i++) {
var styleName = styles[i];
var styleFileRel = styleName + '/style.json';
var styleFile = path.resolve(styleDir, 'styles', styleFileRel);
if (fs.existsSync(styleFile)) {
var styleJSON = require(styleFile);
var omtVersionCompatibility =
((styleJSON || {}).metadata || {})['openmaptiles:version'] || 'x';
var m = omtVersionCompatibility.toLowerCase().split('.');
var isCompatible = !(
m[0] != 'x' && (
m[0] != omtV[0] || (
(m[1] || 'x') != 'x' && (
m[1] != omtV[1] || (
(m[2] || 'x') != 'x' &&
m[2] != omtV[2]
)
)
)
)
);
if (isCompatible) {
var styleObject = {
"style": styleFileRel,
"tilejson": {
"bounds": bounds
}
};
config['styles'][styleName] = styleObject;
} else {
console.log('Style', styleName, 'requires OpenMapTiles version',
omtVersionCompatibility, 'but mbtiles is version', info.version);
}
};
config['styles'][path.basename(styleFilename, '.json')] =
styleObject;
}
}
} else {
console.log('WARN: MBTiles not in "openmaptiles" format. ' +
'Serving raw data only...');
config['data'][(info.id || 'mbtiles')
.replace(/\//g, '_')
.replace(/\:/g, '_')
.replace(/\?/g, '_')] = {
"mbtiles": path.basename(mbtilesFile)
};
}
if (opts.verbose) {
@@ -142,7 +175,7 @@ fs.stat(path.resolve(opts.config), function(err, stats) {
console.log('No MBTiles specified, using ' + mbtiles);
return startWithMBTiles(mbtiles);
} else {
var url = 'https://github.com/klokantech/tileserver-gl-styles/releases/download/v0.3.0/zurich_switzerland.mbtiles';
var url = 'https://github.com/klokantech/tileserver-gl/releases/download/v1.3.0/zurich_switzerland.mbtiles';
var filename = 'zurich_switzerland.mbtiles';
var stream = fs.createWriteStream(filename);
console.log('Downloading sample data (' + filename + ') from ' + url);

View File

@@ -1,15 +1,23 @@
'use strict';
var fs = require('fs'),
path = require('path');
path = require('path'),
zlib = require('zlib');
var clone = require('clone'),
express = require('express'),
mbtiles = require('mbtiles');
mbtiles = require('mbtiles'),
pbf = require('pbf'),
VectorTile = require('vector-tile').VectorTile;
var tileshrinkGl;
try {
tileshrinkGl = require('tileshrink-gl');
} catch (e) {}
var utils = require('./utils');
module.exports = function(options, repo, params, id) {
module.exports = function(options, repo, params, id, styles) {
var app = express().disable('x-powered-by');
var mbtilesFile = path.resolve(options.paths.mbtiles, params.mbtiles);
@@ -17,6 +25,8 @@ module.exports = function(options, repo, params, id) {
'tiles': params.domains || options.domains
};
var shrinkers = {};
repo[id] = tileJSON;
var mbtilesFileStats = fs.statSync(mbtilesFile);
@@ -46,7 +56,8 @@ module.exports = function(options, repo, params, id) {
var z = req.params.z | 0,
x = req.params.x | 0,
y = req.params.y | 0;
if (req.params.format != tileJSON.format) {
if (req.params.format != tileJSON.format &&
!(req.params.format == 'geojson' && tileJSON.format == 'pbf')) {
return res.status(404).send('Invalid format');
}
if (z < tileJSON.minzoom || 0 || x < 0 || y < 0 ||
@@ -62,16 +73,74 @@ module.exports = function(options, repo, params, id) {
return res.status(500).send(err.message);
}
} else {
if (tileJSON['format'] == 'pbf') {
headers['Content-Type'] = 'application/x-protobuf';
headers['Content-Encoding'] = 'gzip';
}
delete headers['ETag']; // do not trust the tile ETag -- regenerate
res.set(headers);
if (data == null) {
return res.status(404).send('Not found');
} else {
if (tileJSON['format'] == 'pbf') {
var isGzipped = data.slice(0,2).indexOf(
new Buffer([0x1f, 0x8b])) === 0;
var style = req.query.style;
if (style && tileshrinkGl) {
if (!shrinkers[style]) {
var styleJSON = styles[style];
if (styleJSON) {
var sourceName = null;
for (var sourceName_ in styleJSON.sources) {
var source = styleJSON.sources[sourceName_];
if (source &&
source.type == 'vector' &&
source.url.endsWith('/' + id + '.json')) {
sourceName = sourceName_;
}
}
shrinkers[style] = tileshrinkGl.createPBFShrinker(styleJSON, sourceName);
}
}
if (shrinkers[style]) {
if (isGzipped) {
data = zlib.unzipSync(data);
isGzipped = false;
}
data = shrinkers[style](data, z, tileJSON.maxzoom);
//console.log(shrinkers[style].getStats());
}
}
}
if (req.params.format == 'pbf') {
headers['Content-Type'] = 'application/x-protobuf';
} else if (req.params.format == 'geojson') {
headers['Content-Type'] = 'application/json';
if (isGzipped) {
data = zlib.unzipSync(data);
isGzipped = false;
}
var tile = new VectorTile(new pbf(data));
var geojson = {
"type": "FeatureCollection",
"features": []
};
for (var layerName in tile.layers) {
var layer = tile.layers[layerName];
for (var i = 0; i < layer.length; i++) {
var feature = layer.feature(i);
var featureGeoJSON = feature.toGeoJSON(x, y, z);
featureGeoJSON.properties.layer = layerName;
geojson.features.push(featureGeoJSON);
}
}
data = JSON.stringify(geojson);
}
delete headers['ETag']; // do not trust the tile ETag -- regenerate
headers['Content-Encoding'] = 'gzip';
res.set(headers);
if (!isGzipped) {
data = zlib.gzipSync(data);
isGzipped = true;
}
return res.status(200).send(data);
}
}

View File

@@ -1,7 +1,9 @@
'use strict';
var clone = require('clone'),
express = require('express');
express = require('express'),
fs = require('fs'),
path = require('path');
var utils = require('./utils');
@@ -12,14 +14,29 @@ module.exports = function(options, allowedFonts) {
var fontPath = options.paths.fonts;
var existingFonts = {};
fs.readdir(options.paths.fonts, function(err, files) {
files.forEach(function(file) {
fs.stat(path.join(fontPath, file), function(err, stats) {
if (!err) {
if (stats.isDirectory()) {
existingFonts[path.basename(file)] = true;
}
}
});
});
});
app.get('/:fontstack/:range([\\d]+-[\\d]+).pbf',
function(req, res, next) {
var fontstack = decodeURI(req.params.fontstack);
var range = req.params.range;
return utils.getFontsPbf(allowedFonts, fontPath, fontstack, range,
return utils.getFontsPbf(allowedFonts, fontPath, fontstack, range, existingFonts,
function(err, concated) {
if (err || concated.length === 0) {
console.log(err);
console.log(concated.length);
return res.status(400).send('');
} else {
res.header('Content-type', 'application/x-protobuf');

View File

@@ -24,7 +24,7 @@ var Canvas = require('canvas'),
var utils = require('./utils');
var FLOAT_PATTERN = '[+-]?(?:\\d+|\\d+\.?\\d+)';
var SCALE_PATTERN = '@[23]x';
var SCALE_PATTERN = '@[234]x';
var getScale = function(scale) {
return (scale || '@1x').slice(1, 2) | 0;
@@ -49,6 +49,19 @@ module.exports = function(options, repo, params, id, dataResolver) {
sources: {}
};
var existingFonts = {};
fs.readdir(options.paths.fonts, function(err, files) {
files.forEach(function(file) {
fs.stat(path.join(options.paths.fonts, file), function(err, stats) {
if (!err) {
if (stats.isDirectory()) {
existingFonts[path.basename(file)] = true;
}
}
});
});
});
var styleJSON;
var createPool = function(ratio, min, max) {
var createRenderer = function(ratio, createCallback) {
@@ -67,7 +80,7 @@ module.exports = function(options, repo, params, id, dataResolver) {
var parts = req.url.split('/');
var fontstack = unescape(parts[2]);
var range = parts[3].split('.')[0];
utils.getFontsPbf(null, options.paths[protocol], fontstack, range,
utils.getFontsPbf(null, options.paths[protocol], fontstack, range, existingFonts,
function(err, concated) {
callback(err, {data: concated});
});
@@ -144,9 +157,19 @@ module.exports = function(options, repo, params, id, dataResolver) {
});
};
styleJSON = clone(require(path.join(options.paths.styles, styleFile)));
styleJSON.sprite = 'sprites://' + path.basename(styleFile, '.json');
styleJSON.glyphs = 'fonts://{fontstack}/{range}.pbf';
var styleJSONPath = path.join(options.paths.styles, styleFile);
styleJSON = clone(require(styleJSONPath));
var httpTester = /^(http(s)?:)?\/\//;
if (styleJSON.sprite && !httpTester.test(styleJSON.sprite)) {
styleJSON.sprite = 'sprites://' +
styleJSON.sprite
.replace('{style}', path.basename(styleFile, '.json'))
.replace('{styleJsonFolder}', path.relative(options.paths.sprites, path.dirname(styleJSONPath)));
}
if (styleJSON.glyphs && !httpTester.test(styleJSON.glyphs)) {
styleJSON.glyphs = 'fonts://' + styleJSON.glyphs;
}
var tileJSON = {
'tilejson': '2.0.0',
@@ -194,6 +217,9 @@ module.exports = function(options, repo, params, id, dataResolver) {
}
map.sources[name] = new mbtiles(mbtilesFile, function(err) {
map.sources[name].getInfo(function(err, info) {
if (err) {
console.error(err);
}
var type = source.type;
Object.assign(source, info);
source.type = type;
@@ -202,6 +228,7 @@ module.exports = function(options, repo, params, id, dataResolver) {
// meta url which will be detected when requested
'mbtiles://' + name + '/{z}/{x}/{y}.' + (info.format || 'pbf')
];
delete source.scheme;
if (source.format == 'pbf') {
map.sources[name].emptyTile = new Buffer(0);
} else {
@@ -239,6 +266,7 @@ module.exports = function(options, repo, params, id, dataResolver) {
map.renderers[1] = createPool(1, 4, 16);
map.renderers[2] = createPool(2, 2, 8);
map.renderers[3] = createPool(3, 2, 4);
map.renderers[4] = createPool(4, 2, 4);
});
repo[id] = tileJSON;
@@ -253,7 +281,7 @@ module.exports = function(options, repo, params, id, dataResolver) {
return res.status(400).send('Invalid center');
}
if (Math.min(width, height) <= 0 ||
Math.max(width, height) * scale > 2048) {
Math.max(width, height) * scale > (options.maxSize || 2048)) {
return res.status(400).send('Invalid size');
}
if (format == 'png' || format == 'webp') {
@@ -316,9 +344,13 @@ module.exports = function(options, repo, params, id, dataResolver) {
}
if (format == 'png') {
buffer = pngquant.compress(buffer, {
quality: [0, formatQuality || 90]
});
var usePngQuant =
(options.formatQuality || {}).pngQuantization === true;
if (usePngQuant) {
buffer = pngquant.compress(buffer, {
quality: [0, formatQuality || 90]
});
}
}
res.set({
@@ -426,30 +458,33 @@ module.exports = function(options, repo, params, id, dataResolver) {
var minCorner = mercator.px([bbox[0], bbox[3]], z),
maxCorner = mercator.px([bbox[2], bbox[1]], z);
while ((((maxCorner[0] - minCorner[0]) * (1 + 2 * padding) > w) ||
((maxCorner[1] - minCorner[1]) * (1 + 2 * padding) > h)) && z > 0) {
z--;
minCorner[0] /= 2;
minCorner[1] /= 2;
maxCorner[0] /= 2;
maxCorner[1] /= 2;
}
var w_ = w / (1 + 2 * padding);
var h_ = h / (1 + 2 * padding);
z -= Math.max(
Math.log((maxCorner[0] - minCorner[0]) / w_),
Math.log((maxCorner[1] - minCorner[1]) / h_)
) / Math.LN2;
z = Math.max(Math.log(Math.max(w, h) / 256) / Math.LN2, Math.min(25, z));
return z;
};
var staticPattern =
'/static/%s/:width(\\d+)x:height(\\d+)' +
'/static/:raw(raw)?/%s/:width(\\d+)x:height(\\d+)' +
':scale(' + SCALE_PATTERN + ')?\.:format([\\w]+)';
var centerPattern =
util.format(':lon(%s),:lat(%s),:z(\\d+)(@:bearing(%s)(,:pitch(%s))?)?',
FLOAT_PATTERN, FLOAT_PATTERN, FLOAT_PATTERN, FLOAT_PATTERN);
util.format(':x(%s),:y(%s),:z(%s)(@:bearing(%s)(,:pitch(%s))?)?',
FLOAT_PATTERN, FLOAT_PATTERN, FLOAT_PATTERN,
FLOAT_PATTERN, FLOAT_PATTERN);
app.get(util.format(staticPattern, centerPattern), function(req, res, next) {
var z = req.params.z | 0,
x = +req.params.lon,
y = +req.params.lat,
var raw = req.params.raw;
var z = +req.params.z,
x = +req.params.x,
y = +req.params.y,
bearing = +(req.params.bearing || '0'),
pitch = +(req.params.pitch || '0'),
w = req.params.width | 0,
@@ -457,6 +492,16 @@ module.exports = function(options, repo, params, id, dataResolver) {
scale = getScale(req.params.scale),
format = req.params.format;
if (z < 0) {
return res.status(404).send('Invalid zoom');
}
if (raw) {
var ll = mercator.inverse([x, y]);
x = ll[0];
y = ll[1];
}
var path = extractPathFromQuery(req.query);
var overlay = renderOverlay(z, x, y, bearing, pitch, w, h, scale,
path, req.query);
@@ -470,8 +515,19 @@ module.exports = function(options, repo, params, id, dataResolver) {
FLOAT_PATTERN, FLOAT_PATTERN, FLOAT_PATTERN, FLOAT_PATTERN);
app.get(util.format(staticPattern, boundsPattern), function(req, res, next) {
var raw = req.params.raw;
var bbox = [+req.params.minx, +req.params.miny,
+req.params.maxx, +req.params.maxy];
if (raw) {
var minCorner = mercator.inverse(bbox.slice(0, 2));
var maxCorner = mercator.inverse(bbox.slice(2));
bbox[0] = minCorner[0];
bbox[1] = minCorner[1];
bbox[2] = maxCorner[0];
bbox[3] = maxCorner[1];
}
var w = req.params.width | 0,
h = req.params.height | 0,
scale = getScale(req.params.scale),
@@ -498,6 +554,7 @@ module.exports = function(options, repo, params, id, dataResolver) {
return res.status(400).send('Invalid path');
}
var raw = req.params.raw;
var w = req.params.width | 0,
h = req.params.height | 0,
bearing = 0,
@@ -517,6 +574,12 @@ module.exports = function(options, repo, params, id, dataResolver) {
x = (bbox[0] + bbox[2]) / 2,
y = (bbox[1] + bbox[3]) / 2;
if (raw) {
var ll = mercator.inverse([x, y]);
x = ll[0];
y = ll[1];
}
var overlay = renderOverlay(z, x, y, bearing, pitch, w, h, scale,
path, req.query);

View File

@@ -43,19 +43,35 @@ module.exports = function(options, repo, params, id, reportTiles, reportFont) {
};
styleJSON.layers.forEach(findFontReferences);
var spritePath = path.join(options.paths.sprites,
path.basename(styleFile, '.json'));
var spritePath;
styleJSON.sprite = 'local://styles/' + id + '/sprite';
styleJSON.glyphs = 'local://fonts/{fontstack}/{range}.pbf';
var httpTester = /^(http(s)?:)?\/\//;
if (styleJSON.sprite && !httpTester.test(styleJSON.sprite)) {
spritePath = path.join(options.paths.sprites,
styleJSON.sprite
.replace('{style}', path.basename(styleFile, '.json'))
.replace('{styleJsonFolder}', path.relative(options.paths.sprites, path.dirname(styleFile)))
);
styleJSON.sprite = 'local://styles/' + id + '/sprite';
}
if (styleJSON.glyphs && !httpTester.test(styleJSON.glyphs)) {
styleJSON.glyphs = 'local://fonts/{fontstack}/{range}.pbf';
}
repo[id] = styleJSON;
app.get('/' + id + '.json', function(req, res, next) {
var fixUrl = function(url, opt_nokey) {
var query = '';
var fixUrl = function(url, opt_nokey, opt_nostyle) {
var queryParams = [];
if (!opt_nostyle) {
queryParams.push('style=' + id);
}
if (!opt_nokey && req.query.key) {
query = '?key=' + req.query.key;
queryParams.unshift('key=' + req.query.key);
}
var query = '';
if (queryParams.length) {
query = '?' + queryParams.join('&');
}
return url.replace(
'local://', req.protocol + '://' + req.headers.host + '/') + query;
@@ -67,13 +83,20 @@ module.exports = function(options, repo, params, id, reportTiles, reportFont) {
source.url = fixUrl(source.url);
});
// mapbox-gl-js viewer cannot handle sprite urls with query
styleJSON_.sprite = fixUrl(styleJSON_.sprite, true);
styleJSON_.glyphs = fixUrl(styleJSON_.glyphs);
if (styleJSON_.sprite) {
styleJSON_.sprite = fixUrl(styleJSON_.sprite, true, true);
}
if (styleJSON_.glyphs) {
styleJSON_.glyphs = fixUrl(styleJSON_.glyphs, false, true);
}
return res.send(styleJSON_);
});
app.get('/' + id + '/sprite:scale(@[23]x)?\.:format([\\w]+)',
function(req, res, next) {
if (!spritePath) {
return res.status(404).send('File not found');
}
var scale = req.params.scale,
format = req.params.format;
var filename = spritePath + (scale || '') + '.' + format;

View File

@@ -22,7 +22,8 @@ var packageJson = require('../package'),
serve_data = require('./serve_data'),
utils = require('./utils');
if (packageJson.name.slice(-6) !== '-light') {
var isLight = packageJson.name.slice(-6) == '-light';
if (!isLight) {
// do not require `serve_rendered` in the light package
serve_rendered = require('./serve_rendered');
}
@@ -152,7 +153,7 @@ module.exports = function(opts, callback) {
return;
}
app.use('/data/', serve_data(options, serving.data, item, id));
app.use('/data/', serve_data(options, serving.data, item, id, serving.styles));
});
app.get('/styles.json', function(req, res, next) {
@@ -212,6 +213,7 @@ module.exports = function(opts, callback) {
}
}
data['server_version'] = packageJson.name + ' v' + packageJson.version;
data['is_light'] = isLight;
data['key_query_part'] =
req.query.key ? 'key=' + req.query.key + '&amp;' : '';
data['key_query'] = req.query.key ? '?key=' + req.query.key : '';
@@ -247,7 +249,7 @@ module.exports = function(opts, callback) {
var tiles = utils.getTileUrls(
req, style.serving_rendered.tiles,
'styles/' + id, style.serving_rendered.format);
'styles/' + id + '/rendered', style.serving_rendered.format);
style.xyz_link = tiles[0];
}
});

View File

@@ -4,7 +4,8 @@ var async = require('async'),
path = require('path'),
fs = require('fs');
var glyphCompose = require('glyph-pbf-composite');
var clone = require('clone'),
glyphCompose = require('glyph-pbf-composite');
module.exports.getTileUrls = function(req, domains, path, format) {
@@ -18,7 +19,14 @@ module.exports.getTileUrls = function(req, domains, path, format) {
}
var key = req.query.key;
var query = (key && key.length > 0) ? ('?key=' + key) : '';
var queryParams = [];
if (req.query.key) {
queryParams.push('key=' + req.query.key);
}
if (req.query.style) {
queryParams.push('style=' + req.query.style);
}
var query = queryParams.length > 0 ? ('?' + queryParams.join('&')) : '';
var uris = [];
domains.forEach(function(domain) {
@@ -44,13 +52,25 @@ module.exports.fixTileJSONCenter = function(tileJSON) {
}
};
module.exports.getFontsPbf = function(allowedFonts, fontPath, names, range, callback) {
var getFontPbf = function(name, range, callback) {
if (!allowedFonts || allowedFonts[name]) {
module.exports.getFontsPbf = function(allowedFonts, fontPath, names, range, fallbacks, callback) {
var getFontPbf = function(allowedFonts, name, range, callback, fallbacks) {
if (!allowedFonts || (allowedFonts[name] && fallbacks)) {
var filename = path.join(fontPath, name, range + '.pbf');
if (!fallbacks) {
fallbacks = clone(allowedFonts || {});
}
delete fallbacks[name];
return fs.readFile(filename, function(err, data) {
if (err) {
return callback(new Error('Font load error: ' + name));
console.error('ERROR: Font not found:', name);
if (fallbacks && Object.keys(fallbacks).length) {
var fallbackName = Object.keys(fallbacks)[0];
console.error('ERROR: Trying to use', fallbackName, 'as a fallback');
delete fallbacks[fallbackName];
return getFontPbf(null, fallbackName, range, callback, fallbacks);
} else {
return callback(new Error('Font load error: ' + name));
}
} else {
return callback(null, data);
}
@@ -64,7 +84,7 @@ module.exports.getFontsPbf = function(allowedFonts, fontPath, names, range, call
var queue = [];
fonts.forEach(function(font) {
queue.push(function(callback) {
getFontPbf(font, range, callback);
getFontPbf(allowedFonts, font, range, callback, clone(allowedFonts || fallbacks));
});
});

View File

@@ -64,6 +64,6 @@ describe('Metadata', function() {
});
});
testTileJSON('/styles/bright/rendered.json', 'bright');
testTileJSON('/data/zurich-vector.json', 'zurich-vector');
testTileJSON('/styles/test-style/rendered.json', 'test-style');
testTileJSON('/data/openmaptiles.json', 'openmaptiles');
});

View File

@@ -12,7 +12,7 @@ var testStatic = function(prefix, q, format, status, scale, type, query) {
});
};
var prefix = 'bright';
var prefix = 'test-style';
describe('Static endpoints', function() {
describe('center-based', function() {
@@ -28,6 +28,8 @@ describe('Static endpoints', function() {
testStatic(prefix, '0,0,0/300x300', 'png', 200, 2);
testStatic(prefix, '0,0,0/300x300', 'png', 200, 3);
testStatic(prefix, '0,0,1.5/256x256', 'png', 200);
testStatic(prefix, '80,40,20/600x300', 'png', 200, 3);
testStatic(prefix, '8.5,40.5,20/300x150', 'png', 200, 3);
testStatic(prefix, '-8.5,-40.5,20/300x150', 'png', 200, 3);
@@ -48,7 +50,6 @@ describe('Static endpoints', function() {
testStatic(prefix, '0,0,0/256x256', 'png', 404, 1);
testStatic(prefix, '0,0,-1/256x256', 'png', 404);
testStatic(prefix, '0,0,1.5/256x256', 'png', 404);
testStatic(prefix, '0,0,0/256.5x256.5', 'png', 404);
testStatic(prefix, '0,0,0,/256x256', 'png', 404);

View File

@@ -8,7 +8,7 @@ var testIs = function(url, type, status) {
});
};
var prefix = 'bright';
var prefix = 'test-style';
describe('Styles', function() {
describe('/styles/' + prefix + '.json is valid style', function() {

View File

@@ -8,7 +8,7 @@ var testTile = function(prefix, z, x, y, status) {
});
};
var prefix = 'zurich-vector';
var prefix = 'openmaptiles';
describe('Vector tiles', function() {
describe('existing tiles', function() {

View File

@@ -9,7 +9,7 @@ var testTile = function(prefix, z, x, y, format, status, scale, type) {
});
};
var prefix = 'bright';
var prefix = 'test-style';
describe('Raster tiles', function() {
describe('valid requests', function() {
@@ -26,6 +26,7 @@ describe('Raster tiles', function() {
testTile(prefix, 0, 0, 0, 'png', 200, 2);
testTile(prefix, 0, 0, 0, 'png', 200, 3);
testTile(prefix, 2, 1, 1, 'png', 200, 3);
testTile(prefix, 0, 0, 0, 'png', 200, 4);
});
});
@@ -39,7 +40,7 @@ describe('Raster tiles', function() {
testTile(prefix, 0, 0, 0, 'pbf', 400);
testTile(prefix, 0, 0, 0, 'png', 404, 1);
testTile(prefix, 0, 0, 0, 'png', 404, 4);
testTile(prefix, 0, 0, 0, 'png', 404, 5);
//testTile('hybrid', 0, 0, 0, 'png', 404); //TODO: test this
});