Update endpoint URL and change content type
After a good nights sleep I considered the structure of the endpoint link for WMTS, at the same time I cleaned up the code and added the correct content type for the response.
This commit is contained in:
parent
5d5ed1153f
commit
6e24f6ec8e
3 changed files with 4 additions and 4 deletions
|
@ -23,7 +23,7 @@ Rendered tiles
|
||||||
|
|
||||||
WMTS Capabilities
|
WMTS Capabilities
|
||||||
==============
|
==============
|
||||||
* WMTS Capabilities are served at ``/wmts/{id}/``
|
* WMTS Capabilities are served at ``/styles/{id}/wmts.xml``
|
||||||
|
|
||||||
Static images
|
Static images
|
||||||
=============
|
=============
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
{{#if serving_data}}| {{/if}}<a href="/styles/{{@key}}.json{{&../key_query}}">TileJSON</a>
|
{{#if serving_data}}| {{/if}}<a href="/styles/{{@key}}.json{{&../key_query}}">TileJSON</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if serving_rendered}}
|
{{#if serving_rendered}}
|
||||||
| <a href="/wmts/{{@key}}/{{&../key_query}}">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>
|
||||||
|
|
|
@ -269,6 +269,7 @@ function start(opts) {
|
||||||
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();
|
||||||
|
@ -369,7 +370,7 @@ function start(opts) {
|
||||||
return res.redirect(301, '/styles/' + req.params.id + '/');
|
return res.redirect(301, '/styles/' + req.params.id + '/');
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
serveTemplate('/wmts/:id/$', 'wmts', function(req) {
|
serveTemplate('/styles/:id/wmts.xml', 'wmts', function(req) {
|
||||||
var id = req.params.id;
|
var id = req.params.id;
|
||||||
var wmts = clone((config.styles || {})[id]);
|
var wmts = clone((config.styles || {})[id]);
|
||||||
if (!wmts) {
|
if (!wmts) {
|
||||||
|
@ -381,7 +382,6 @@ function start(opts) {
|
||||||
wmts.id = id;
|
wmts.id = id;
|
||||||
wmts.name = (serving.styles[id] || serving.rendered[id]).name;
|
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');
|
wmts.baseUrl = (req.get('X-Forwarded-Protocol')?req.get('X-Forwarded-Protocol'):req.protocol) + '://' + req.get('host');
|
||||||
console.log(wmts)
|
|
||||||
return wmts;
|
return wmts;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue