(master) Updated repo with latest master from klokantech/tileserver-gl.
This commit is contained in:
parent
8e66736955
commit
d782b1a538
20 changed files with 620 additions and 121 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
FROM node:6-stretch
|
FROM node:6.15.1-stretch
|
||||||
MAINTAINER Petr Sloup <petr.sloup@klokantech.com>
|
MAINTAINER Petr Sloup <petr.sloup@klokantech.com>
|
||||||
|
|
||||||
ENV NODE_ENV="production"
|
ENV NODE_ENV="production"
|
||||||
|
|
@ -21,6 +21,7 @@ RUN apt-get -qq update \
|
||||||
libprotobuf-dev \
|
libprotobuf-dev \
|
||||||
libxxf86vm-dev \
|
libxxf86vm-dev \
|
||||||
xvfb \
|
xvfb \
|
||||||
|
x11-utils \
|
||||||
&& apt-get clean
|
&& apt-get clean
|
||||||
|
|
||||||
RUN mkdir -p /usr/src/app
|
RUN mkdir -p /usr/src/app
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
FROM node:6
|
FROM node:6.15.1-stretch
|
||||||
MAINTAINER Petr Sloup <petr.sloup@klokantech.com>
|
MAINTAINER Petr Sloup <petr.sloup@klokantech.com>
|
||||||
|
|
||||||
ENV NODE_ENV="production"
|
ENV NODE_ENV="production"
|
||||||
|
|
|
||||||
35
Dockerfile_test
Normal file
35
Dockerfile_test
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
# Run tests inside docker without requiring full installation of dependencies on local machine
|
||||||
|
# Simply run "docker build -f Dockerfile_test ."
|
||||||
|
# WARNING: sometimes it fails with a core dumped exception
|
||||||
|
|
||||||
|
FROM node:6-stretch
|
||||||
|
MAINTAINER Petr Sloup <petr.sloup@klokantech.com>
|
||||||
|
|
||||||
|
RUN apt-get -qq update \
|
||||||
|
&& DEBIAN_FRONTEND=noninteractive apt-get -y install \
|
||||||
|
apt-transport-https \
|
||||||
|
curl \
|
||||||
|
unzip \
|
||||||
|
build-essential \
|
||||||
|
python \
|
||||||
|
libcairo2-dev \
|
||||||
|
libgles2-mesa-dev \
|
||||||
|
libgbm-dev \
|
||||||
|
libllvm3.9 \
|
||||||
|
libprotobuf-dev \
|
||||||
|
libxxf86vm-dev \
|
||||||
|
xvfb \
|
||||||
|
&& apt-get clean
|
||||||
|
|
||||||
|
RUN mkdir -p /usr/src/app
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
RUN wget -O test_data.zip https://github.com/klokantech/tileserver-gl/releases/download/v1.3.0/test_data.zip
|
||||||
|
RUN unzip -q test_data.zip -d test_data
|
||||||
|
|
||||||
|
ENV NODE_ENV="test"
|
||||||
|
|
||||||
|
COPY package.json .
|
||||||
|
RUN npm install
|
||||||
|
COPY / .
|
||||||
|
RUN xvfb-run --server-args="-screen 0 1024x768x24" npm test
|
||||||
|
|
@ -21,6 +21,10 @@ Rendered tiles
|
||||||
|
|
||||||
* The rendered tiles are not available in the ``tileserver-gl-light`` version.
|
* 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
|
Static images
|
||||||
=============
|
=============
|
||||||
* Several endpoints:
|
* Several endpoints:
|
||||||
|
|
|
||||||
41
package.json
41
package.json
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "tileserver-gl",
|
"name": "tileserver-gl",
|
||||||
"version": "2.3.1",
|
"version": "2.5.0",
|
||||||
"description": "Map tile server for JSON GL styles - vector and server side generated raster tiles",
|
"description": "Map tile server for JSON GL styles - vector and server side generated raster tiles",
|
||||||
"main": "src/main.js",
|
"main": "src/main.js",
|
||||||
"bin": "src/main.js",
|
"bin": "src/main.js",
|
||||||
|
|
@ -19,31 +19,30 @@
|
||||||
"test": "mocha test/**.js --timeout 10000"
|
"test": "mocha test/**.js --timeout 10000"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mapbox/mapbox-gl-native": "3.5.4",
|
"@mapbox/mapbox-gl-native": "4.0.0",
|
||||||
"@mapbox/mbtiles": "0.9.0",
|
"@mapbox/mbtiles": "0.10.0",
|
||||||
"@mapbox/sphericalmercator": "1.0.5",
|
"@mapbox/sphericalmercator": "1.1.0",
|
||||||
"@mapbox/vector-tile": "1.3.0",
|
"@mapbox/vector-tile": "1.3.1",
|
||||||
"advanced-pool": "0.3.3",
|
"advanced-pool": "0.3.3",
|
||||||
"base64url": "2.0.0",
|
"canvas": "1.6.13",
|
||||||
"canvas": "1.6.8",
|
"clone": "2.1.2",
|
||||||
"clone": "2.1.1",
|
"color": "3.1.0",
|
||||||
"color": "1.0.3",
|
"commander": "2.19.0",
|
||||||
"commander": "2.1.0",
|
"cors": "2.8.5",
|
||||||
"cors": "2.8.4",
|
"express": "4.16.4",
|
||||||
"express": "4.16.2",
|
|
||||||
"glyph-pbf-composite": "0.0.2",
|
"glyph-pbf-composite": "0.0.2",
|
||||||
"handlebars": "4.0.11",
|
"handlebars": "4.0.12",
|
||||||
"http-shutdown": "^1.2.0",
|
"http-shutdown": "^1.2.0",
|
||||||
"morgan": "1.9.0",
|
"morgan": "1.9.1",
|
||||||
"pbf": "3.0.5",
|
"pbf": "3.1.0",
|
||||||
"proj4": "2.4.4",
|
"proj4": "2.5.0",
|
||||||
"request": "2.83.0",
|
"request": "2.88.0",
|
||||||
"sharp": "0.18.2",
|
"sharp": "0.21.1",
|
||||||
"tileserver-gl-styles": "1.2.0"
|
"tileserver-gl-styles": "1.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"should": "^11.2.0",
|
"mocha": "^5.2.0",
|
||||||
"mocha": "^3.2.0",
|
"should": "^13.2.0",
|
||||||
"supertest": "^3.0.0"
|
"supertest": "^3.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ a{
|
||||||
color: #499DCE;
|
color: #499DCE;
|
||||||
transition: color .2s;
|
transition: color .2s;
|
||||||
}
|
}
|
||||||
a:hover{
|
a:hover {
|
||||||
color: #395D73;
|
color: #395D73;
|
||||||
}
|
}
|
||||||
.title {
|
.title {
|
||||||
|
|
@ -47,7 +47,7 @@ a:hover{
|
||||||
color: #499DCE;
|
color: #499DCE;
|
||||||
font-size:.8em;
|
font-size:.8em;
|
||||||
}
|
}
|
||||||
section{
|
section {
|
||||||
margin: 15px auto;
|
margin: 15px auto;
|
||||||
width: 930px;
|
width: 930px;
|
||||||
padding: 30px 0;
|
padding: 30px 0;
|
||||||
|
|
@ -70,7 +70,7 @@ section{
|
||||||
font-size:20px;
|
font-size:20px;
|
||||||
background:#fff;
|
background:#fff;
|
||||||
}
|
}
|
||||||
.item{
|
.item {
|
||||||
background:#fff;
|
background:#fff;
|
||||||
height: 191px;
|
height: 191px;
|
||||||
border: 1px solid #ededed;
|
border: 1px solid #ededed;
|
||||||
|
|
@ -79,7 +79,7 @@ section{
|
||||||
.item:nth-child(odd) {
|
.item:nth-child(odd) {
|
||||||
background-color:#fbfbfb;
|
background-color:#fbfbfb;
|
||||||
}
|
}
|
||||||
.item img{
|
.item img {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
margin: 30px;
|
margin: 30px;
|
||||||
width: 128px;
|
width: 128px;
|
||||||
|
|
@ -122,10 +122,10 @@ section{
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
.btn:first-child:hover{
|
.btn:first-child:hover {
|
||||||
background: #395D73;
|
background: #395D73;
|
||||||
}
|
}
|
||||||
footer{
|
footer {
|
||||||
width:100%;
|
width:100%;
|
||||||
border-top:1px solid #ededed;
|
border-top:1px solid #ededed;
|
||||||
text-align:center;
|
text-align:center;
|
||||||
|
|
@ -133,7 +133,7 @@ footer{
|
||||||
padding-top:10px;
|
padding-top:10px;
|
||||||
font-size:12px;
|
font-size:12px;
|
||||||
}
|
}
|
||||||
footer img{
|
footer img {
|
||||||
width: 118px;
|
width: 118px;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
}
|
}
|
||||||
|
|
@ -147,6 +147,10 @@ footer a {
|
||||||
color: #787878;
|
color: #787878;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
.details h3, .identifier {
|
||||||
|
max-width: 550px;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
/* body background image */
|
/* body background image */
|
||||||
body {
|
body {
|
||||||
|
|
@ -185,31 +189,31 @@ body {
|
||||||
.title.light:after {
|
.title.light:after {
|
||||||
font-size:.6em;
|
font-size:.6em;
|
||||||
}
|
}
|
||||||
.title img{
|
.title img {
|
||||||
width: 200px;
|
width: 200px;
|
||||||
}
|
}
|
||||||
.subtitle{
|
.subtitle {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
margin: 0 0 35px 0;
|
margin: 0 0 35px 0;
|
||||||
}
|
}
|
||||||
.item{
|
.item {
|
||||||
height: 245px;
|
height: 245px;
|
||||||
}
|
}
|
||||||
.viewers{
|
.viewers {
|
||||||
float: left;
|
float: left;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-left: 30px;
|
margin-left: 30px;
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
}
|
}
|
||||||
.viewers a{
|
.viewers a {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
.btn{
|
.btn {
|
||||||
margin: 0 20px 0 0;
|
margin: 0 20px 0 0;
|
||||||
}
|
}
|
||||||
.btn:first-child{
|
.btn:first-child {
|
||||||
padding: 0 20px;
|
padding: 0 20px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,10 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>{{name}} - TileServer GL</title>
|
<title>{{name}} - TileServer GL</title>
|
||||||
{{#is_vector}}
|
{{#is_vector}}
|
||||||
<link rel="stylesheet" type="text/css" href="/mapbox-gl.css{{&key_query}}" />
|
<link rel="stylesheet" type="text/css" href="{{public_url}}mapbox-gl.css{{&key_query}}" />
|
||||||
<link rel="stylesheet" type="text/css" href="/mapbox-gl-inspect.css{{&key_query}}" />
|
<link rel="stylesheet" type="text/css" href="{{public_url}}mapbox-gl-inspect.css{{&key_query}}" />
|
||||||
<script src="/mapbox-gl.js{{&key_query}}"></script>
|
<script src="{{public_url}}mapbox-gl.js{{&key_query}}"></script>
|
||||||
<script src="/mapbox-gl-inspect.min.js{{&key_query}}"></script>
|
<script src="{{public_url}}mapbox-gl-inspect.min.js{{&key_query}}"></script>
|
||||||
<style>
|
<style>
|
||||||
body {background:#fff;color:#333;font-family:Arial, sans-serif;}
|
body {background:#fff;color:#333;font-family:Arial, sans-serif;}
|
||||||
#map {position:absolute;top:0;left:0;right:250px;bottom:0;}
|
#map {position:absolute;top:0;left:0;right:250px;bottom:0;}
|
||||||
|
|
@ -18,9 +18,9 @@
|
||||||
</style>
|
</style>
|
||||||
{{/is_vector}}
|
{{/is_vector}}
|
||||||
{{^is_vector}}
|
{{^is_vector}}
|
||||||
<link rel="stylesheet" type="text/css" href="/mapbox.css{{&key_query}}" />
|
<link rel="stylesheet" type="text/css" href="{{public_url}}mapbox.css{{&key_query}}" />
|
||||||
<script src="/mapbox.js{{&key_query}}"></script>
|
<script src="{{public_url}}mapbox.js{{&key_query}}"></script>
|
||||||
<script src="/leaflet-hash.js{{&key_query}}"></script>
|
<script src="{{public_url}}leaflet-hash.js{{&key_query}}"></script>
|
||||||
<style>
|
<style>
|
||||||
body { margin:0; padding:0; }
|
body { margin:0; padding:0; }
|
||||||
#map { position:absolute; top:0; bottom:0; width:100%; }
|
#map { position:absolute; top:0; bottom:0; width:100%; }
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
sources: {
|
sources: {
|
||||||
'vector_layer_': {
|
'vector_layer_': {
|
||||||
type: 'vector',
|
type: 'vector',
|
||||||
url: '/data/{{id}}.json{{&key_query}}'
|
url: '{{public_url}}data/{{id}}.json{{&key_query}}'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
layers: []
|
layers: []
|
||||||
|
|
@ -74,7 +74,7 @@
|
||||||
<h1 style="display:none;">{{name}}</h1>
|
<h1 style="display:none;">{{name}}</h1>
|
||||||
<div id='map'></div>
|
<div id='map'></div>
|
||||||
<script>
|
<script>
|
||||||
var map = L.mapbox.map('map', '/data/{{id}}.json{{&key_query}}', { zoomControl: false });
|
var map = L.mapbox.map('map', '{{public_url}}data/{{id}}.json{{&key_query}}', { zoomControl: false });
|
||||||
map.eachLayer(function(layer) {
|
map.eachLayer(function(layer) {
|
||||||
// do not add scale prefix even if retina display is detected
|
// do not add scale prefix even if retina display is detected
|
||||||
layer.scalePrefix = '.';
|
layer.scalePrefix = '.';
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>TileServer GL - Server for vector and raster maps with GL styles</title>
|
<title>TileServer GL - Server for vector and raster maps with GL styles</title>
|
||||||
<link rel="stylesheet" type="text/css" href="/index.css{{&key_query}}" />
|
<link rel="stylesheet" type="text/css" href="{{public_url}}index.css{{&key_query}}" />
|
||||||
<script>
|
<script>
|
||||||
function toggle_xyz(id) {
|
function toggle_xyz(id) {
|
||||||
var el = document.getElementById(id);
|
var el = document.getElementById(id);
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<section>
|
<section>
|
||||||
<h1 class="title {{#if is_light}}light{{/if}}"><img src="/images/logo.png" alt="TileServer GL" /></h1>
|
<h1 class="title {{#if is_light}}light{{/if}}"><img src="{{public_url}}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="subtitle">Vector {{#if is_light}}<s>and raster</s>{{else}}and raster{{/if}} maps with GL styles</h2>
|
||||||
{{#if styles}}
|
{{#if styles}}
|
||||||
<h2 class="box-header">Styles</h2>
|
<h2 class="box-header">Styles</h2>
|
||||||
|
|
@ -25,9 +25,9 @@
|
||||||
{{#each styles}}
|
{{#each styles}}
|
||||||
<div class="item">
|
<div class="item">
|
||||||
{{#if thumbnail}}
|
{{#if thumbnail}}
|
||||||
<img src="/styles/{{@key}}/{{thumbnail}}{{&../key_query}}" alt="{{name}} preview" />
|
<img src="{{public_url}}styles/{{@key}}/{{thumbnail}}{{&../key_query}}" alt="{{name}} preview" />
|
||||||
{{else}}
|
{{else}}
|
||||||
<img src="/images/placeholder.png" alt="{{name}} preview" />
|
<img src="{{public_url}}images/placeholder.png" alt="{{name}} preview" />
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<div class="details">
|
<div class="details">
|
||||||
<h3>{{name}}</h3>
|
<h3>{{name}}</h3>
|
||||||
|
|
@ -35,13 +35,13 @@
|
||||||
<p class="services">
|
<p class="services">
|
||||||
services:
|
services:
|
||||||
{{#if serving_data}}
|
{{#if serving_data}}
|
||||||
<a href="/styles/{{@key}}/style.json{{&../key_query}}">GL Style</a>
|
<a href="{{public_url}}styles/{{@key}}/style.json{{&../key_query}}">GL Style</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if serving_rendered}}
|
{{#if serving_rendered}}
|
||||||
{{#if serving_data}}| {{/if}}<a href="/styles/{{@key}}.json{{&../key_query}}">TileJSON</a>
|
{{#if serving_data}}| {{/if}}<a href="{{public_url}}styles/{{@key}}.json{{&../key_query}}">TileJSON</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if wmts_link}}
|
{{#if serving_rendered}}
|
||||||
| <a href="{{&wmts_link}}">WMTS</a>
|
| <a href="/styles/{{@key}}/wmts.xml{{&../key_query}}">WMTS</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if xyz_link}}
|
{{#if xyz_link}}
|
||||||
| <a href="#" onclick="return toggle_xyz('xyz_style_{{@key}}');">XYZ</a>
|
| <a href="#" onclick="return toggle_xyz('xyz_style_{{@key}}');">XYZ</a>
|
||||||
|
|
@ -52,14 +52,14 @@
|
||||||
<div class="viewers">
|
<div class="viewers">
|
||||||
{{#if serving_data}}
|
{{#if serving_data}}
|
||||||
{{#if serving_rendered}}
|
{{#if serving_rendered}}
|
||||||
<a class="btn" href="/styles/{{@key}}/{{&../key_query}}{{viewer_hash}}">Viewer</a>
|
<a class="btn" href="{{public_url}}styles/{{@key}}/{{&../key_query}}{{viewer_hash}}">Viewer</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if serving_rendered}}
|
{{#if serving_rendered}}
|
||||||
<a class="btn" href="/styles/{{@key}}/?{{&../key_query_part}}raster{{viewer_hash}}">Raster</a>
|
<a class="btn" href="{{public_url}}styles/{{@key}}/?{{&../key_query_part}}raster{{viewer_hash}}">Raster</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if serving_data}}
|
{{#if serving_data}}
|
||||||
<a class="btn" href="/styles/{{@key}}/?{{&../key_query_part}}vector{{viewer_hash}}">Vector</a>
|
<a class="btn" href="{{public_url}}styles/{{@key}}/?{{&../key_query_part}}vector{{viewer_hash}}">Vector</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -72,15 +72,15 @@
|
||||||
{{#each data}}
|
{{#each data}}
|
||||||
<div class="item">
|
<div class="item">
|
||||||
{{#if thumbnail}}
|
{{#if thumbnail}}
|
||||||
<img src="/data/{{@key}}/{{thumbnail}}{{&../key_query}}" alt="{{name}} preview" />
|
<img src="{{public_url}}data/{{@key}}/{{thumbnail}}{{&../key_query}}" alt="{{name}} preview" />
|
||||||
{{else}}
|
{{else}}
|
||||||
<img src="/images/placeholder.png" alt="{{name}} preview" />
|
<img src="{{public_url}}images/placeholder.png" alt="{{name}} preview" />
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<div class="details">
|
<div class="details">
|
||||||
<h3>{{name}}</h3>
|
<h3>{{name}}</h3>
|
||||||
<p class="identifier">identifier: {{@key}}{{#if formatted_filesize}} | size: {{formatted_filesize}}{{/if}} | type: {{#is_vector}}vector{{/is_vector}}{{^is_vector}}raster{{/is_vector}} data</p>
|
<p class="identifier">identifier: {{@key}}{{#if formatted_filesize}} | size: {{formatted_filesize}}{{/if}} | type: {{#is_vector}}vector{{/is_vector}}{{^is_vector}}raster{{/is_vector}} data</p>
|
||||||
<p class="services">
|
<p class="services">
|
||||||
services: <a href="/data/{{@key}}.json{{&../key_query}}">TileJSON</a>
|
services: <a href="{{public_url}}data/{{@key}}.json{{&../key_query}}">TileJSON</a>
|
||||||
{{#if wmts_link}}
|
{{#if wmts_link}}
|
||||||
| <a href="{{&wmts_link}}">WMTS</a>
|
| <a href="{{&wmts_link}}">WMTS</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -92,10 +92,10 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="viewers">
|
<div class="viewers">
|
||||||
{{#is_vector}}
|
{{#is_vector}}
|
||||||
<a class="btn" href="/data/{{@key}}/{{&../key_query}}{{viewer_hash}}">Inspect</a>
|
<a class="btn" href="{{public_url}}data/{{@key}}/{{&../key_query}}{{viewer_hash}}">Inspect</a>
|
||||||
{{/is_vector}}
|
{{/is_vector}}
|
||||||
{{^is_vector}}
|
{{^is_vector}}
|
||||||
<a class="btn" href="/data/{{@key}}/{{&../key_query}}{{viewer_hash}}">View</a>
|
<a class="btn" href="{{public_url}}data/{{@key}}/{{&../key_query}}{{viewer_hash}}">View</a>
|
||||||
{{/is_vector}}
|
{{/is_vector}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -104,7 +104,7 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</section>
|
</section>
|
||||||
<footer>
|
<footer>
|
||||||
<a href="https://www.klokantech.com/" target="_blank"><img src="/images/klokantech.png" /></a>
|
<a href="https://www.klokantech.com/" target="_blank"><img src="{{public_url}}images/klokantech.png" /></a>
|
||||||
<p>
|
<p>
|
||||||
<a href="https://github.com/klokantech/tileserver-gl" target="_blank">Powered by TileServer GL ({{server_version}})</a> – <a href="https://www.klokantech.com/" target="_blank">an open-source project from Klokan Technologies GmbH.</a> <img src="https://t.klokantech.com/8073932/19" class="t" />
|
<a href="https://github.com/klokantech/tileserver-gl" target="_blank">Powered by TileServer GL ({{server_version}})</a> – <a href="https://www.klokantech.com/" target="_blank">an open-source project from Klokan Technologies GmbH.</a> <img src="https://t.klokantech.com/8073932/19" class="t" />
|
||||||
</p>
|
</p>
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>{{name}} - TileServer GL</title>
|
<title>{{name}} - TileServer GL</title>
|
||||||
<link rel="stylesheet" type="text/css" href="/mapbox-gl.css{{&key_query}}" />
|
<link rel="stylesheet" type="text/css" href="{{public_url}}mapbox-gl.css{{&key_query}}" />
|
||||||
<script src="/mapbox-gl.js{{&key_query}}"></script>
|
<script src="{{public_url}}mapbox-gl.js{{&key_query}}"></script>
|
||||||
<link rel="stylesheet" type="text/css" href="/mapbox.css{{&key_query}}" />
|
<link rel="stylesheet" type="text/css" href="{{public_url}}mapbox.css{{&key_query}}" />
|
||||||
<script src="/mapbox.js{{&key_query}}"></script>
|
<script src="{{public_url}}mapbox.js{{&key_query}}"></script>
|
||||||
<script src="/leaflet-hash.js{{&key_query}}"></script>
|
<script src="{{public_url}}leaflet-hash.js{{&key_query}}"></script>
|
||||||
<style>
|
<style>
|
||||||
body { margin:0; padding:0; }
|
body { margin:0; padding:0; }
|
||||||
#map { position:absolute; top:0; bottom:0; width:100%; }
|
#map { position:absolute; top:0; bottom:0; width:100%; }
|
||||||
|
|
@ -24,15 +24,15 @@
|
||||||
(q.indexOf('raster') >= 0 ? 'raster' :
|
(q.indexOf('raster') >= 0 ? 'raster' :
|
||||||
(mapboxgl.supported() ? 'vector' : 'raster'));
|
(mapboxgl.supported() ? 'vector' : 'raster'));
|
||||||
if (preference == 'vector') {
|
if (preference == 'vector') {
|
||||||
mapboxgl.setRTLTextPlugin('/mapbox-gl-rtl-text.js{{&key_query}}');
|
mapboxgl.setRTLTextPlugin('{{public_url}}mapbox-gl-rtl-text.js{{&key_query}}');
|
||||||
var map = new mapboxgl.Map({
|
var map = new mapboxgl.Map({
|
||||||
container: 'map',
|
container: 'map',
|
||||||
style: '/styles/{{id}}/style.json{{&key_query}}',
|
style: '{{public_url}}styles/{{id}}/style.json{{&key_query}}',
|
||||||
hash: true
|
hash: true
|
||||||
});
|
});
|
||||||
map.addControl(new mapboxgl.NavigationControl());
|
map.addControl(new mapboxgl.NavigationControl());
|
||||||
} else {
|
} else {
|
||||||
var map = L.mapbox.map('map', '/styles/{{id}}.json{{&key_query}}', { zoomControl: false });
|
var map = L.mapbox.map('map', '{{public_url}}styles/{{id}}.json{{&key_query}}', { zoomControl: false });
|
||||||
new L.Control.Zoom({ position: 'topright' }).addTo(map);
|
new L.Control.Zoom({ position: 'topright' }).addTo(map);
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
new L.Hash(map);
|
new L.Hash(map);
|
||||||
|
|
|
||||||
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>
|
||||||
26
run.sh
26
run.sh
|
|
@ -5,19 +5,33 @@ _term() {
|
||||||
kill -TERM "$child" 2>/dev/null
|
kill -TERM "$child" 2>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
trap _term TERM
|
trap _term SIGTERM
|
||||||
|
trap _term SIGINT
|
||||||
|
|
||||||
|
xvfbMaxStartWaitTime=5
|
||||||
|
displayNumber=99
|
||||||
|
screenNumber=0
|
||||||
|
|
||||||
start-stop-daemon --start --pidfile ~/xvfb.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset
|
# Delete files if they were not cleaned by last run
|
||||||
echo "Waiting 3 seconds for xvfb to start..."
|
rm -rf /tmp/.X11-unix /tmp/.X${displayNumber}-lock ~/xvfb.pid
|
||||||
sleep 3
|
|
||||||
|
|
||||||
export DISPLAY=:99.0
|
echo "Starting Xvfb on display ${displayNumber}"
|
||||||
|
start-stop-daemon --start --pidfile ~/xvfb.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :${displayNumber} -screen ${screenNumber} 1024x768x24 -ac +extension GLX +render -noreset
|
||||||
|
|
||||||
|
# Wait to be able to connect to the port. This will exit if it cannot in 15 minutes.
|
||||||
|
timeout ${xvfbMaxStartWaitTime} bash -c "while ! xdpyinfo -display :${displayNumber} >/dev/null; do sleep 0.5; done"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Could not connect to display ${displayNumber} in ${xvfbMaxStartWaitTime} seconds time."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
export DISPLAY=:${displayNumber}.${screenNumber}
|
||||||
|
|
||||||
|
echo
|
||||||
cd /data
|
cd /data
|
||||||
node /usr/src/app/ -p 80 "$@" &
|
node /usr/src/app/ -p 80 "$@" &
|
||||||
child=$!
|
child=$!
|
||||||
wait "$child"
|
wait "$child"
|
||||||
|
|
||||||
start-stop-daemon --stop --pidfile ~/xvfb.pid # stop xvfb when exiting
|
start-stop-daemon --stop --retry 5 --pidfile ~/xvfb.pid # stop xvfb when exiting
|
||||||
rm ~/xvfb.pid
|
rm ~/xvfb.pid
|
||||||
|
|
|
||||||
25
src/main.js
25
src/main.js
|
|
@ -35,13 +35,17 @@ var opts = require('commander')
|
||||||
.option(
|
.option(
|
||||||
'-p, --port <port>',
|
'-p, --port <port>',
|
||||||
'Port [8080]',
|
'Port [8080]',
|
||||||
parseInt,
|
8080,
|
||||||
8080
|
parseInt
|
||||||
)
|
)
|
||||||
.option(
|
.option(
|
||||||
'-C|--no-cors',
|
'-C|--no-cors',
|
||||||
'Disable Cross-origin resource sharing headers'
|
'Disable Cross-origin resource sharing headers'
|
||||||
)
|
)
|
||||||
|
.option(
|
||||||
|
'-u|--public_url <url>',
|
||||||
|
'Enable exposing the server on subpaths, not necessarily the root of the domain'
|
||||||
|
)
|
||||||
.option(
|
.option(
|
||||||
'-V, --verbose',
|
'-V, --verbose',
|
||||||
'More verbose output'
|
'More verbose output'
|
||||||
|
|
@ -50,6 +54,14 @@ var opts = require('commander')
|
||||||
'-s, --silent',
|
'-s, --silent',
|
||||||
'Less verbose output'
|
'Less verbose output'
|
||||||
)
|
)
|
||||||
|
.option(
|
||||||
|
'-l|--log_file <file>',
|
||||||
|
'output log file (defaults to standard out)'
|
||||||
|
)
|
||||||
|
.option(
|
||||||
|
'-f|--log_format <format>',
|
||||||
|
'define the log format: https://github.com/expressjs/morgan#morganformat-options'
|
||||||
|
)
|
||||||
.version(
|
.version(
|
||||||
packageJson.version,
|
packageJson.version,
|
||||||
'-v, --version'
|
'-v, --version'
|
||||||
|
|
@ -59,13 +71,20 @@ var opts = require('commander')
|
||||||
console.log('Starting ' + packageJson.name + ' v' + packageJson.version);
|
console.log('Starting ' + packageJson.name + ' v' + packageJson.version);
|
||||||
|
|
||||||
var startServer = function(configPath, config) {
|
var startServer = function(configPath, config) {
|
||||||
|
var publicUrl = opts.public_url;
|
||||||
|
if (publicUrl && publicUrl.lastIndexOf('/') !== publicUrl.length - 1) {
|
||||||
|
publicUrl += '/';
|
||||||
|
}
|
||||||
return require('./server')({
|
return require('./server')({
|
||||||
configPath: configPath,
|
configPath: configPath,
|
||||||
config: config,
|
config: config,
|
||||||
bind: opts.bind,
|
bind: opts.bind,
|
||||||
port: opts.port,
|
port: opts.port,
|
||||||
cors: opts.cors,
|
cors: opts.cors,
|
||||||
silent: opts.silent
|
silent: opts.silent,
|
||||||
|
logFile: opts.log_file,
|
||||||
|
logFormat: opts.log_format,
|
||||||
|
publicUrl: publicUrl
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ try {
|
||||||
|
|
||||||
var utils = require('./utils');
|
var utils = require('./utils');
|
||||||
|
|
||||||
module.exports = function(options, repo, params, id, styles) {
|
module.exports = function(options, repo, params, id, styles, publicUrl) {
|
||||||
var app = express().disable('x-powered-by');
|
var app = express().disable('x-powered-by');
|
||||||
|
|
||||||
var mbtilesFile = path.resolve(options.paths.mbtiles, params.mbtiles);
|
var mbtilesFile = path.resolve(options.paths.mbtiles, params.mbtiles);
|
||||||
|
|
@ -89,7 +89,7 @@ module.exports = function(options, repo, params, id, styles) {
|
||||||
source.getTile(z, x, y, function(err, data, headers) {
|
source.getTile(z, x, y, function(err, data, headers) {
|
||||||
if (err) {
|
if (err) {
|
||||||
if (/does not exist/.test(err.message)) {
|
if (/does not exist/.test(err.message)) {
|
||||||
return res.status(404).send(err.message);
|
return res.status(204).send();
|
||||||
} else {
|
} else {
|
||||||
return res.status(500).send(err.message);
|
return res.status(500).send(err.message);
|
||||||
}
|
}
|
||||||
|
|
@ -178,7 +178,7 @@ module.exports = function(options, repo, params, id, styles) {
|
||||||
app.get('/' + id + '.json', function(req, res, next) {
|
app.get('/' + id + '.json', function(req, res, next) {
|
||||||
var info = clone(tileJSON);
|
var info = clone(tileJSON);
|
||||||
info.tiles = utils.getTileUrls(req, info.tiles,
|
info.tiles = utils.getTileUrls(req, info.tiles,
|
||||||
'data/' + id, info.format, {
|
'data/' + id, info.format, publicUrl, {
|
||||||
'pbf': options.pbfAlias
|
'pbf': options.pbfAlias
|
||||||
});
|
});
|
||||||
return res.send(info);
|
return res.send(info);
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ function createEmptyResponse(format, color, callback) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = function(options, repo, params, id, dataResolver) {
|
module.exports = function(options, repo, params, id, publicUrl, dataResolver) {
|
||||||
var app = express().disable('x-powered-by');
|
var app = express().disable('x-powered-by');
|
||||||
|
|
||||||
var maxScaleFactor = Math.min(Math.floor(options.maxScaleFactor || 3), 9);
|
var maxScaleFactor = Math.min(Math.floor(options.maxScaleFactor || 3), 9);
|
||||||
|
|
@ -747,7 +747,7 @@ module.exports = function(options, repo, params, id, dataResolver) {
|
||||||
app.get('/' + id + '.json', function(req, res, next) {
|
app.get('/' + id + '.json', function(req, res, next) {
|
||||||
var info = clone(tileJSON);
|
var info = clone(tileJSON);
|
||||||
info.tiles = utils.getTileUrls(req, info.tiles,
|
info.tiles = utils.getTileUrls(req, info.tiles,
|
||||||
'styles/' + id, info.format);
|
'styles/' + id, info.format, publicUrl);
|
||||||
return res.send(info);
|
return res.send(info);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,9 @@ var path = require('path'),
|
||||||
var clone = require('clone'),
|
var clone = require('clone'),
|
||||||
express = require('express');
|
express = require('express');
|
||||||
|
|
||||||
|
var utils = require('./utils');
|
||||||
|
|
||||||
module.exports = function(options, repo, params, id, reportTiles, reportFont) {
|
module.exports = function(options, repo, params, id, publicUrl, reportTiles, reportFont) {
|
||||||
var app = express().disable('x-powered-by');
|
var app = express().disable('x-powered-by');
|
||||||
|
|
||||||
var styleFile = path.resolve(options.paths.styles, params.style);
|
var styleFile = path.resolve(options.paths.styles, params.style);
|
||||||
|
|
@ -79,7 +80,7 @@ module.exports = function(options, repo, params, id, reportTiles, reportFont) {
|
||||||
query = '?' + queryParams.join('&');
|
query = '?' + queryParams.join('&');
|
||||||
}
|
}
|
||||||
return url.replace(
|
return url.replace(
|
||||||
'local://', req.protocol + '://' + req.headers.host + '/') + query;
|
'local://', utils.getPublicUrl(publicUrl, req)) + query;
|
||||||
};
|
};
|
||||||
|
|
||||||
var styleJSON_ = clone(styleJSON);
|
var styleJSON_ = clone(styleJSON);
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,7 @@ process.env.UV_THREADPOOL_SIZE =
|
||||||
var fs = require('fs'),
|
var fs = require('fs'),
|
||||||
path = require('path');
|
path = require('path');
|
||||||
|
|
||||||
var base64url = require('base64url'),
|
var clone = require('clone'),
|
||||||
clone = require('clone'),
|
|
||||||
cors = require('cors'),
|
cors = require('cors'),
|
||||||
enableShutdown = require('http-shutdown'),
|
enableShutdown = require('http-shutdown'),
|
||||||
express = require('express'),
|
express = require('express'),
|
||||||
|
|
@ -42,12 +41,11 @@ function start(opts) {
|
||||||
|
|
||||||
app.enable('trust proxy');
|
app.enable('trust proxy');
|
||||||
|
|
||||||
if (process.env.NODE_ENV == 'production') {
|
if (process.env.NODE_ENV !== 'test') {
|
||||||
app.use(morgan('tiny', {
|
var defaultLogFormat = process.env.NODE_ENV == 'production' ? 'tiny' : 'dev';
|
||||||
skip: function(req, res) { return opts.silent && (res.statusCode == 200 || res.statusCode == 304) }
|
var logFormat = opts.logFormat || defaultLogFormat;
|
||||||
}));
|
app.use(morgan(logFormat, {
|
||||||
} else if (process.env.NODE_ENV !== 'test') {
|
stream: opts.logFile ? fs.createWriteStream(opts.logFile, { flags: 'a' }) : process.stdout,
|
||||||
app.use(morgan('dev', {
|
|
||||||
skip: function(req, res) { return opts.silent && (res.statusCode == 200 || res.statusCode == 304) }
|
skip: function(req, res) { return opts.silent && (res.statusCode == 200 || res.statusCode == 304) }
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
@ -113,7 +111,7 @@ function start(opts) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.serve_data !== false) {
|
if (item.serve_data !== false) {
|
||||||
startupPromises.push(serve_style(options, serving.styles, item, id,
|
startupPromises.push(serve_style(options, serving.styles, item, id, opts.publicUrl,
|
||||||
function(mbtiles, fromData) {
|
function(mbtiles, fromData) {
|
||||||
var dataItemId;
|
var dataItemId;
|
||||||
Object.keys(data).forEach(function(id) {
|
Object.keys(data).forEach(function(id) {
|
||||||
|
|
@ -149,7 +147,7 @@ function start(opts) {
|
||||||
if (item.serve_rendered !== false) {
|
if (item.serve_rendered !== false) {
|
||||||
if (serve_rendered) {
|
if (serve_rendered) {
|
||||||
startupPromises.push(
|
startupPromises.push(
|
||||||
serve_rendered(options, serving.rendered, item, id,
|
serve_rendered(options, serving.rendered, item, id, opts.publicUrl,
|
||||||
function(mbtiles) {
|
function(mbtiles) {
|
||||||
var mbtilesFile;
|
var mbtilesFile;
|
||||||
Object.keys(data).forEach(function(id) {
|
Object.keys(data).forEach(function(id) {
|
||||||
|
|
@ -183,7 +181,7 @@ function start(opts) {
|
||||||
}
|
}
|
||||||
|
|
||||||
startupPromises.push(
|
startupPromises.push(
|
||||||
serve_data(options, serving.data, item, id, serving.styles).then(function(sub) {
|
serve_data(options, serving.data, item, id, serving.styles, opts.publicUrl).then(function(sub) {
|
||||||
app.use('/data/', sub);
|
app.use('/data/', sub);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
@ -198,7 +196,7 @@ function start(opts) {
|
||||||
version: styleJSON.version,
|
version: styleJSON.version,
|
||||||
name: styleJSON.name,
|
name: styleJSON.name,
|
||||||
id: id,
|
id: id,
|
||||||
url: req.protocol + '://' + req.headers.host +
|
url: utils.getPublicUrl(opts.publicUrl, req) +
|
||||||
'/styles/' + id + '/style.json' + query
|
'/styles/' + id + '/style.json' + query
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -214,7 +212,7 @@ function start(opts) {
|
||||||
} else {
|
} else {
|
||||||
path = type + '/' + id;
|
path = type + '/' + id;
|
||||||
}
|
}
|
||||||
info.tiles = utils.getTileUrls(req, info.tiles, path, info.format, {
|
info.tiles = utils.getTileUrls(req, info.tiles, path, info.format, opts.publicUrl, {
|
||||||
'pbf': options.pbfAlias
|
'pbf': options.pbfAlias
|
||||||
});
|
});
|
||||||
arr.push(info);
|
arr.push(info);
|
||||||
|
|
@ -265,10 +263,12 @@ function start(opts) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data['server_version'] = packageJson.name + ' v' + packageJson.version;
|
data['server_version'] = packageJson.name + ' v' + packageJson.version;
|
||||||
|
data['public_url'] = opts.publicUrl || '/';
|
||||||
data['is_light'] = isLight;
|
data['is_light'] = isLight;
|
||||||
data['key_query_part'] =
|
data['key_query_part'] =
|
||||||
req.query.key ? 'key=' + req.query.key + '&' : '';
|
req.query.key ? 'key=' + req.query.key + '&' : '';
|
||||||
data['key_query'] = 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));
|
return res.status(200).send(compiled(data));
|
||||||
});
|
});
|
||||||
resolve();
|
resolve();
|
||||||
|
|
@ -296,14 +296,9 @@ function start(opts) {
|
||||||
Math.floor(centerPx[1] / 256) + '.png';
|
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(
|
var tiles = utils.getTileUrls(
|
||||||
req, style.serving_rendered.tiles,
|
req, style.serving_rendered.tiles,
|
||||||
'styles/' + id, style.serving_rendered.format);
|
'styles/' + id, style.serving_rendered.format, opts.publicUrl);
|
||||||
style.xyz_link = tiles[0];
|
style.xyz_link = tiles[0];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -325,13 +320,8 @@ function start(opts) {
|
||||||
Math.floor(centerPx[1] / 256) + '.' + data_.format;
|
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(
|
var tiles = utils.getTileUrls(
|
||||||
req, data_.tiles, 'data/' + id, data_.format, {
|
req, data_.tiles, 'data/' + id, data_.format, opts.publicUrl, {
|
||||||
'pbf': options.pbfAlias
|
'pbf': options.pbfAlias
|
||||||
});
|
});
|
||||||
data_.xyz_link = tiles[0];
|
data_.xyz_link = tiles[0];
|
||||||
|
|
@ -374,6 +364,20 @@ function start(opts) {
|
||||||
return res.redirect(301, '/styles/' + req.params.id + '/');
|
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) {
|
serveTemplate('/data/:id/$', 'data', function(req) {
|
||||||
var id = req.params.id;
|
var id = req.params.id;
|
||||||
|
|
|
||||||
11
src/utils.js
11
src/utils.js
|
|
@ -6,7 +6,12 @@ var path = require('path'),
|
||||||
var clone = require('clone'),
|
var clone = require('clone'),
|
||||||
glyphCompose = require('glyph-pbf-composite');
|
glyphCompose = require('glyph-pbf-composite');
|
||||||
|
|
||||||
module.exports.getTileUrls = function(req, domains, path, format, aliases) {
|
|
||||||
|
module.exports.getPublicUrl = function(publicUrl, req) {
|
||||||
|
return publicUrl || (req.protocol + '://' + req.headers.host + '/')
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.getTileUrls = function(req, domains, path, format, publicUrl, aliases) {
|
||||||
|
|
||||||
if (domains) {
|
if (domains) {
|
||||||
if (domains.constructor === String && domains.length > 0) {
|
if (domains.constructor === String && domains.length > 0) {
|
||||||
|
|
@ -49,10 +54,14 @@ module.exports.getTileUrls = function(req, domains, path, format, aliases) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var uris = [];
|
var uris = [];
|
||||||
|
if (!publicUrl) {
|
||||||
domains.forEach(function(domain) {
|
domains.forEach(function(domain) {
|
||||||
uris.push(req.protocol + '://' + domain + '/' + path +
|
uris.push(req.protocol + '://' + domain + '/' + path +
|
||||||
'/{z}/{x}/{y}.' + format + query);
|
'/{z}/{x}/{y}.' + format + query);
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
uris.push(publicUrl + path + '/{z}/{x}/{y}.' + format + query)
|
||||||
|
}
|
||||||
|
|
||||||
return uris;
|
return uris;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,8 @@ before(function() {
|
||||||
process.chdir('test_data');
|
process.chdir('test_data');
|
||||||
var running = require('../src/server')({
|
var running = require('../src/server')({
|
||||||
configPath: 'config.json',
|
configPath: 'config.json',
|
||||||
port: 8888
|
port: 8888,
|
||||||
|
publicUrl: '/test/'
|
||||||
});
|
});
|
||||||
global.app = running.app;
|
global.app = running.app;
|
||||||
global.server = running.server;
|
global.server = running.server;
|
||||||
|
|
@ -17,5 +18,5 @@ before(function() {
|
||||||
|
|
||||||
after(function() {
|
after(function() {
|
||||||
console.log('global teardown');
|
console.log('global teardown');
|
||||||
global.server.close(function() { console.log('Done'); });
|
global.server.close(function() { console.log('Done'); process.exit(); });
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ describe('Styles', function() {
|
||||||
res.body.sources.should.be.Object();
|
res.body.sources.should.be.Object();
|
||||||
res.body.glyphs.should.be.String();
|
res.body.glyphs.should.be.String();
|
||||||
res.body.sprite.should.be.String();
|
res.body.sprite.should.be.String();
|
||||||
|
res.body.sprite.should.equal('/test/styles/test-style/sprite');
|
||||||
res.body.layers.should.be.Array();
|
res.body.layers.should.be.Array();
|
||||||
}).end(done);
|
}).end(done);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,6 @@ describe('Vector tiles', function() {
|
||||||
testTile(prefix, 0, 1, 0, 404);
|
testTile(prefix, 0, 1, 0, 404);
|
||||||
testTile(prefix, 0, 0, 1, 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
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue