Compare commits
64 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7acbc93ba9 | ||
|
|
bc3d79bfdc | ||
|
|
58168eb0a5 | ||
|
|
f993b01387 | ||
|
|
782c28cd64 | ||
|
|
76a0064f0c | ||
|
|
55fa8bf8c1 | ||
|
|
0c42fdd6b3 | ||
|
|
e8b3c02546 | ||
|
|
56089c0a62 | ||
|
|
857ff2d8d7 | ||
|
|
e310fa5165 | ||
|
|
71fab2a2a1 | ||
|
|
1c59e3d742 | ||
|
|
6e24f6ec8e | ||
|
|
5d5ed1153f | ||
|
|
baf01a117b | ||
|
|
2cc2cc1b3b | ||
|
|
45ed8d90ca | ||
|
|
8e66736955 | ||
|
|
72ea5ab05d | ||
|
|
9d642fa0b3 | ||
|
|
1d734f9b42 | ||
|
|
80146ed7d9 | ||
|
|
a28df7ef8f | ||
|
|
c333197a7c | ||
|
|
45df72df51 | ||
|
|
e737753891 | ||
|
|
edff8ce06c | ||
|
|
df05ce3f2a | ||
|
|
a74ca20375 | ||
|
|
1c890b0157 | ||
|
|
7a9f04a024 | ||
|
|
1354c7f663 | ||
|
|
da3cb1e7f5 | ||
|
|
19e821a8fe | ||
|
|
659289d85c | ||
|
|
734d1f01f0 | ||
|
|
c1055a9647 | ||
|
|
2afb460191 | ||
|
|
8eb736b821 | ||
|
|
83e20b7a4e | ||
|
|
81f65af3a8 | ||
|
|
f5ea790878 | ||
|
|
a0eb5800fd | ||
|
|
27eb7f0ed8 | ||
|
|
2f9059d09e | ||
|
|
e11c8f9315 | ||
|
|
650718e0f6 | ||
|
|
5ed632c229 | ||
|
|
f545076986 | ||
|
|
3d48485475 | ||
|
|
c060dedf20 | ||
|
|
cd1f5fd04a | ||
|
|
82f179b07c | ||
|
|
51d6ca0880 | ||
|
|
89878015bb | ||
|
|
ac948b6dee | ||
|
|
440775dbbf | ||
|
|
ea408f8ec9 | ||
|
|
da646868c3 | ||
|
|
d60996e3c6 | ||
|
|
02cf45bbd9 | ||
|
|
d9f8582279 |
22
Dockerfile
22
Dockerfile
@@ -1,6 +1,12 @@
|
||||
FROM debian:stretch
|
||||
FROM node:6-stretch
|
||||
MAINTAINER Petr Sloup <petr.sloup@klokantech.com>
|
||||
|
||||
ENV NODE_ENV="production"
|
||||
VOLUME /data
|
||||
WORKDIR /data
|
||||
EXPOSE 80
|
||||
ENTRYPOINT ["/bin/bash", "/usr/src/app/run.sh"]
|
||||
|
||||
RUN apt-get -qq update \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get -y install \
|
||||
apt-transport-https \
|
||||
@@ -15,22 +21,8 @@ RUN apt-get -qq update \
|
||||
libprotobuf-dev \
|
||||
libxxf86vm-dev \
|
||||
xvfb \
|
||||
&& echo "deb https://deb.nodesource.com/node_6.x stretch main" >> /etc/apt/sources.list.d/nodejs.list \
|
||||
&& echo "deb-src https://deb.nodesource.com/node_6.x stretch main" >> /etc/apt/sources.list.d/nodejs.list \
|
||||
&& apt-get -qq update \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get -y --allow-unauthenticated install \
|
||||
nodejs \
|
||||
&& rm /etc/apt/sources.list.d/nodejs.list \
|
||||
&& apt-get clean
|
||||
|
||||
RUN mkdir -p /usr/src/app
|
||||
COPY / /usr/src/app
|
||||
RUN cd /usr/src/app && npm install --production
|
||||
|
||||
VOLUME /data
|
||||
WORKDIR /data
|
||||
|
||||
ENV NODE_ENV="production"
|
||||
|
||||
EXPOSE 80
|
||||
ENTRYPOINT ["/usr/src/app/run.sh"]
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
FROM node:6
|
||||
MAINTAINER Petr Sloup <petr.sloup@klokantech.com>
|
||||
|
||||
ENV NODE_ENV="production"
|
||||
EXPOSE 80
|
||||
VOLUME /data
|
||||
WORKDIR /data
|
||||
ENTRYPOINT ["node", "/usr/src/app/", "-p", "80"]
|
||||
|
||||
RUN mkdir -p /usr/src/app
|
||||
COPY / /usr/src/app
|
||||
RUN cd /usr/src/app && npm install --production
|
||||
|
||||
VOLUME /data
|
||||
WORKDIR /data
|
||||
|
||||
ENV NODE_ENV="production"
|
||||
|
||||
EXPOSE 80
|
||||
ENTRYPOINT ["node", "/usr/src/app/", "-p", "80"]
|
||||
|
||||
21
ISSUE_TEMPLATE.md
Normal file
21
ISSUE_TEMPLATE.md
Normal file
@@ -0,0 +1,21 @@
|
||||
It is great you want to help us making TileServer GL project better!
|
||||
|
||||
This is the right place only for a software bug report or a new software feature request.
|
||||
|
||||
NOTE: Questions about OpenMapTiles data, OpenMapTiles Server, TileHosting and other software/products do not belong here (and will not be answered)!
|
||||
|
||||
The usage and installation questions belongs to https://stackoverflow.com/questions/tagged/openmaptiles
|
||||
A guaranteed support and consulting from the core developers via https://openmaptiles.com/support/
|
||||
|
||||
Please search this GitHub repo for similar requests before posting (check also closed tickets).
|
||||
|
||||
When reporting a problem you have with the TileServer GL software please provide:
|
||||
|
||||
- Clear description of the problem: What steps will lead to reproducing the error on our computer? What is exactly wrong?
|
||||
- Version of the TileServer GL software you have used
|
||||
- Version and name of the operating system you use or other details of your setup
|
||||
- Information about your used config / styles / vector tiles
|
||||
- URL / link to the specific location in a live map demo where a bug is visible is always great
|
||||
- Screenshot of the problem are cool! Drag&drop an image to the report here...
|
||||
|
||||
We love pull requests! If you are able to code, please send us your fix or code modification via GitHub... Thanks!
|
||||
@@ -9,6 +9,8 @@ Vector and raster maps with GL styles. Server side rendering by Mapbox GL Native
|
||||
|
||||
## Get Started
|
||||
|
||||
Make sure you have Node.js version **6** installed (running `node -v` it should output something like `v6.11.3`).
|
||||
|
||||
Install `tileserver-gl` with server-side raster rendering of vector tiles with npm
|
||||
|
||||
```bash
|
||||
@@ -18,7 +20,7 @@ npm install -g tileserver-gl
|
||||
Now download vector tiles from [OpenMapTiles](https://openmaptiles.org/downloads/).
|
||||
|
||||
```bash
|
||||
curl -o zurich_switzerland.mbtiles https://openmaptiles.os.zhdk.cloud.switch.ch/v3.3/extracts/zurich_switzerland.mbtiles
|
||||
curl -o zurich_switzerland.mbtiles https://[GET-YOUR-LINK]/extracts/zurich_switzerland.mbtiles
|
||||
```
|
||||
|
||||
Start `tileserver-gl` with the downloaded vector tiles.
|
||||
|
||||
@@ -21,9 +21,7 @@ Example::
|
||||
],
|
||||
"formatQuality": {
|
||||
"jpeg": 80,
|
||||
"webp": 90,
|
||||
"pngQuantization": false,
|
||||
"png": 90
|
||||
"webp": 90
|
||||
},
|
||||
"maxScaleFactor": 3,
|
||||
"maxSize": 2048,
|
||||
@@ -83,8 +81,6 @@ Use ``false`` to disable the front page altogether (404).
|
||||
|
||||
Quality of the compression of individual image formats. [0-100]
|
||||
|
||||
The value for ``png`` is only used when ``pngQuantization`` is ``true``.
|
||||
|
||||
``maxScaleFactor``
|
||||
-----------
|
||||
|
||||
@@ -99,6 +95,27 @@ Maximum image side length to be allowed to be rendered (including scale factor).
|
||||
Be careful when changing this value since there are hardware limits that need to be considered.
|
||||
Default is ``2048``.
|
||||
|
||||
``minRendererPoolSizes``
|
||||
------------------------
|
||||
|
||||
Minimum amount of raster tile renderers per scale factor.
|
||||
The value is an array: the first element is the minimum amount of renderers for scale factor one, the second for scale factor two and so on.
|
||||
If the array has less elements than ``maxScaleFactor``, then the last element is used for all remaining scale factors as well.
|
||||
Selecting renderer pool sizes is a trade-off between memory use and speed.
|
||||
A reasonable value will depend on your hardware and your amount of styles and scale factors.
|
||||
If you have plenty of memory, you'll want to set this equal to ``maxRendererPoolSizes`` to avoid increased latency due to renderer destruction and recreation.
|
||||
If you need to conserve memory, you'll want something lower than ``maxRendererPoolSizes``, possibly allocating more renderers to scale factors that are more common.
|
||||
Default is ``[8, 4, 2]``.
|
||||
|
||||
``maxRendererPoolSizes``
|
||||
------------------------
|
||||
|
||||
Maximum amount of raster tile renderers per scale factor.
|
||||
The value and considerations are similar to ``minRendererPoolSizes`` above.
|
||||
If you have plenty of memory, try setting these equal to or slightly above your processor count, e.g. if you have four processors, try a value of ``[6]``.
|
||||
If you need to conserve memory, try lower values for scale factors that are less common.
|
||||
Default is ``[16, 8, 4]``.
|
||||
|
||||
``watermark``
|
||||
-----------
|
||||
|
||||
@@ -156,7 +173,7 @@ Sprites
|
||||
|
||||
If your style requires any sprites, make sure the style JSON contains proper path in the ``sprite`` property.
|
||||
|
||||
It can be a local path (e.g. ``my-style/sprite``) or remove http(s) location (e.g. ``https://mycdn.com/my-style/sprite``). Several possible extension are added to this path, so the following files should be present:
|
||||
It can be a local path (e.g. ``my-style/sprite``) or remote http(s) location (e.g. ``https://mycdn.com/my-style/sprite``). Several possible extension are added to this path, so the following files should be present:
|
||||
|
||||
* ``sprite.json``
|
||||
* ``sprite.png``
|
||||
|
||||
@@ -21,6 +21,10 @@ Rendered tiles
|
||||
|
||||
* The rendered tiles are not available in the ``tileserver-gl-light`` version.
|
||||
|
||||
WMTS Capabilities
|
||||
==============
|
||||
* WMTS Capabilities are served at ``/styles/{id}/wmts.xml``
|
||||
|
||||
Static images
|
||||
=============
|
||||
* Several endpoints:
|
||||
|
||||
@@ -4,21 +4,22 @@ Usage
|
||||
|
||||
Getting started
|
||||
======
|
||||
|
||||
::
|
||||
|
||||
Usage: tileserver-gl [mbtiles] [options]
|
||||
Usage: main.js tileserver-gl [mbtiles] [options]
|
||||
|
||||
mbtiles MBTiles file (uses demo configuration);
|
||||
ignored if the configuration file is also specified
|
||||
|
||||
Options:
|
||||
-c, --config Configuration file [config.json]
|
||||
-b, --bind Bind address
|
||||
-p, --port Port [8080]
|
||||
-V, --verbose More verbose output
|
||||
-v, --version Version info
|
||||
Options:
|
||||
|
||||
-h, --help output usage information
|
||||
--mbtiles <file> MBTiles file (uses demo configuration);
|
||||
ignored if the configuration file is also specified
|
||||
-c, --config <file> Configuration file [config.json]
|
||||
-b, --bind <address> Bind address
|
||||
-p, --port <port> Port [8080]
|
||||
-C|--no-cors Disable Cross-origin resource sharing headers
|
||||
-V, --verbose More verbose output
|
||||
-s, --silent Less verbose output
|
||||
-v, --version Version info
|
||||
|
||||
|
||||
Default styles and configuration
|
||||
|
||||
40
package.json
40
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tileserver-gl",
|
||||
"version": "2.2.0",
|
||||
"version": "2.4.0",
|
||||
"description": "Map tile server for JSON GL styles - vector and server side generated raster tiles",
|
||||
"main": "src/main.js",
|
||||
"bin": "src/main.js",
|
||||
@@ -16,35 +16,33 @@
|
||||
"node": ">=6 <7"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha test/**.js"
|
||||
"test": "mocha test/**.js --timeout 10000"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mapbox/mapbox-gl-native": "3.5.4",
|
||||
"@mapbox/mbtiles": "0.9.0",
|
||||
"@mapbox/sphericalmercator": "1.0.5",
|
||||
"@mapbox/vector-tile": "1.3.0",
|
||||
"@mapbox/mbtiles": "0.10.0",
|
||||
"@mapbox/sphericalmercator": "1.1.0",
|
||||
"@mapbox/vector-tile": "1.3.1",
|
||||
"advanced-pool": "0.3.3",
|
||||
"base64url": "2.0.0",
|
||||
"canvas": "1.6.6",
|
||||
"clone": "2.1.1",
|
||||
"color": "1.0.3",
|
||||
"canvas": "1.6.12",
|
||||
"clone": "2.1.2",
|
||||
"color": "3.0.0",
|
||||
"commander": "2.18.0",
|
||||
"cors": "2.8.4",
|
||||
"express": "4.15.4",
|
||||
"express": "4.16.3",
|
||||
"glyph-pbf-composite": "0.0.2",
|
||||
"handlebars": "4.0.10",
|
||||
"handlebars": "4.0.12",
|
||||
"http-shutdown": "^1.2.0",
|
||||
"morgan": "1.8.2",
|
||||
"node-pngquant-native": "1.0.5",
|
||||
"nomnom": "1.8.1",
|
||||
"pbf": "3.0.5",
|
||||
"proj4": "2.4.4",
|
||||
"request": "2.81.0",
|
||||
"sharp": "0.18.2",
|
||||
"morgan": "1.9.1",
|
||||
"pbf": "3.1.0",
|
||||
"proj4": "2.5.0",
|
||||
"request": "2.88.0",
|
||||
"sharp": "0.20.8",
|
||||
"tileserver-gl-styles": "1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"should": "^11.2.0",
|
||||
"mocha": "^3.2.0",
|
||||
"supertest": "^3.0.0"
|
||||
"mocha": "^5.2.0",
|
||||
"should": "^13.2.0",
|
||||
"supertest": "^3.1.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,14 @@
|
||||
position: relative;
|
||||
-webkit-tap-highlight-color: rgba(0,0,0,0);
|
||||
}
|
||||
.mapboxgl-map:-webkit-full-screen {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.mapboxgl-missing-css {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.mapboxgl-canvas-container.mapboxgl-interactive,
|
||||
.mapboxgl-ctrl-nav-compass {
|
||||
@@ -90,11 +98,51 @@
|
||||
.mapboxgl-ctrl-icon.mapboxgl-ctrl-zoom-in {
|
||||
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%0A%20%20%3Cpath%20style%3D%27fill%3A%23333333%3B%27%20d%3D%27M%2010%206%20C%209.446%206%209%206.4459904%209%207%20L%209%209%20L%207%209%20C%206.446%209%206%209.446%206%2010%20C%206%2010.554%206.446%2011%207%2011%20L%209%2011%20L%209%2013%20C%209%2013.55401%209.446%2014%2010%2014%20C%2010.554%2014%2011%2013.55401%2011%2013%20L%2011%2011%20L%2013%2011%20C%2013.554%2011%2014%2010.554%2014%2010%20C%2014%209.446%2013.554%209%2013%209%20L%2011%209%20L%2011%207%20C%2011%206.4459904%2010.554%206%2010%206%20z%27%20%2F%3E%0A%3C%2Fsvg%3E%0A");
|
||||
}
|
||||
.mapboxgl-ctrl-icon.mapboxgl-ctrl-geolocate {
|
||||
.mapboxgl-ctrl-icon.mapboxgl-ctrl-geolocate {
|
||||
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D%270%200%2020%2020%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%0D%0A%20%20%3Cpath%20style%3D%27fill%3A%23333%3B%27%20d%3D%27M10%204C9%204%209%205%209%205L9%205.1A5%205%200%200%200%205.1%209L5%209C5%209%204%209%204%2010%204%2011%205%2011%205%2011L5.1%2011A5%205%200%200%200%209%2014.9L9%2015C9%2015%209%2016%2010%2016%2011%2016%2011%2015%2011%2015L11%2014.9A5%205%200%200%200%2014.9%2011L15%2011C15%2011%2016%2011%2016%2010%2016%209%2015%209%2015%209L14.9%209A5%205%200%200%200%2011%205.1L11%205C11%205%2011%204%2010%204zM10%206.5A3.5%203.5%200%200%201%2013.5%2010%203.5%203.5%200%200%201%2010%2013.5%203.5%203.5%200%200%201%206.5%2010%203.5%203.5%200%200%201%2010%206.5zM10%208.3A1.8%201.8%200%200%200%208.3%2010%201.8%201.8%200%200%200%2010%2011.8%201.8%201.8%200%200%200%2011.8%2010%201.8%201.8%200%200%200%2010%208.3z%27%20%2F%3E%0D%0A%3C%2Fsvg%3E");
|
||||
}
|
||||
.mapboxgl-ctrl-icon.mapboxgl-ctrl-geolocate.mapboxgl-watching {
|
||||
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D%270%200%2020%2020%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%0D%0A%20%20%3Cpath%20style%3D%27fill%3A%2300f%3B%27%20d%3D%27M10%204C9%204%209%205%209%205L9%205.1A5%205%200%200%200%205.1%209L5%209C5%209%204%209%204%2010%204%2011%205%2011%205%2011L5.1%2011A5%205%200%200%200%209%2014.9L9%2015C9%2015%209%2016%2010%2016%2011%2016%2011%2015%2011%2015L11%2014.9A5%205%200%200%200%2014.9%2011L15%2011C15%2011%2016%2011%2016%2010%2016%209%2015%209%2015%209L14.9%209A5%205%200%200%200%2011%205.1L11%205C11%205%2011%204%2010%204zM10%206.5A3.5%203.5%200%200%201%2013.5%2010%203.5%203.5%200%200%201%2010%2013.5%203.5%203.5%200%200%201%206.5%2010%203.5%203.5%200%200%201%2010%206.5zM10%208.3A1.8%201.8%200%200%200%208.3%2010%201.8%201.8%200%200%200%2010%2011.8%201.8%201.8%200%200%200%2011.8%2010%201.8%201.8%200%200%200%2010%208.3z%27%20%2F%3E%0D%0A%3C%2Fsvg%3E");
|
||||
.mapboxgl-ctrl-icon.mapboxgl-ctrl-geolocate:disabled {
|
||||
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D%270%200%2020%2020%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%0D%0A%20%20%3Cpath%20style%3D%27fill%3A%23aaa%3B%27%20d%3D%27M10%204C9%204%209%205%209%205L9%205.1A5%205%200%200%200%205.1%209L5%209C5%209%204%209%204%2010%204%2011%205%2011%205%2011L5.1%2011A5%205%200%200%200%209%2014.9L9%2015C9%2015%209%2016%2010%2016%2011%2016%2011%2015%2011%2015L11%2014.9A5%205%200%200%200%2014.9%2011L15%2011C15%2011%2016%2011%2016%2010%2016%209%2015%209%2015%209L14.9%209A5%205%200%200%200%2011%205.1L11%205C11%205%2011%204%2010%204zM10%206.5A3.5%203.5%200%200%201%2013.5%2010%203.5%203.5%200%200%201%2010%2013.5%203.5%203.5%200%200%201%206.5%2010%203.5%203.5%200%200%201%2010%206.5zM10%208.3A1.8%201.8%200%200%200%208.3%2010%201.8%201.8%200%200%200%2010%2011.8%201.8%201.8%200%200%200%2011.8%2010%201.8%201.8%200%200%200%2010%208.3z%27%20%2F%3E%0D%0A%3C%2Fsvg%3E");
|
||||
}
|
||||
.mapboxgl-ctrl-icon.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active {
|
||||
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D%270%200%2020%2020%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%0D%0A%20%20%3Cpath%20style%3D%27fill%3A%2333b5e5%3B%27%20d%3D%27M10%204C9%204%209%205%209%205L9%205.1A5%205%200%200%200%205.1%209L5%209C5%209%204%209%204%2010%204%2011%205%2011%205%2011L5.1%2011A5%205%200%200%200%209%2014.9L9%2015C9%2015%209%2016%2010%2016%2011%2016%2011%2015%2011%2015L11%2014.9A5%205%200%200%200%2014.9%2011L15%2011C15%2011%2016%2011%2016%2010%2016%209%2015%209%2015%209L14.9%209A5%205%200%200%200%2011%205.1L11%205C11%205%2011%204%2010%204zM10%206.5A3.5%203.5%200%200%201%2013.5%2010%203.5%203.5%200%200%201%2010%2013.5%203.5%203.5%200%200%201%206.5%2010%203.5%203.5%200%200%201%2010%206.5zM10%208.3A1.8%201.8%200%200%200%208.3%2010%201.8%201.8%200%200%200%2010%2011.8%201.8%201.8%200%200%200%2011.8%2010%201.8%201.8%200%200%200%2010%208.3z%27%20%2F%3E%0D%0A%3C%2Fsvg%3E");
|
||||
}
|
||||
.mapboxgl-ctrl-icon.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-active-error {
|
||||
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D%270%200%2020%2020%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%0D%0A%20%20%3Cpath%20style%3D%27fill%3A%23e58978%3B%27%20d%3D%27M10%204C9%204%209%205%209%205L9%205.1A5%205%200%200%200%205.1%209L5%209C5%209%204%209%204%2010%204%2011%205%2011%205%2011L5.1%2011A5%205%200%200%200%209%2014.9L9%2015C9%2015%209%2016%2010%2016%2011%2016%2011%2015%2011%2015L11%2014.9A5%205%200%200%200%2014.9%2011L15%2011C15%2011%2016%2011%2016%2010%2016%209%2015%209%2015%209L14.9%209A5%205%200%200%200%2011%205.1L11%205C11%205%2011%204%2010%204zM10%206.5A3.5%203.5%200%200%201%2013.5%2010%203.5%203.5%200%200%201%2010%2013.5%203.5%203.5%200%200%201%206.5%2010%203.5%203.5%200%200%201%2010%206.5zM10%208.3A1.8%201.8%200%200%200%208.3%2010%201.8%201.8%200%200%200%2010%2011.8%201.8%201.8%200%200%200%2011.8%2010%201.8%201.8%200%200%200%2010%208.3z%27%20%2F%3E%0D%0A%3C%2Fsvg%3E");
|
||||
}
|
||||
.mapboxgl-ctrl-icon.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background {
|
||||
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D%270%200%2020%2020%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%0A%20%20%3Cpath%20style%3D%27fill%3A%2333b5e5%3B%27%20d%3D%27M%2010%2C4%20C%209%2C4%209%2C5%209%2C5%20L%209%2C5.1%20C%207.0357113%2C5.5006048%205.5006048%2C7.0357113%205.1%2C9%20L%205%2C9%20c%200%2C0%20-1%2C0%20-1%2C1%200%2C1%201%2C1%201%2C1%20l%200.1%2C0%20c%200.4006048%2C1.964289%201.9357113%2C3.499395%203.9%2C3.9%20L%209%2C15%20c%200%2C0%200%2C1%201%2C1%201%2C0%201%2C-1%201%2C-1%20l%200%2C-0.1%20c%201.964289%2C-0.400605%203.499395%2C-1.935711%203.9%2C-3.9%20l%200.1%2C0%20c%200%2C0%201%2C0%201%2C-1%20C%2016%2C9%2015%2C9%2015%2C9%20L%2014.9%2C9%20C%2014.499395%2C7.0357113%2012.964289%2C5.5006048%2011%2C5.1%20L%2011%2C5%20c%200%2C0%200%2C-1%20-1%2C-1%20z%20m%200%2C2.5%20c%201.932997%2C0%203.5%2C1.5670034%203.5%2C3.5%200%2C1.932997%20-1.567003%2C3.5%20-3.5%2C3.5%20C%208.0670034%2C13.5%206.5%2C11.932997%206.5%2C10%206.5%2C8.0670034%208.0670034%2C6.5%2010%2C6.5%20Z%27%20%2F%3E%0A%3C%2Fsvg%3E");
|
||||
}
|
||||
.mapboxgl-ctrl-icon.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-background-error {
|
||||
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg%20viewBox%3D%270%200%2020%2020%27%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%3E%0A%20%20%3Cpath%20style%3D%27fill%3A%23e54e33%3B%27%20d%3D%27M%2010%2C4%20C%209%2C4%209%2C5%209%2C5%20L%209%2C5.1%20C%207.0357113%2C5.5006048%205.5006048%2C7.0357113%205.1%2C9%20L%205%2C9%20c%200%2C0%20-1%2C0%20-1%2C1%200%2C1%201%2C1%201%2C1%20l%200.1%2C0%20c%200.4006048%2C1.964289%201.9357113%2C3.499395%203.9%2C3.9%20L%209%2C15%20c%200%2C0%200%2C1%201%2C1%201%2C0%201%2C-1%201%2C-1%20l%200%2C-0.1%20c%201.964289%2C-0.400605%203.499395%2C-1.935711%203.9%2C-3.9%20l%200.1%2C0%20c%200%2C0%201%2C0%201%2C-1%20C%2016%2C9%2015%2C9%2015%2C9%20L%2014.9%2C9%20C%2014.499395%2C7.0357113%2012.964289%2C5.5006048%2011%2C5.1%20L%2011%2C5%20c%200%2C0%200%2C-1%20-1%2C-1%20z%20m%200%2C2.5%20c%201.932997%2C0%203.5%2C1.5670034%203.5%2C3.5%200%2C1.932997%20-1.567003%2C3.5%20-3.5%2C3.5%20C%208.0670034%2C13.5%206.5%2C11.932997%206.5%2C10%206.5%2C8.0670034%208.0670034%2C6.5%2010%2C6.5%20Z%27%20%2F%3E%0A%3C%2Fsvg%3E");
|
||||
}
|
||||
.mapboxgl-ctrl-icon.mapboxgl-ctrl-geolocate.mapboxgl-ctrl-geolocate-waiting {
|
||||
-webkit-animation: mapboxgl-spin 2s infinite linear;
|
||||
-moz-animation: mapboxgl-spin 2s infinite linear;
|
||||
-o-animation: mapboxgl-spin 2s infinite linear;
|
||||
-ms-animation: mapboxgl-spin 2s infinite linear;
|
||||
animation: mapboxgl-spin 2s infinite linear;
|
||||
}
|
||||
|
||||
@-webkit-keyframes mapboxgl-spin {
|
||||
0% { -webkit-transform: rotate(0deg); }
|
||||
100% { -webkit-transform: rotate(360deg); }
|
||||
}
|
||||
@-moz-keyframes mapboxgl-spin {
|
||||
0% { -moz-transform: rotate(0deg); }
|
||||
100% { -moz-transform: rotate(360deg); }
|
||||
}
|
||||
@-o-keyframes mapboxgl-spin {
|
||||
0% { -o-transform: rotate(0deg); }
|
||||
100% { -o-transform: rotate(360deg); }
|
||||
}
|
||||
@-ms-keyframes mapboxgl-spin {
|
||||
0% { -ms-transform: rotate(0deg); }
|
||||
100% { -ms-transform: rotate(360deg); }
|
||||
}
|
||||
@keyframes mapboxgl-spin {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
.mapboxgl-ctrl-icon.mapboxgl-ctrl-fullscreen {
|
||||
background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAxOS4wLjEsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4KCjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sbnM6c29kaXBvZGk9Imh0dHA6Ly9zb2RpcG9kaS5zb3VyY2Vmb3JnZS5uZXQvRFREL3NvZGlwb2RpLTAuZHRkIgogICB4bWxuczppbmtzY2FwZT0iaHR0cDovL3d3dy5pbmtzY2FwZS5vcmcvbmFtZXNwYWNlcy9pbmtzY2FwZSIKICAgdmVyc2lvbj0iMS4xIgogICBpZD0iTGF5ZXJfMSIKICAgeD0iMHB4IgogICB5PSIwcHgiCiAgIHZpZXdCb3g9IjAgMCAyMCAyMCIKICAgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMjAgMjA7IgogICB4bWw6c3BhY2U9InByZXNlcnZlIgogICBpbmtzY2FwZTp2ZXJzaW9uPSIwLjkxIHIxMzcyNSIKICAgc29kaXBvZGk6ZG9jbmFtZT0iZnVsbHNjcmVlbi5zdmciPjxtZXRhZGF0YQogICAgIGlkPSJtZXRhZGF0YTQxODUiPjxyZGY6UkRGPjxjYzpXb3JrCiAgICAgICAgIHJkZjphYm91dD0iIj48ZGM6Zm9ybWF0PmltYWdlL3N2Zyt4bWw8L2RjOmZvcm1hdD48ZGM6dHlwZQogICAgICAgICAgIHJkZjpyZXNvdXJjZT0iaHR0cDovL3B1cmwub3JnL2RjL2RjbWl0eXBlL1N0aWxsSW1hZ2UiIC8+PGRjOnRpdGxlPjwvZGM6dGl0bGU+PC9jYzpXb3JrPjwvcmRmOlJERj48L21ldGFkYXRhPjxkZWZzCiAgICAgaWQ9ImRlZnM0MTgzIiAvPjxzb2RpcG9kaTpuYW1lZHZpZXcKICAgICBwYWdlY29sb3I9IiNmZmZmZmYiCiAgICAgYm9yZGVyY29sb3I9IiM2NjY2NjYiCiAgICAgYm9yZGVyb3BhY2l0eT0iMSIKICAgICBvYmplY3R0b2xlcmFuY2U9IjEwIgogICAgIGdyaWR0b2xlcmFuY2U9IjEwIgogICAgIGd1aWRldG9sZXJhbmNlPSIxMCIKICAgICBpbmtzY2FwZTpwYWdlb3BhY2l0eT0iMCIKICAgICBpbmtzY2FwZTpwYWdlc2hhZG93PSIyIgogICAgIGlua3NjYXBlOndpbmRvdy13aWR0aD0iMTQ3MSIKICAgICBpbmtzY2FwZTp3aW5kb3ctaGVpZ2h0PSI2OTUiCiAgICAgaWQ9Im5hbWVkdmlldzQxODEiCiAgICAgc2hvd2dyaWQ9ImZhbHNlIgogICAgIGlua3NjYXBlOnpvb209IjExLjMxMzcwOCIKICAgICBpbmtzY2FwZTpjeD0iMTQuNjk4MjgiCiAgICAgaW5rc2NhcGU6Y3k9IjEwLjUyNjY4OSIKICAgICBpbmtzY2FwZTp3aW5kb3cteD0iNjk3IgogICAgIGlua3NjYXBlOndpbmRvdy15PSIyOTgiCiAgICAgaW5rc2NhcGU6d2luZG93LW1heGltaXplZD0iMCIKICAgICBpbmtzY2FwZTpjdXJyZW50LWxheWVyPSJMYXllcl8xIgogICAgIGlua3NjYXBlOnNuYXAtYmJveD0idHJ1ZSIKICAgICBpbmtzY2FwZTpiYm94LXBhdGhzPSJ0cnVlIgogICAgIGlua3NjYXBlOm9iamVjdC1wYXRocz0idHJ1ZSIKICAgICBpbmtzY2FwZTpiYm94LW5vZGVzPSJ0cnVlIgogICAgIGlua3NjYXBlOm9iamVjdC1ub2Rlcz0idHJ1ZSI+PGlua3NjYXBlOmdyaWQKICAgICAgIHR5cGU9Inh5Z3JpZCIKICAgICAgIGlkPSJncmlkNjA3NiIgLz48L3NvZGlwb2RpOm5hbWVkdmlldz48cGF0aAogICAgIGQ9Ik0gNSA0IEMgNC41IDQgNCA0LjUgNCA1IEwgNCA2IEwgNCA5IEwgNC41IDkgTCA1Ljc3NzM0MzggNy4yOTY4NzUgQyA2Ljc3NzEzMTkgOC4wNjAyMTMxIDcuODM1NzY1IDguOTU2NTcyOCA4Ljg5MDYyNSAxMCBDIDcuODI1NzEyMSAxMS4wNjMzIDYuNzc2MTc5MSAxMS45NTE2NzUgNS43ODEyNSAxMi43MDcwMzEgTCA0LjUgMTEgTCA0IDExIEwgNCAxNSBDIDQgMTUuNSA0LjUgMTYgNSAxNiBMIDkgMTYgTCA5IDE1LjUgTCA3LjI3MzQzNzUgMTQuMjA1MDc4IEMgOC4wNDI4OTMxIDEzLjE4Nzg4NiA4LjkzOTU0NDEgMTIuMTMzNDgxIDkuOTYwOTM3NSAxMS4wNjgzNTkgQyAxMS4wNDIzNzEgMTIuMTQ2OTkgMTEuOTQyMDkzIDEzLjIxMTIgMTIuNzA3MDMxIDE0LjIxODc1IEwgMTEgMTUuNSBMIDExIDE2IEwgMTQgMTYgTCAxNSAxNiBDIDE1LjUgMTYgMTYgMTUuNSAxNiAxNSBMIDE2IDE0IEwgMTYgMTEgTCAxNS41IDExIEwgMTQuMjA1MDc4IDEyLjcyNjU2MiBDIDEzLjE3Nzk4NSAxMS45NDk2MTcgMTIuMTEyNzE4IDExLjA0MzU3NyAxMS4wMzcxMDkgMTAuMDA5NzY2IEMgMTIuMTUxODU2IDguOTgxMDYxIDEzLjIyNDM0NSA4LjA3OTg2MjQgMTQuMjI4NTE2IDcuMzA0Njg3NSBMIDE1LjUgOSBMIDE2IDkgTCAxNiA1IEMgMTYgNC41IDE1LjUgNCAxNSA0IEwgMTEgNCBMIDExIDQuNSBMIDEyLjcwMzEyNSA1Ljc3NzM0MzggQyAxMS45MzI2NDcgNi43ODY0ODM0IDExLjAyNjY5MyA3Ljg1NTQ3MTIgOS45NzA3MDMxIDguOTE5OTIxOSBDIDguOTU4NDczOSA3LjgyMDQ5NDMgOC4wNjk4NzY3IDYuNzYyNzE4OCA3LjMwNDY4NzUgNS43NzE0ODQ0IEwgOSA0LjUgTCA5IDQgTCA2IDQgTCA1IDQgeiAiCiAgICAgaWQ9InBhdGg0MTY5IiAvPjwvc3ZnPg==");
|
||||
@@ -175,6 +223,7 @@ a.mapboxgl-ctrl-logo {
|
||||
border-color: #333;
|
||||
padding: 0 5px;
|
||||
color: #333;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.mapboxgl-popup {
|
||||
@@ -304,6 +353,65 @@ a.mapboxgl-ctrl-logo {
|
||||
will-change: transform;
|
||||
}
|
||||
|
||||
.mapboxgl-user-location-dot {
|
||||
background-color: #1DA1F2;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border-radius: 50%;
|
||||
box-shadow: 0 0 2px rgba(0,0,0,0.25);
|
||||
border: 2px solid #fff;
|
||||
}
|
||||
.mapboxgl-user-location-dot:after {
|
||||
content: '';
|
||||
display: block;
|
||||
box-shadow: #1DA1F2 0 0 0 2px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
z-index: -1;
|
||||
|
||||
-webkit-animation: mapboxgl-user-location-dot-pulse 2s;
|
||||
-moz-animation: mapboxgl-user-location-dot-pulse 2s;
|
||||
-ms-animation: mapboxgl-user-location-dot-pulse 2s;
|
||||
animation: mapboxgl-user-location-dot-pulse 2s;
|
||||
|
||||
-webkit-animation-iteration-count: infinite;
|
||||
-moz-animation-iteration-count: infinite;
|
||||
-ms-animation-iteration-count: infinite;
|
||||
animation-iteration-count: infinite;
|
||||
}
|
||||
@-webkit-keyframes mapboxgl-user-location-dot-pulse {
|
||||
0% { -webkit-box-shadow: 0 0 0 0 rgba(29, 161, 242, 0.8); }
|
||||
70% { -webkit-box-shadow: 0 0 0 15px rgba(29, 161, 242, 0); }
|
||||
242% { -webkit-box-shadow: 0 0 0 0 rgba(29, 161, 242, 0); }
|
||||
}
|
||||
@-ms-keyframes mapboxgl-user-location-dot-pulse {
|
||||
0% { -ms-box-shadow: 0 0 0 0 rgba(29, 161, 242, 0.8); }
|
||||
70% { -ms-box-shadow: 0 0 0 15px rgba(29, 161, 242, 0); }
|
||||
242% { -ms-box-shadow: 0 0 0 0 rgba(29, 161, 242, 0); }
|
||||
}
|
||||
@keyframes mapboxgl-user-location-dot-pulse {
|
||||
0% {
|
||||
-moz-box-shadow: 0 0 0 0 rgba(29, 161, 242, 0.8);
|
||||
box-shadow: 0 0 0 0 rgba(29, 161, 242, 0.4);
|
||||
}
|
||||
70% {
|
||||
-moz-box-shadow: 0 0 0 15px rgba(29, 161, 242, 0);
|
||||
box-shadow: 0 0 0 15px rgba(29, 161, 242, 0);
|
||||
}
|
||||
100% {
|
||||
-moz-box-shadow: 0 0 0 0 rgba(29, 161, 242, 0);
|
||||
box-shadow: 0 0 0 0 rgba(29, 161, 242, 0);
|
||||
}
|
||||
}
|
||||
.mapboxgl-user-location-dot-stale {
|
||||
background-color: #aaa;
|
||||
}
|
||||
.mapboxgl-user-location-dot-stale:after {
|
||||
display: none
|
||||
}
|
||||
|
||||
.mapboxgl-crosshair,
|
||||
.mapboxgl-crosshair .mapboxgl-interactive,
|
||||
.mapboxgl-crosshair .mapboxgl-interactive:active {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -40,8 +40,8 @@
|
||||
{{#if serving_rendered}}
|
||||
{{#if serving_data}}| {{/if}}<a href="/styles/{{@key}}.json{{&../key_query}}">TileJSON</a>
|
||||
{{/if}}
|
||||
{{#if wmts_link}}
|
||||
| <a href="{{&wmts_link}}">WMTS</a>
|
||||
{{#if serving_rendered}}
|
||||
| <a href="/styles/{{@key}}/wmts.xml{{&../key_query}}">WMTS</a>
|
||||
{{/if}}
|
||||
{{#if xyz_link}}
|
||||
| <a href="#" onclick="return toggle_xyz('xyz_style_{{@key}}');">XYZ</a>
|
||||
@@ -110,4 +110,4 @@
|
||||
</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
407
public/templates/wmts.tmpl
Normal file
407
public/templates/wmts.tmpl
Normal file
@@ -0,0 +1,407 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<Capabilities xmlns="http://www.opengis.net/wmts/1.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd" version="1.0.0">
|
||||
<!-- Service Identification -->
|
||||
<ows:ServiceIdentification>
|
||||
<ows:Title>TileServer GL</ows:Title>
|
||||
<ows:ServiceType>OGC WMTS</ows:ServiceType>
|
||||
<ows:ServiceTypeVersion>1.0.0</ows:ServiceTypeVersion>
|
||||
</ows:ServiceIdentification>
|
||||
<!-- Operations Metadata -->
|
||||
<ows:OperationsMetadata>
|
||||
<ows:Operation name="GetCapabilities">
|
||||
<ows:DCP>
|
||||
<ows:HTTP>
|
||||
<ows:Get xlink:href="{{baseUrl}}/wmts/{{id}}/">
|
||||
<ows:Constraint name="GetEncoding">
|
||||
<ows:AllowedValues>
|
||||
<ows:Value>RESTful</ows:Value>
|
||||
</ows:AllowedValues>
|
||||
</ows:Constraint>
|
||||
</ows:Get>
|
||||
</ows:HTTP>
|
||||
</ows:DCP>
|
||||
</ows:Operation>
|
||||
<ows:Operation name="GetTile">
|
||||
<ows:DCP>
|
||||
<ows:HTTP>
|
||||
<ows:Get xlink:href="{{baseUrl}}/styles/">
|
||||
<ows:Constraint name="GetEncoding">
|
||||
<ows:AllowedValues>
|
||||
<ows:Value>RESTful</ows:Value>
|
||||
</ows:AllowedValues>
|
||||
</ows:Constraint>
|
||||
</ows:Get>
|
||||
</ows:HTTP>
|
||||
</ows:DCP>
|
||||
</ows:Operation>
|
||||
</ows:OperationsMetadata>
|
||||
<Contents>
|
||||
<Layer>
|
||||
<ows:Title>{{name}}</ows:Title>
|
||||
<ows:Identifier>{{id}}</ows:Identifier>
|
||||
<ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">
|
||||
<ows:LowerCorner>-180 -85.051128779807</ows:LowerCorner>
|
||||
<ows:UpperCorner>180 85.051128779807</ows:UpperCorner>
|
||||
</ows:WGS84BoundingBox>
|
||||
<Style isDefault="true">
|
||||
<ows:Identifier>default</ows:Identifier>
|
||||
</Style>
|
||||
<Format>image/png</Format>
|
||||
<TileMatrixSetLink>
|
||||
<TileMatrixSet>GoogleMapsCompatible</TileMatrixSet>
|
||||
</TileMatrixSetLink>
|
||||
<ResourceURL format="image/png" resourceType="tile" template="{{baseUrl}}/styles/{{id}}/{TileMatrix}/{TileCol}/{TileRow}.png{{key_query}}"/>
|
||||
</Layer><TileMatrixSet>
|
||||
<ows:Title>GoogleMapsCompatible</ows:Title>
|
||||
<ows:Abstract>GoogleMapsCompatible EPSG:3857</ows:Abstract>
|
||||
<ows:Identifier>GoogleMapsCompatible</ows:Identifier>
|
||||
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::3857</ows:SupportedCRS>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>0</ows:Identifier>
|
||||
<ScaleDenominator>559082264.02872</ScaleDenominator>
|
||||
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>1</MatrixWidth>
|
||||
<MatrixHeight>1</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>1</ows:Identifier>
|
||||
<ScaleDenominator>279541132.01436</ScaleDenominator>
|
||||
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>2</MatrixWidth>
|
||||
<MatrixHeight>2</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>2</ows:Identifier>
|
||||
<ScaleDenominator>139770566.00718</ScaleDenominator>
|
||||
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>4</MatrixWidth>
|
||||
<MatrixHeight>4</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>3</ows:Identifier>
|
||||
<ScaleDenominator>69885283.00359</ScaleDenominator>
|
||||
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>8</MatrixWidth>
|
||||
<MatrixHeight>8</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>4</ows:Identifier>
|
||||
<ScaleDenominator>34942641.501795</ScaleDenominator>
|
||||
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>16</MatrixWidth>
|
||||
<MatrixHeight>16</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>5</ows:Identifier>
|
||||
<ScaleDenominator>17471320.750897</ScaleDenominator>
|
||||
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>32</MatrixWidth>
|
||||
<MatrixHeight>32</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>6</ows:Identifier>
|
||||
<ScaleDenominator>8735660.3754487</ScaleDenominator>
|
||||
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>64</MatrixWidth>
|
||||
<MatrixHeight>64</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>7</ows:Identifier>
|
||||
<ScaleDenominator>4367830.1877244</ScaleDenominator>
|
||||
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>128</MatrixWidth>
|
||||
<MatrixHeight>128</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>8</ows:Identifier>
|
||||
<ScaleDenominator>2183915.0938622</ScaleDenominator>
|
||||
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>256</MatrixWidth>
|
||||
<MatrixHeight>256</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>9</ows:Identifier>
|
||||
<ScaleDenominator>1091957.5469311</ScaleDenominator>
|
||||
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>512</MatrixWidth>
|
||||
<MatrixHeight>512</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>10</ows:Identifier>
|
||||
<ScaleDenominator>545978.77346554</ScaleDenominator>
|
||||
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>1024</MatrixWidth>
|
||||
<MatrixHeight>1024</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>11</ows:Identifier>
|
||||
<ScaleDenominator>272989.38673277</ScaleDenominator>
|
||||
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>2048</MatrixWidth>
|
||||
<MatrixHeight>2048</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>12</ows:Identifier>
|
||||
<ScaleDenominator>136494.69336639</ScaleDenominator>
|
||||
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>4096</MatrixWidth>
|
||||
<MatrixHeight>4096</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>13</ows:Identifier>
|
||||
<ScaleDenominator>68247.346683193</ScaleDenominator>
|
||||
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>8192</MatrixWidth>
|
||||
<MatrixHeight>8192</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>14</ows:Identifier>
|
||||
<ScaleDenominator>34123.673341597</ScaleDenominator>
|
||||
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>16384</MatrixWidth>
|
||||
<MatrixHeight>16384</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>15</ows:Identifier>
|
||||
<ScaleDenominator>17061.836670798</ScaleDenominator>
|
||||
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>32768</MatrixWidth>
|
||||
<MatrixHeight>32768</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>16</ows:Identifier>
|
||||
<ScaleDenominator>8530.9183353991</ScaleDenominator>
|
||||
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>65536</MatrixWidth>
|
||||
<MatrixHeight>65536</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>17</ows:Identifier>
|
||||
<ScaleDenominator>4265.4591676996</ScaleDenominator>
|
||||
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>131072</MatrixWidth>
|
||||
<MatrixHeight>131072</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>18</ows:Identifier>
|
||||
<ScaleDenominator>2132.7295838498</ScaleDenominator>
|
||||
<TopLeftCorner>-20037508.34 20037508.34</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>262144</MatrixWidth>
|
||||
<MatrixHeight>262144</MatrixHeight>
|
||||
</TileMatrix></TileMatrixSet><TileMatrixSet>
|
||||
<ows:Title>WGS84</ows:Title>
|
||||
<ows:Abstract>WGS84 EPSG:4326</ows:Abstract>
|
||||
<ows:Identifier>WGS84</ows:Identifier>
|
||||
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::4326</ows:SupportedCRS>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>0</ows:Identifier>
|
||||
<ScaleDenominator>279541132.01436</ScaleDenominator>
|
||||
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>2</MatrixWidth>
|
||||
<MatrixHeight>1</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>1</ows:Identifier>
|
||||
<ScaleDenominator>139770566.00718</ScaleDenominator>
|
||||
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>4</MatrixWidth>
|
||||
<MatrixHeight>2</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>2</ows:Identifier>
|
||||
<ScaleDenominator>69885283.00359</ScaleDenominator>
|
||||
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>8</MatrixWidth>
|
||||
<MatrixHeight>4</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>3</ows:Identifier>
|
||||
<ScaleDenominator>34942641.501795</ScaleDenominator>
|
||||
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>16</MatrixWidth>
|
||||
<MatrixHeight>8</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>4</ows:Identifier>
|
||||
<ScaleDenominator>17471320.750897</ScaleDenominator>
|
||||
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>32</MatrixWidth>
|
||||
<MatrixHeight>16</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>5</ows:Identifier>
|
||||
<ScaleDenominator>8735660.3754487</ScaleDenominator>
|
||||
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>64</MatrixWidth>
|
||||
<MatrixHeight>32</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>6</ows:Identifier>
|
||||
<ScaleDenominator>4367830.1877244</ScaleDenominator>
|
||||
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>128</MatrixWidth>
|
||||
<MatrixHeight>64</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>7</ows:Identifier>
|
||||
<ScaleDenominator>2183915.0938622</ScaleDenominator>
|
||||
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>256</MatrixWidth>
|
||||
<MatrixHeight>128</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>8</ows:Identifier>
|
||||
<ScaleDenominator>1091957.5469311</ScaleDenominator>
|
||||
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>512</MatrixWidth>
|
||||
<MatrixHeight>256</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>9</ows:Identifier>
|
||||
<ScaleDenominator>545978.77346554</ScaleDenominator>
|
||||
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>1024</MatrixWidth>
|
||||
<MatrixHeight>512</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>10</ows:Identifier>
|
||||
<ScaleDenominator>272989.38673277</ScaleDenominator>
|
||||
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>2048</MatrixWidth>
|
||||
<MatrixHeight>1024</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>11</ows:Identifier>
|
||||
<ScaleDenominator>136494.69336639</ScaleDenominator>
|
||||
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>4096</MatrixWidth>
|
||||
<MatrixHeight>2048</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>12</ows:Identifier>
|
||||
<ScaleDenominator>68247.346683193</ScaleDenominator>
|
||||
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>8192</MatrixWidth>
|
||||
<MatrixHeight>4096</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>13</ows:Identifier>
|
||||
<ScaleDenominator>34123.673341597</ScaleDenominator>
|
||||
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>16384</MatrixWidth>
|
||||
<MatrixHeight>8192</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>14</ows:Identifier>
|
||||
<ScaleDenominator>17061.836670798</ScaleDenominator>
|
||||
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>32768</MatrixWidth>
|
||||
<MatrixHeight>16384</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>15</ows:Identifier>
|
||||
<ScaleDenominator>8530.9183353991</ScaleDenominator>
|
||||
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>65536</MatrixWidth>
|
||||
<MatrixHeight>32768</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>16</ows:Identifier>
|
||||
<ScaleDenominator>4265.4591676996</ScaleDenominator>
|
||||
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>131072</MatrixWidth>
|
||||
<MatrixHeight>65536</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>17</ows:Identifier>
|
||||
<ScaleDenominator>2132.7295838498</ScaleDenominator>
|
||||
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>262144</MatrixWidth>
|
||||
<MatrixHeight>131072</MatrixHeight>
|
||||
</TileMatrix>
|
||||
<TileMatrix>
|
||||
<ows:Identifier>18</ows:Identifier>
|
||||
<ScaleDenominator></ScaleDenominator>
|
||||
<TopLeftCorner>90 -180</TopLeftCorner>
|
||||
<TileWidth>256</TileWidth>
|
||||
<TileHeight>256</TileHeight>
|
||||
<MatrixWidth>524288</MatrixWidth>
|
||||
<MatrixHeight>262144</MatrixHeight>
|
||||
</TileMatrix></TileMatrixSet>
|
||||
</Contents>
|
||||
<ServiceMetadataURL xlink:href="{{baseUrl}}/wmts/{{id}}/"/>
|
||||
</Capabilities>
|
||||
@@ -23,7 +23,6 @@ packageJson.name += '-light';
|
||||
packageJson.description = 'Map tile server for JSON GL styles - serving vector tiles';
|
||||
delete packageJson.dependencies['canvas'];
|
||||
delete packageJson.dependencies['@mapbox/mapbox-gl-native'];
|
||||
delete packageJson.dependencies['node-pngquant-native'];
|
||||
delete packageJson.dependencies['sharp'];
|
||||
|
||||
delete packageJson.optionalDependencies;
|
||||
|
||||
21
run.sh
21
run.sh
@@ -1,8 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
_term() {
|
||||
echo "Caught signal, stopping gracefully"
|
||||
kill -TERM "$child" 2>/dev/null
|
||||
}
|
||||
|
||||
trap _term TERM
|
||||
|
||||
# Delete files if they were not cleaned by last run
|
||||
rm -rf /tmp/.X11-unix /tmp/.X99-lock
|
||||
|
||||
start-stop-daemon --start --pidfile ~/xvfb.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset
|
||||
sleep 1
|
||||
echo "Waiting 3 seconds for xvfb to start..."
|
||||
sleep 3
|
||||
|
||||
export DISPLAY=:99.0
|
||||
|
||||
cd /data
|
||||
node /usr/src/app/ -p 80 "$@"
|
||||
node /usr/src/app/ -p 80 "$@" &
|
||||
child=$!
|
||||
wait "$child"
|
||||
|
||||
start-stop-daemon --stop --retry 5 --pidfile ~/xvfb.pid # stop xvfb when exiting
|
||||
rm ~/xvfb.pid
|
||||
|
||||
86
src/main.js
86
src/main.js
@@ -10,46 +10,51 @@ var mbtiles = require('@mapbox/mbtiles');
|
||||
|
||||
var packageJson = require('../package');
|
||||
|
||||
var opts = require('nomnom')
|
||||
.option('mbtiles', {
|
||||
default: undefined,
|
||||
help: 'MBTiles file (uses demo configuration);\n' +
|
||||
'\t ignored if the configuration file is also specified',
|
||||
position: 0
|
||||
})
|
||||
.option('config', {
|
||||
abbr: 'c',
|
||||
default: 'config.json',
|
||||
help: 'Configuration file'
|
||||
})
|
||||
.option('bind', {
|
||||
abbr: 'b',
|
||||
default: undefined,
|
||||
help: 'Bind address'
|
||||
})
|
||||
.option('port', {
|
||||
abbr: 'p',
|
||||
default: 8080,
|
||||
help: 'Port'
|
||||
})
|
||||
.option('cors', {
|
||||
default: true,
|
||||
help: 'Enable Cross-origin resource sharing headers'
|
||||
})
|
||||
.option('verbose', {
|
||||
abbr: 'V',
|
||||
flag: true,
|
||||
help: 'More verbose output'
|
||||
})
|
||||
.option('version', {
|
||||
abbr: 'v',
|
||||
flag: true,
|
||||
help: 'Version info',
|
||||
callback: function() {
|
||||
return packageJson.name + ' v' + packageJson.version;
|
||||
}
|
||||
}).parse();
|
||||
var args = process.argv;
|
||||
if (args.length >= 3 && args[2][0] != '-') {
|
||||
args.splice(2, 0, '--mbtiles');
|
||||
}
|
||||
|
||||
var opts = require('commander')
|
||||
.description('tileserver-gl startup options')
|
||||
.usage('tileserver-gl [mbtiles] [options]')
|
||||
.option(
|
||||
'--mbtiles <file>',
|
||||
'MBTiles file (uses demo configuration);\n' +
|
||||
'\t ignored if the configuration file is also specified'
|
||||
)
|
||||
.option(
|
||||
'-c, --config <file>',
|
||||
'Configuration file [config.json]',
|
||||
'config.json'
|
||||
)
|
||||
.option(
|
||||
'-b, --bind <address>',
|
||||
'Bind address'
|
||||
)
|
||||
.option(
|
||||
'-p, --port <port>',
|
||||
'Port [8080]',
|
||||
8080,
|
||||
parseInt
|
||||
)
|
||||
.option(
|
||||
'-C|--no-cors',
|
||||
'Disable Cross-origin resource sharing headers'
|
||||
)
|
||||
.option(
|
||||
'-V, --verbose',
|
||||
'More verbose output'
|
||||
)
|
||||
.option(
|
||||
'-s, --silent',
|
||||
'Less verbose output'
|
||||
)
|
||||
.version(
|
||||
packageJson.version,
|
||||
'-v, --version'
|
||||
)
|
||||
.parse(args);
|
||||
|
||||
console.log('Starting ' + packageJson.name + ' v' + packageJson.version);
|
||||
|
||||
@@ -59,7 +64,8 @@ var startServer = function(configPath, config) {
|
||||
config: config,
|
||||
bind: opts.bind,
|
||||
port: opts.port,
|
||||
cors: opts.cors
|
||||
cors: opts.cors,
|
||||
silent: opts.silent
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -37,7 +37,15 @@ module.exports = function(options, repo, params, id, styles) {
|
||||
var source;
|
||||
var sourceInfoPromise = new Promise(function(resolve, reject) {
|
||||
source = new mbtiles(mbtilesFile, function(err) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
source.getInfo(function(err, info) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
tileJSON['name'] = id;
|
||||
tileJSON['format'] = 'pbf';
|
||||
|
||||
@@ -81,7 +89,7 @@ module.exports = function(options, repo, params, id, styles) {
|
||||
source.getTile(z, x, y, function(err, data, headers) {
|
||||
if (err) {
|
||||
if (/does not exist/.test(err.message)) {
|
||||
return res.status(404).send(err.message);
|
||||
return res.status(204).send(err.message);
|
||||
} else {
|
||||
return res.status(500).send(err.message);
|
||||
}
|
||||
@@ -176,9 +184,7 @@ module.exports = function(options, repo, params, id, styles) {
|
||||
return res.send(info);
|
||||
});
|
||||
|
||||
return new Promise(function(resolve, reject) {
|
||||
sourceInfoPromise.then(function() {
|
||||
resolve(app);
|
||||
});
|
||||
return sourceInfoPromise.then(function() {
|
||||
return app;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -17,13 +17,19 @@ module.exports = function(options, allowedFonts) {
|
||||
var existingFonts = {};
|
||||
var fontListingPromise = new Promise(function(resolve, reject) {
|
||||
fs.readdir(options.paths.fonts, function(err, files) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
files.forEach(function(file) {
|
||||
fs.stat(path.join(fontPath, file), function(err, stats) {
|
||||
if (!err) {
|
||||
if (stats.isDirectory() &&
|
||||
fs.existsSync(path.join(fontPath, file, '0-255.pbf'))) {
|
||||
existingFonts[path.basename(file)] = true;
|
||||
}
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
if (stats.isDirectory() &&
|
||||
fs.existsSync(path.join(fontPath, file, '0-255.pbf'))) {
|
||||
existingFonts[path.basename(file)] = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -54,9 +60,7 @@ module.exports = function(options, allowedFonts) {
|
||||
);
|
||||
});
|
||||
|
||||
return new Promise(function(resolve, reject) {
|
||||
fontListingPromise.then(function() {
|
||||
resolve(app);
|
||||
});
|
||||
return fontListingPromise.then(function() {
|
||||
return app;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -18,7 +18,6 @@ var Canvas = require('canvas'),
|
||||
mercator = new (require('@mapbox/sphericalmercator'))(),
|
||||
mbgl = require('@mapbox/mapbox-gl-native'),
|
||||
mbtiles = require('@mapbox/mbtiles'),
|
||||
pngquant = require('node-pngquant-native'),
|
||||
proj4 = require('proj4'),
|
||||
request = require('request');
|
||||
|
||||
@@ -123,12 +122,18 @@ module.exports = function(options, repo, params, id, dataResolver) {
|
||||
var existingFonts = {};
|
||||
var fontListingPromise = new Promise(function(resolve, reject) {
|
||||
fs.readdir(options.paths.fonts, function(err, files) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
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;
|
||||
}
|
||||
if (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
if (stats.isDirectory()) {
|
||||
existingFonts[path.basename(file)] = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -165,6 +170,7 @@ module.exports = function(options, repo, params, id, dataResolver) {
|
||||
var parts = req.url.split('/');
|
||||
var sourceId = parts[2];
|
||||
var source = map.sources[sourceId];
|
||||
var sourceInfo = styleJSON.sources[sourceId];
|
||||
var z = parts[3] | 0,
|
||||
x = parts[4] | 0,
|
||||
y = parts[5].split('.')[0] | 0,
|
||||
@@ -172,7 +178,7 @@ module.exports = function(options, repo, params, id, dataResolver) {
|
||||
source.getTile(z, x, y, function(err, data, headers) {
|
||||
if (err) {
|
||||
//console.log('MBTiles error, serving empty', err);
|
||||
createEmptyResponse(source.format, source.color, callback);
|
||||
createEmptyResponse(sourceInfo.format, sourceInfo.color, callback);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -182,7 +188,12 @@ module.exports = function(options, repo, params, id, dataResolver) {
|
||||
}
|
||||
|
||||
if (format == 'pbf') {
|
||||
response.data = zlib.unzipSync(data);
|
||||
try {
|
||||
response.data = zlib.unzipSync(data);
|
||||
}
|
||||
catch (err) {
|
||||
console.log("Skipping incorrect header for tile mbtiles://%s/%s/%s/%s.pbf", id, z, x, y);
|
||||
}
|
||||
if (options.dataDecoratorFunc) {
|
||||
response.data = options.dataDecoratorFunc(
|
||||
sourceId, 'data', response.data, z, x, y);
|
||||
@@ -345,18 +356,15 @@ module.exports = function(options, repo, params, id, dataResolver) {
|
||||
});
|
||||
|
||||
var renderersReadyPromise = Promise.all(queue).then(function() {
|
||||
// TODO: make pool sizes configurable
|
||||
// standard and @2x tiles are much more usual -> default to larger pools
|
||||
var minPoolSizes = options.minRendererPoolSizes || [8, 4, 2];
|
||||
var maxPoolSizes = options.maxRendererPoolSizes || [16, 8, 4];
|
||||
for (var s = 1; s <= maxScaleFactor; s++) {
|
||||
var minPoolSize = 2;
|
||||
|
||||
// standard and @2x tiles are much more usual -> create larger pools
|
||||
if (s <= 2) {
|
||||
minPoolSize *= 2;
|
||||
if (s <= 1) {
|
||||
minPoolSize *= 2;
|
||||
}
|
||||
}
|
||||
map.renderers[s] = createPool(s, minPoolSize, 2 * minPoolSize);
|
||||
var i = Math.min(minPoolSizes.length - 1, s - 1);
|
||||
var j = Math.min(maxPoolSizes.length - 1, s - 1);
|
||||
var minPoolSize = minPoolSizes[i];
|
||||
var maxPoolSize = Math.max(minPoolSize, maxPoolSizes[j]);
|
||||
map.renderers[s] = createPool(s, minPoolSize, maxPoolSize);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -451,16 +459,6 @@ module.exports = function(options, repo, params, id, dataResolver) {
|
||||
return res.status(404).send('Not found');
|
||||
}
|
||||
|
||||
if (format == 'png') {
|
||||
var usePngQuant =
|
||||
(options.formatQuality || {}).pngQuantization === true;
|
||||
if (usePngQuant) {
|
||||
buffer = pngquant.compress(buffer, {
|
||||
quality: [0, formatQuality || 90]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
res.set({
|
||||
'Last-Modified': lastModified,
|
||||
'Content-Type': 'image/' + format
|
||||
@@ -753,9 +751,8 @@ module.exports = function(options, repo, params, id, dataResolver) {
|
||||
return res.send(info);
|
||||
});
|
||||
|
||||
return new Promise(function(resolve, reject) {
|
||||
Promise.all([fontListingPromise, renderersReadyPromise]).then(function() {
|
||||
resolve(app);
|
||||
});
|
||||
return Promise.all([fontListingPromise, renderersReadyPromise]).then(function() {
|
||||
return app;
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
@@ -7,8 +7,7 @@ process.env.UV_THREADPOOL_SIZE =
|
||||
var fs = require('fs'),
|
||||
path = require('path');
|
||||
|
||||
var base64url = require('base64url'),
|
||||
clone = require('clone'),
|
||||
var clone = require('clone'),
|
||||
cors = require('cors'),
|
||||
enableShutdown = require('http-shutdown'),
|
||||
express = require('express'),
|
||||
@@ -43,9 +42,13 @@ function start(opts) {
|
||||
app.enable('trust proxy');
|
||||
|
||||
if (process.env.NODE_ENV == 'production') {
|
||||
app.use(morgan('tiny'));
|
||||
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'));
|
||||
app.use(morgan('dev', {
|
||||
skip: function(req, res) { return opts.silent && (res.statusCode == 200 || res.statusCode == 304) }
|
||||
}));
|
||||
}
|
||||
|
||||
var config = opts.config || null;
|
||||
@@ -246,8 +249,9 @@ function start(opts) {
|
||||
startupPromises.push(new Promise(function(resolve, reject) {
|
||||
fs.readFile(templateFile, function(err, content) {
|
||||
if (err) {
|
||||
console.error('Template not found:', err);
|
||||
err = new Error('Template not found: ' + err.message);
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
var compiled = handlebars.compile(content.toString());
|
||||
|
||||
@@ -264,6 +268,7 @@ function start(opts) {
|
||||
data['key_query_part'] =
|
||||
req.query.key ? 'key=' + req.query.key + '&' : '';
|
||||
data['key_query'] = req.query.key ? '?key=' + req.query.key : '';
|
||||
if (template === 'wmts') res.set('Content-Type', 'text/xml');
|
||||
return res.status(200).send(compiled(data));
|
||||
});
|
||||
resolve();
|
||||
@@ -290,12 +295,7 @@ function start(opts) {
|
||||
Math.floor(centerPx[0] / 256) + '/' +
|
||||
Math.floor(centerPx[1] / 256) + '.png';
|
||||
}
|
||||
|
||||
var query = req.query.key ? ('?key=' + req.query.key) : '';
|
||||
style.wmts_link = 'http://wmts.maptiler.com/' +
|
||||
base64url('http://' + req.headers.host +
|
||||
'/styles/' + id + '.json' + query) + '/wmts';
|
||||
|
||||
|
||||
var tiles = utils.getTileUrls(
|
||||
req, style.serving_rendered.tiles,
|
||||
'styles/' + id, style.serving_rendered.format);
|
||||
@@ -320,11 +320,6 @@ function start(opts) {
|
||||
Math.floor(centerPx[1] / 256) + '.' + data_.format;
|
||||
}
|
||||
|
||||
var query = req.query.key ? ('?key=' + req.query.key) : '';
|
||||
data_.wmts_link = 'http://wmts.maptiler.com/' +
|
||||
base64url('http://' + req.headers.host +
|
||||
'/data/' + id + '.json' + query) + '/wmts';
|
||||
|
||||
var tiles = utils.getTileUrls(
|
||||
req, data_.tiles, 'data/' + id, data_.format, {
|
||||
'pbf': options.pbfAlias
|
||||
@@ -369,6 +364,20 @@ function start(opts) {
|
||||
return res.redirect(301, '/styles/' + req.params.id + '/');
|
||||
});
|
||||
*/
|
||||
serveTemplate('/styles/:id/wmts.xml', 'wmts', function(req) {
|
||||
var id = req.params.id;
|
||||
var wmts = clone((config.styles || {})[id]);
|
||||
if (!wmts) {
|
||||
return null;
|
||||
}
|
||||
if (wmts.hasOwnProperty("serve_rendered") && !wmts.serve_rendered) {
|
||||
return null;
|
||||
}
|
||||
wmts.id = id;
|
||||
wmts.name = (serving.styles[id] || serving.rendered[id]).name;
|
||||
wmts.baseUrl = (req.get('X-Forwarded-Protocol')?req.get('X-Forwarded-Protocol'):req.protocol) + '://' + req.get('host');
|
||||
return wmts;
|
||||
});
|
||||
|
||||
serveTemplate('/data/:id/$', 'data', function(req) {
|
||||
var id = req.params.id;
|
||||
@@ -415,6 +424,11 @@ function start(opts) {
|
||||
module.exports = function(opts) {
|
||||
var running = start(opts);
|
||||
|
||||
running.startupPromise.catch(function(err) {
|
||||
console.error(err.message);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
process.on('SIGINT', function() {
|
||||
process.exit();
|
||||
});
|
||||
|
||||
21
src/utils.js
21
src/utils.js
@@ -84,7 +84,20 @@ var getFontPbf = function(allowedFonts, fontPath, name, range, fallbacks) {
|
||||
if (err) {
|
||||
console.error('ERROR: Font not found:', name);
|
||||
if (fallbacks && Object.keys(fallbacks).length) {
|
||||
var fallbackName = Object.keys(fallbacks)[0];
|
||||
var fallbackName;
|
||||
|
||||
var fontStyle = name.split(' ').pop();
|
||||
if (['Regular', 'Bold', 'Italic'].indexOf(fontStyle) < 0) {
|
||||
fontStyle = 'Regular';
|
||||
}
|
||||
fallbackName = 'Noto Sans ' + fontStyle;
|
||||
if (!fallbacks[fallbackName]) {
|
||||
fallbackName = 'Open Sans ' + fontStyle;
|
||||
if (!fallbacks[fallbackName]) {
|
||||
fallbackName = Object.keys(fallbacks)[0];
|
||||
}
|
||||
}
|
||||
|
||||
console.error('ERROR: Trying to use', fallbackName, 'as a fallback');
|
||||
delete fallbacks[fallbackName];
|
||||
getFontPbf(null, fontPath, fallbackName, range, fallbacks).then(resolve, reject);
|
||||
@@ -110,9 +123,7 @@ module.exports.getFontsPbf = function(allowedFonts, fontPath, names, range, fall
|
||||
);
|
||||
});
|
||||
|
||||
return new Promise(function(resolve, reject) {
|
||||
Promise.all(queue).then(function(values) {
|
||||
return resolve(glyphCompose.combine(values));
|
||||
}, reject);
|
||||
return Promise.all(queue).then(function(values) {
|
||||
return glyphCompose.combine(values);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -17,5 +17,5 @@ before(function() {
|
||||
|
||||
after(function() {
|
||||
console.log('global teardown');
|
||||
global.server.close(function() { console.log('Done'); });
|
||||
global.server.close(function() { console.log('Done'); process.exit(); });
|
||||
});
|
||||
|
||||
@@ -23,6 +23,6 @@ describe('Vector tiles', function() {
|
||||
testTile(prefix, 0, 1, 0, 404);
|
||||
testTile(prefix, 0, 0, 1, 404);
|
||||
|
||||
testTile(prefix, 14, 0, 0, 404); // non existent tile
|
||||
testTile(prefix, 14, 0, 0, 204); // non existent tile
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user