it's hard coded and it works.
This commit is contained in:
parent
7acbc93ba9
commit
5a552e2db1
16 changed files with 111 additions and 111 deletions
|
|
@ -6,32 +6,32 @@ If you visit the server on the configured port (default 8080) you can see your m
|
||||||
|
|
||||||
Styles
|
Styles
|
||||||
======
|
======
|
||||||
* Styles are served at ``/styles/{id}/style.json`` (+ array at ``/styles.json``)
|
* Styles are served at ``/gl-styles/{id}/style.json`` (+ array at ``/styles.json``)
|
||||||
|
|
||||||
* Sprites at ``/styles/{id}/sprite[@2x].{format}``
|
* Sprites at ``/gl-styles/{id}/sprite[@2x].{format}``
|
||||||
* Fonts at ``/fonts/{fontstack}/{start}-{end}.pbf``
|
* Fonts at ``/fonts/{fontstack}/{start}-{end}.pbf``
|
||||||
|
|
||||||
Rendered tiles
|
Rendered tiles
|
||||||
==============
|
==============
|
||||||
* Rendered tiles are served at ``/styles/{id}/{z}/{x}/{y}[@2x].{format}``
|
* Rendered tiles are served at ``/gl-styles/{id}/{z}/{x}/{y}[@2x].{format}``
|
||||||
|
|
||||||
* The optional ``@2x`` (or ``@3x``, ``@4x``) part can be used to render HiDPI (retina) tiles
|
* The optional ``@2x`` (or ``@3x``, ``@4x``) part can be used to render HiDPI (retina) tiles
|
||||||
* Available formats: ``png``, ``jpg`` (``jpeg``), ``webp``
|
* Available formats: ``png``, ``jpg`` (``jpeg``), ``webp``
|
||||||
* TileJSON at ``/styles/{id}.json``
|
* TileJSON at ``/gl-styles/{id}.json``
|
||||||
|
|
||||||
* 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
|
||||||
==============
|
==============
|
||||||
* WMTS Capabilities are served at ``/styles/{id}/wmts.xml``
|
* WMTS Capabilities are served at ``/gl-styles/{id}/wmts.xml``
|
||||||
|
|
||||||
Static images
|
Static images
|
||||||
=============
|
=============
|
||||||
* Several endpoints:
|
* Several endpoints:
|
||||||
|
|
||||||
* ``/styles/{id}/static/{lon},{lat},{zoom}[@{bearing}[,{pitch}]]/{width}x{height}[@2x].{format}`` (center-based)
|
* ``/gl-styles/{id}/static/{lon},{lat},{zoom}[@{bearing}[,{pitch}]]/{width}x{height}[@2x].{format}`` (center-based)
|
||||||
* ``/styles/{id}/static/{minx},{miny},{maxx},{maxy}/{width}x{height}[@2x].{format}`` (area-based)
|
* ``/gl-styles/{id}/static/{minx},{miny},{maxx},{maxy}/{width}x{height}[@2x].{format}`` (area-based)
|
||||||
* ``/styles/{id}/static/auto/{width}x{height}[@2x].{format}`` (autofit path -- see below)
|
* ``/gl-styles/{id}/static/auto/{width}x{height}[@2x].{format}`` (autofit path -- see below)
|
||||||
|
|
||||||
* All the static image endpoints additionally support following query parameters:
|
* All the static image endpoints additionally support following query parameters:
|
||||||
|
|
||||||
|
|
@ -47,19 +47,19 @@ Static images
|
||||||
|
|
||||||
* value of ``0.1`` means "add 10% size to each side to make sure the area of interest is nicely visible"
|
* value of ``0.1`` means "add 10% size to each side to make sure the area of interest is nicely visible"
|
||||||
|
|
||||||
* You can also use (experimental) ``/styles/{id}/static/raw/...`` endpoints with raw spherical mercator coordinates (EPSG:3857) instead of WGS84.
|
* You can also use (experimental) ``/gl-styles/{id}/static/raw/...`` endpoints with raw spherical mercator coordinates (EPSG:3857) instead of WGS84.
|
||||||
|
|
||||||
* The static images are not available in the ``tileserver-gl-light`` version.
|
* The static images are not available in the ``tileserver-gl-light`` version.
|
||||||
|
|
||||||
Source data
|
Source data
|
||||||
===========
|
===========
|
||||||
* Source data are served at ``/data/{mbtiles}/{z}/{x}/{y}.{format}``
|
* Source data are served at ``/mbtiles/{mbtiles}/{z}/{x}/{y}.{format}``
|
||||||
|
|
||||||
* Format depends on the source file (usually ``png`` or ``pbf``)
|
* Format depends on the source file (usually ``png`` or ``pbf``)
|
||||||
|
|
||||||
* ``geojson`` is also available (useful for inspecting the tiles) in case the original format is ``pbf``
|
* ``geojson`` is also available (useful for inspecting the tiles) in case the original format is ``pbf``
|
||||||
|
|
||||||
* TileJSON at ``/data/{mbtiles}.json``
|
* TileJSON at ``/mbtiles/{mbtiles}.json``
|
||||||
|
|
||||||
TileJSON arrays
|
TileJSON arrays
|
||||||
===============
|
===============
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -22,7 +22,7 @@ module.exports={"author":"Mapbox","name":"mapbox.js","description":"mapbox javas
|
||||||
},{"./format_url":11,"./marker":25,"./request":26,"./simplestyle":28,"./util":31,"sanitize-caja":5}],10:[function(require,module,exports){
|
},{"./format_url":11,"./marker":25,"./request":26,"./simplestyle":28,"./util":31,"sanitize-caja":5}],10:[function(require,module,exports){
|
||||||
"use strict";var Feedback=L.Class.extend({includes:L.Mixin.Events,data:{},record:function(e){L.extend(this.data,e),this.fire("change")}});module.exports=new Feedback;
|
"use strict";var Feedback=L.Class.extend({includes:L.Mixin.Events,data:{},record:function(e){L.extend(this.data,e),this.fire("change")}});module.exports=new Feedback;
|
||||||
},{}],11:[function(require,module,exports){
|
},{}],11:[function(require,module,exports){
|
||||||
"use strict";var config=require("./config"),version=require("../package.json").version;module.exports=function(e,o){if(o=o||L.mapbox.accessToken,!o&&config.REQUIRE_ACCESS_TOKEN)throw new Error("An API access token is required to use Mapbox.js. See https://www.mapbox.com/mapbox.js/api/v"+version+"/api-access-tokens/");var s="https:"===document.location.protocol||config.FORCE_HTTPS?config.HTTPS_URL:config.HTTP_URL;if(s=s.replace(/\/v4$/,""),s+=e,config.REQUIRE_ACCESS_TOKEN){if("s"===o[0])throw new Error("Use a public access token (pk.*) with Mapbox.js, not a secret access token (sk.*). See https://www.mapbox.com/mapbox.js/api/v"+version+"/api-access-tokens/");s+=-1!==s.indexOf("?")?"&access_token=":"?access_token=",s+=o}return s},module.exports.tileJSON=function(e,o){if(-1!==e.indexOf("/"))return e;var s=module.exports("/v4/"+e+".json",o);return 0===s.indexOf("https")&&(s+="&secure"),s},module.exports.style=function(e,o){if(-1===e.indexOf("mapbox://styles/"))throw new Error("Incorrectly formatted Mapbox style at "+e);var s=e.split("mapbox://styles/")[1],t=module.exports("/styles/v1/"+s,o).replace("http://","https://");return t};
|
"use strict";var config=require("./config"),version=require("../package.json").version;module.exports=function(e,o){if(o=o||L.mapbox.accessToken,!o&&config.REQUIRE_ACCESS_TOKEN)throw new Error("An API access token is required to use Mapbox.js. See https://www.mapbox.com/mapbox.js/api/v"+version+"/api-access-tokens/");var s="https:"===document.location.protocol||config.FORCE_HTTPS?config.HTTPS_URL:config.HTTP_URL;if(s=s.replace(/\/v4$/,""),s+=e,config.REQUIRE_ACCESS_TOKEN){if("s"===o[0])throw new Error("Use a public access token (pk.*) with Mapbox.js, not a secret access token (sk.*). See https://www.mapbox.com/mapbox.js/api/v"+version+"/api-access-tokens/");s+=-1!==s.indexOf("?")?"&access_token=":"?access_token=",s+=o}return s},module.exports.tileJSON=function(e,o){if(-1!==e.indexOf("/"))return e;var s=module.exports("/v4/"+e+".json",o);return 0===s.indexOf("https")&&(s+="&secure"),s},module.exports.style=function(e,o){if(-1===e.indexOf("mapbox://gl-styles/"))throw new Error("Incorrectly formatted Mapbox style at "+e);var s=e.split("mapbox://gl-styles/")[1],t=module.exports("/gl-styles/v1/"+s,o).replace("http://","https://");return t};
|
||||||
},{"../package.json":7,"./config":8}],12:[function(require,module,exports){
|
},{"../package.json":7,"./config":8}],12:[function(require,module,exports){
|
||||||
"use strict";var isArray=require("isarray"),util=require("./util"),format_url=require("./format_url"),feedback=require("./feedback"),request=require("./request");module.exports=function(e,r){function t(e,r){var t=Math.pow(10,r);return e.lat=Math.round(e.lat*t)/t,e.lng=Math.round(e.lng*t)/t,e}r||(r={});var n={};return util.strict(e,"string"),-1===e.indexOf("/")&&(e=format_url("/geocoding/v5/"+e+"/{query}.json",r.accessToken,5)),n.getURL=function(){return e},n.queryURL=function(e){var r=!(isArray(e)||"string"==typeof e),u=r?e.query:e;if(isArray(u)){for(var o=[],i=0;i<u.length;i++)o[i]=encodeURIComponent(u[i]);u=o.join(";")}else u=encodeURIComponent(u);feedback.record({geocoding:u});var a=L.Util.template(n.getURL(),{query:u});if(r&&e.types&&(a+=isArray(e.types)?"&types="+e.types.join():"&types="+e.types),r&&e.proximity){var l=t(L.latLng(e.proximity),3);a+="&proximity="+l.lng+","+l.lat}return a},n.query=function(e,r){return util.strict(r,"function"),request(n.queryURL(e),function(e,t){if(t&&(t.length||t.features)){var n={results:t};t.features&&t.features.length&&(n.latlng=[t.features[0].center[1],t.features[0].center[0]],t.features[0].bbox&&(n.bounds=t.features[0].bbox,n.lbounds=util.lbounds(n.bounds))),r(null,n)}else r(e||!0)}),n},n.reverseQuery=function(e,r){function u(e){var r;return r=void 0!==e.lat&&void 0!==e.lng?L.latLng(e.lat,e.lng):void 0!==e.lat&&void 0!==e.lon?L.latLng(e.lat,e.lon):L.latLng(e[1],e[0]),r=t(r,5),r.lng+","+r.lat}var o="";if(e.length&&e[0].length){for(var i=0,a=[];i<e.length;i++)a.push(u(e[i]));o=a.join(";")}else o=u(e);return request(n.queryURL(o),function(e,t){r(e,t)}),n},n};
|
"use strict";var isArray=require("isarray"),util=require("./util"),format_url=require("./format_url"),feedback=require("./feedback"),request=require("./request");module.exports=function(e,r){function t(e,r){var t=Math.pow(10,r);return e.lat=Math.round(e.lat*t)/t,e.lng=Math.round(e.lng*t)/t,e}r||(r={});var n={};return util.strict(e,"string"),-1===e.indexOf("/")&&(e=format_url("/geocoding/v5/"+e+"/{query}.json",r.accessToken,5)),n.getURL=function(){return e},n.queryURL=function(e){var r=!(isArray(e)||"string"==typeof e),u=r?e.query:e;if(isArray(u)){for(var o=[],i=0;i<u.length;i++)o[i]=encodeURIComponent(u[i]);u=o.join(";")}else u=encodeURIComponent(u);feedback.record({geocoding:u});var a=L.Util.template(n.getURL(),{query:u});if(r&&e.types&&(a+=isArray(e.types)?"&types="+e.types.join():"&types="+e.types),r&&e.proximity){var l=t(L.latLng(e.proximity),3);a+="&proximity="+l.lng+","+l.lat}return a},n.query=function(e,r){return util.strict(r,"function"),request(n.queryURL(e),function(e,t){if(t&&(t.length||t.features)){var n={results:t};t.features&&t.features.length&&(n.latlng=[t.features[0].center[1],t.features[0].center[0]],t.features[0].bbox&&(n.bounds=t.features[0].bbox,n.lbounds=util.lbounds(n.bounds))),r(null,n)}else r(e||!0)}),n},n.reverseQuery=function(e,r){function u(e){var r;return r=void 0!==e.lat&&void 0!==e.lng?L.latLng(e.lat,e.lng):void 0!==e.lat&&void 0!==e.lon?L.latLng(e.lat,e.lon):L.latLng(e[1],e[0]),r=t(r,5),r.lng+","+r.lat}var o="";if(e.length&&e[0].length){for(var i=0,a=[];i<e.length;i++)a.push(u(e[i]));o=a.join(";")}else o=u(e);return request(n.queryURL(o),function(e,t){r(e,t)}),n},n};
|
||||||
},{"./feedback":10,"./format_url":11,"./request":26,"./util":31,"isarray":2}],13:[function(require,module,exports){
|
},{"./feedback":10,"./format_url":11,"./request":26,"./util":31,"isarray":2}],13:[function(require,module,exports){
|
||||||
|
|
@ -58,7 +58,7 @@ module.exports=window.L=require("leaflet/dist/leaflet-src");
|
||||||
},{"./format_url":11,"./load_tilejson":21}],28:[function(require,module,exports){
|
},{"./format_url":11,"./load_tilejson":21}],28:[function(require,module,exports){
|
||||||
"use strict";function fallback(t,l){var i={};for(var r in l)void 0===t[r]?i[r]=l[r]:i[r]=t[r];return i}function remap(t){for(var l={},i=0;i<mapping.length;i++)l[mapping[i][1]]=t[mapping[i][0]];return l}function style(t){return remap(fallback(t.properties||{},defaults))}var defaults={stroke:"#555555","stroke-width":2,"stroke-opacity":1,fill:"#555555","fill-opacity":.5},mapping=[["stroke","color"],["stroke-width","weight"],["stroke-opacity","opacity"],["fill","fillColor"],["fill-opacity","fillOpacity"]];module.exports={style:style,defaults:defaults};
|
"use strict";function fallback(t,l){var i={};for(var r in l)void 0===t[r]?i[r]=l[r]:i[r]=t[r];return i}function remap(t){for(var l={},i=0;i<mapping.length;i++)l[mapping[i][1]]=t[mapping[i][0]];return l}function style(t){return remap(fallback(t.properties||{},defaults))}var defaults={stroke:"#555555","stroke-width":2,"stroke-opacity":1,fill:"#555555","fill-opacity":.5},mapping=[["stroke","color"],["stroke-width","weight"],["stroke-opacity","opacity"],["fill","fillColor"],["fill-opacity","fillOpacity"]];module.exports={style:style,defaults:defaults};
|
||||||
},{}],29:[function(require,module,exports){
|
},{}],29:[function(require,module,exports){
|
||||||
"use strict";var util=require("./util"),format_url=require("./format_url"),request=require("./request"),StyleLayer=L.TileLayer.extend({options:{sanitizer:require("sanitize-caja")},initialize:function(t,i){L.TileLayer.prototype.initialize.call(this,void 0,i),this.options.tiles=this._formatTileURL(t),this.options.tileSize=512,this.options.zoomOffset=-1,this.options.tms=!1,this._getAttribution(t)},_getAttribution:function(t){var i=format_url.style(t,this.options&&this.options.accessToken);request(i,L.bind(function(e,r){e&&(util.log("could not load Mapbox style at "+i),this.fire("error",{error:e}));var o=[];for(var s in r.sources){var l=r.sources[s].url.split("mapbox://")[1];o.push(l)}request(format_url.tileJSON(o.join(),this.options.accessToken),L.bind(function(i,e){i?(util.log("could not load TileJSON at "+t),this.fire("error",{error:i})):e&&(util.strict(e,"object"),this.options.attribution=this.options.sanitizer(e.attribution),this._tilejson=e,this.fire("ready"))},this))},this))},setUrl:null,_formatTileURL:function(t){var i=L.Browser.retina?"@2x":"";if("string"==typeof t){-1===t.indexOf("mapbox://styles/")&&(util.log("Incorrectly formatted Mapbox style at "+t),this.fire("error"));var e=t.split("mapbox://styles/")[1];return format_url("/styles/v1/"+e+"/tiles/{z}/{x}/{y}"+i,this.options.accessToken)}return"object"==typeof t?format_url("/styles/v1/"+t.owner+"/"+t.id+"/tiles/{z}/{x}/{y}"+i,this.options.accessToken):void 0},getTileUrl:function(t){var i=L.Util.template(this.options.tiles,t);return i}});module.exports.StyleLayer=StyleLayer,module.exports.styleLayer=function(t,i){return new StyleLayer(t,i)};
|
"use strict";var util=require("./util"),format_url=require("./format_url"),request=require("./request"),StyleLayer=L.TileLayer.extend({options:{sanitizer:require("sanitize-caja")},initialize:function(t,i){L.TileLayer.prototype.initialize.call(this,void 0,i),this.options.tiles=this._formatTileURL(t),this.options.tileSize=512,this.options.zoomOffset=-1,this.options.tms=!1,this._getAttribution(t)},_getAttribution:function(t){var i=format_url.style(t,this.options&&this.options.accessToken);request(i,L.bind(function(e,r){e&&(util.log("could not load Mapbox style at "+i),this.fire("error",{error:e}));var o=[];for(var s in r.sources){var l=r.sources[s].url.split("mapbox://")[1];o.push(l)}request(format_url.tileJSON(o.join(),this.options.accessToken),L.bind(function(i,e){i?(util.log("could not load TileJSON at "+t),this.fire("error",{error:i})):e&&(util.strict(e,"object"),this.options.attribution=this.options.sanitizer(e.attribution),this._tilejson=e,this.fire("ready"))},this))},this))},setUrl:null,_formatTileURL:function(t){var i=L.Browser.retina?"@2x":"";if("string"==typeof t){-1===t.indexOf("mapbox://gl-styles/")&&(util.log("Incorrectly formatted Mapbox style at "+t),this.fire("error"));var e=t.split("mapbox://gl-styles/")[1];return format_url("/gl-styles/v1/"+e+"/tiles/{z}/{x}/{y}"+i,this.options.accessToken)}return"object"==typeof t?format_url("/gl-styles/v1/"+t.owner+"/"+t.id+"/tiles/{z}/{x}/{y}"+i,this.options.accessToken):void 0},getTileUrl:function(t){var i=L.Util.template(this.options.tiles,t);return i}});module.exports.StyleLayer=StyleLayer,module.exports.styleLayer=function(t,i){return new StyleLayer(t,i)};
|
||||||
},{"./format_url":11,"./request":26,"./util":31,"sanitize-caja":5}],30:[function(require,module,exports){
|
},{"./format_url":11,"./request":26,"./util":31,"sanitize-caja":5}],30:[function(require,module,exports){
|
||||||
"use strict";var util=require("./util"),formatPattern=/\.((?:png|jpg)\d*)(?=$|\?)/,TileLayer=L.TileLayer.extend({includes:[require("./load_tilejson")],options:{sanitizer:require("sanitize-caja")},formats:["png","jpg","png32","png64","png128","png256","jpg70","jpg80","jpg90"],scalePrefix:"@2x.",initialize:function(t,i){L.TileLayer.prototype.initialize.call(this,void 0,i),this._tilejson={},i&&i.format&&util.strict_oneof(i.format,this.formats),this._loadTileJSON(t)},setFormat:function(t){return util.strict(t,"string"),this.options.format=t,this.redraw(),this},setUrl:null,_setTileJSON:function(t){return util.strict(t,"object"),this.options.format=this.options.format||t.tiles[0].match(formatPattern)[1],L.extend(this.options,{tiles:t.tiles,attribution:this.options.sanitizer(t.attribution),minZoom:t.minzoom||0,maxZoom:t.maxzoom||18,tms:"tms"===t.scheme,bounds:t.bounds&&util.lbounds(t.bounds)}),this._tilejson=t,this.redraw(),this},getTileJSON:function(){return this._tilejson},getTileUrl:function(t){var i=this.options.tiles,e=Math.floor(Math.abs(t.x+t.y)%i.length),o=i[e],r=L.Util.template(o,t);return r?r.replace(formatPattern,(L.Browser.retina?this.scalePrefix:".")+this.options.format):r},_update:function(){this.options.tiles&&L.TileLayer.prototype._update.call(this)}});module.exports.TileLayer=TileLayer,module.exports.tileLayer=function(t,i){return new TileLayer(t,i)};
|
"use strict";var util=require("./util"),formatPattern=/\.((?:png|jpg)\d*)(?=$|\?)/,TileLayer=L.TileLayer.extend({includes:[require("./load_tilejson")],options:{sanitizer:require("sanitize-caja")},formats:["png","jpg","png32","png64","png128","png256","jpg70","jpg80","jpg90"],scalePrefix:"@2x.",initialize:function(t,i){L.TileLayer.prototype.initialize.call(this,void 0,i),this._tilejson={},i&&i.format&&util.strict_oneof(i.format,this.formats),this._loadTileJSON(t)},setFormat:function(t){return util.strict(t,"string"),this.options.format=t,this.redraw(),this},setUrl:null,_setTileJSON:function(t){return util.strict(t,"object"),this.options.format=this.options.format||t.tiles[0].match(formatPattern)[1],L.extend(this.options,{tiles:t.tiles,attribution:this.options.sanitizer(t.attribution),minZoom:t.minzoom||0,maxZoom:t.maxzoom||18,tms:"tms"===t.scheme,bounds:t.bounds&&util.lbounds(t.bounds)}),this._tilejson=t,this.redraw(),this},getTileJSON:function(){return this._tilejson},getTileUrl:function(t){var i=this.options.tiles,e=Math.floor(Math.abs(t.x+t.y)%i.length),o=i[e],r=L.Util.template(o,t);return r?r.replace(formatPattern,(L.Browser.retina?this.scalePrefix:".")+this.options.format):r},_update:function(){this.options.tiles&&L.TileLayer.prototype._update.call(this)}});module.exports.TileLayer=TileLayer,module.exports.tileLayer=function(t,i){return new TileLayer(t,i)};
|
||||||
},{"./load_tilejson":21,"./util":31,"sanitize-caja":5}],31:[function(require,module,exports){
|
},{"./load_tilejson":21,"./util":31,"sanitize-caja":5}],31:[function(require,module,exports){
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
sources: {
|
sources: {
|
||||||
'vector_layer_': {
|
'vector_layer_': {
|
||||||
type: 'vector',
|
type: 'vector',
|
||||||
url: '/data/{{id}}.json{{&key_query}}'
|
url: '/mbtiles/{{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', '/mbtiles/{{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 = '.';
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
{{#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="/gl-styles/{{@key}}/{{thumbnail}}{{&../key_query}}" alt="{{name}} preview" />
|
||||||
{{else}}
|
{{else}}
|
||||||
<img src="/images/placeholder.png" alt="{{name}} preview" />
|
<img src="/images/placeholder.png" alt="{{name}} preview" />
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -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="/gl-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="/gl-styles/{{@key}}.json{{&../key_query}}">TileJSON</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#if serving_rendered}}
|
{{#if serving_rendered}}
|
||||||
| <a href="/styles/{{@key}}/wmts.xml{{&../key_query}}">WMTS</a>
|
| <a href="/gl-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="/gl-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="/gl-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="/gl-styles/{{@key}}/?{{&../key_query_part}}vector{{viewer_hash}}">Vector</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -72,7 +72,7 @@
|
||||||
{{#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="/mbtiles/{{@key}}/{{thumbnail}}{{&../key_query}}" alt="{{name}} preview" />
|
||||||
{{else}}
|
{{else}}
|
||||||
<img src="/images/placeholder.png" alt="{{name}} preview" />
|
<img src="/images/placeholder.png" alt="{{name}} preview" />
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
@ -80,7 +80,7 @@
|
||||||
<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="/mbtiles/{{@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="/mbtiles/{{@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="/mbtiles/{{@key}}/{{&../key_query}}{{viewer_hash}}">View</a>
|
||||||
{{/is_vector}}
|
{{/is_vector}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,12 @@
|
||||||
mapboxgl.setRTLTextPlugin('/mapbox-gl-rtl-text.js{{&key_query}}');
|
mapboxgl.setRTLTextPlugin('/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: '/gl-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', '/gl-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);
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
<ows:Operation name="GetTile">
|
<ows:Operation name="GetTile">
|
||||||
<ows:DCP>
|
<ows:DCP>
|
||||||
<ows:HTTP>
|
<ows:HTTP>
|
||||||
<ows:Get xlink:href="{{baseUrl}}/styles/">
|
<ows:Get xlink:href="{{baseUrl}}/gl-styles/">
|
||||||
<ows:Constraint name="GetEncoding">
|
<ows:Constraint name="GetEncoding">
|
||||||
<ows:AllowedValues>
|
<ows:AllowedValues>
|
||||||
<ows:Value>RESTful</ows:Value>
|
<ows:Value>RESTful</ows:Value>
|
||||||
|
|
@ -50,7 +50,7 @@
|
||||||
<TileMatrixSetLink>
|
<TileMatrixSetLink>
|
||||||
<TileMatrixSet>GoogleMapsCompatible</TileMatrixSet>
|
<TileMatrixSet>GoogleMapsCompatible</TileMatrixSet>
|
||||||
</TileMatrixSetLink>
|
</TileMatrixSetLink>
|
||||||
<ResourceURL format="image/png" resourceType="tile" template="{{baseUrl}}/styles/{{id}}/{TileMatrix}/{TileCol}/{TileRow}.png{{key_query}}"/>
|
<ResourceURL format="image/png" resourceType="tile" template="{{baseUrl}}/gl-styles/{{id}}/{TileMatrix}/{TileCol}/{TileRow}.png{{key_query}}"/>
|
||||||
</Layer><TileMatrixSet>
|
</Layer><TileMatrixSet>
|
||||||
<ows:Title>GoogleMapsCompatible</ows:Title>
|
<ows:Title>GoogleMapsCompatible</ows:Title>
|
||||||
<ows:Abstract>GoogleMapsCompatible EPSG:3857</ows:Abstract>
|
<ows:Abstract>GoogleMapsCompatible EPSG:3857</ows:Abstract>
|
||||||
|
|
|
||||||
|
|
@ -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, {
|
'mbtiles/' + id, info.format, {
|
||||||
'pbf': options.pbfAlias
|
'pbf': options.pbfAlias
|
||||||
});
|
});
|
||||||
return res.send(info);
|
return res.send(info);
|
||||||
|
|
|
||||||
|
|
@ -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);
|
'gl-styles/' + id, info.format);
|
||||||
return res.send(info);
|
return res.send(info);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ module.exports = function(options, repo, params, id, reportTiles, reportFont) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var identifier = reportTiles(mbtilesFile, fromData);
|
var identifier = reportTiles(mbtilesFile, fromData);
|
||||||
source.url = 'local://data/' + identifier + '.json';
|
source.url = 'local://mbtiles/' + identifier + '.json';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -54,7 +54,7 @@ module.exports = function(options, repo, params, id, reportTiles, reportFont) {
|
||||||
.replace('{style}', path.basename(styleFile, '.json'))
|
.replace('{style}', path.basename(styleFile, '.json'))
|
||||||
.replace('{styleJsonFolder}', path.relative(options.paths.sprites, path.dirname(styleFile)))
|
.replace('{styleJsonFolder}', path.relative(options.paths.sprites, path.dirname(styleFile)))
|
||||||
);
|
);
|
||||||
styleJSON.sprite = 'local://styles/' + id + '/sprite';
|
styleJSON.sprite = 'local://gl-styles/' + id + '/sprite';
|
||||||
}
|
}
|
||||||
if (styleJSON.glyphs && !httpTester.test(styleJSON.glyphs)) {
|
if (styleJSON.glyphs && !httpTester.test(styleJSON.glyphs)) {
|
||||||
styleJSON.glyphs = 'local://fonts/{fontstack}/{range}.pbf';
|
styleJSON.glyphs = 'local://fonts/{fontstack}/{range}.pbf';
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ function start(opts) {
|
||||||
}, function(font) {
|
}, function(font) {
|
||||||
serving.fonts[font] = true;
|
serving.fonts[font] = true;
|
||||||
}).then(function(sub) {
|
}).then(function(sub) {
|
||||||
app.use('/styles/', sub);
|
app.use('/gl-styles/', sub);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
if (item.serve_rendered !== false) {
|
if (item.serve_rendered !== false) {
|
||||||
|
|
@ -159,7 +159,7 @@ function start(opts) {
|
||||||
return mbtilesFile;
|
return mbtilesFile;
|
||||||
}
|
}
|
||||||
).then(function(sub) {
|
).then(function(sub) {
|
||||||
app.use('/styles/', sub);
|
app.use('/gl-styles/', sub);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -183,7 +183,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).then(function(sub) {
|
||||||
app.use('/data/', sub);
|
app.use('/mbtiles/', sub);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
@ -198,7 +198,7 @@ function start(opts) {
|
||||||
name: styleJSON.name,
|
name: styleJSON.name,
|
||||||
id: id,
|
id: id,
|
||||||
url: req.protocol + '://' + req.headers.host +
|
url: req.protocol + '://' + req.headers.host +
|
||||||
'/styles/' + id + '/style.json' + query
|
'/gl-styles/' + id + '/style.json' + query
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
res.send(result);
|
res.send(result);
|
||||||
|
|
@ -209,7 +209,7 @@ function start(opts) {
|
||||||
var info = clone(serving[type][id]);
|
var info = clone(serving[type][id]);
|
||||||
var path = '';
|
var path = '';
|
||||||
if (type == 'rendered') {
|
if (type == 'rendered') {
|
||||||
path = 'styles/' + id;
|
path = 'gl-styles/' + id;
|
||||||
} else {
|
} else {
|
||||||
path = type + '/' + id;
|
path = type + '/' + id;
|
||||||
}
|
}
|
||||||
|
|
@ -298,7 +298,7 @@ function start(opts) {
|
||||||
|
|
||||||
var tiles = utils.getTileUrls(
|
var tiles = utils.getTileUrls(
|
||||||
req, style.serving_rendered.tiles,
|
req, style.serving_rendered.tiles,
|
||||||
'styles/' + id, style.serving_rendered.format);
|
'gl-styles/' + id, style.serving_rendered.format);
|
||||||
style.xyz_link = tiles[0];
|
style.xyz_link = tiles[0];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -321,7 +321,7 @@ function start(opts) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var tiles = utils.getTileUrls(
|
var tiles = utils.getTileUrls(
|
||||||
req, data_.tiles, 'data/' + id, data_.format, {
|
req, data_.tiles, 'mbtiles/' + id, data_.format, {
|
||||||
'pbf': options.pbfAlias
|
'pbf': options.pbfAlias
|
||||||
});
|
});
|
||||||
data_.xyz_link = tiles[0];
|
data_.xyz_link = tiles[0];
|
||||||
|
|
@ -346,7 +346,7 @@ function start(opts) {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
serveTemplate('/styles/:id/$', 'viewer', function(req) {
|
serveTemplate('/gl-styles/:id/$', 'viewer', function(req) {
|
||||||
var id = req.params.id;
|
var id = req.params.id;
|
||||||
var style = clone((config.styles || {})[id]);
|
var style = clone((config.styles || {})[id]);
|
||||||
if (!style) {
|
if (!style) {
|
||||||
|
|
@ -361,10 +361,10 @@ function start(opts) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
app.use('/rendered/:id/$', function(req, res, next) {
|
app.use('/rendered/:id/$', function(req, res, next) {
|
||||||
return res.redirect(301, '/styles/' + req.params.id + '/');
|
return res.redirect(301, '/gl-styles/' + req.params.id + '/');
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
serveTemplate('/styles/:id/wmts.xml', 'wmts', function(req) {
|
serveTemplate('/gl-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) {
|
||||||
|
|
@ -379,7 +379,7 @@ function start(opts) {
|
||||||
return wmts;
|
return wmts;
|
||||||
});
|
});
|
||||||
|
|
||||||
serveTemplate('/data/:id/$', 'data', function(req) {
|
serveTemplate('/mbtiles/:id/$', 'data', function(req) {
|
||||||
var id = req.params.id;
|
var id = req.params.id;
|
||||||
var data = clone(serving.data[id]);
|
var data = clone(serving.data[id]);
|
||||||
if (!data) {
|
if (!data) {
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,6 @@ describe('Metadata', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
testTileJSON('/styles/test-style.json');
|
testTileJSON('/gl-styles/test-style.json');
|
||||||
testTileJSON('/data/openmaptiles.json');
|
testTileJSON('/mbtiles/openmaptiles.json');
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
var testStatic = function(prefix, q, format, status, scale, type, query) {
|
var testStatic = function(prefix, q, format, status, scale, type, query) {
|
||||||
if (scale) q += '@' + scale + 'x';
|
if (scale) q += '@' + scale + 'x';
|
||||||
var path = '/styles/' + prefix + '/static/' + q + '.' + format;
|
var path = '/gl-styles/' + prefix + '/static/' + q + '.' + format;
|
||||||
if (query) {
|
if (query) {
|
||||||
path += query;
|
path += query;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,12 +11,12 @@ var testIs = function(url, type, status) {
|
||||||
var prefix = 'test-style';
|
var prefix = 'test-style';
|
||||||
|
|
||||||
describe('Styles', function() {
|
describe('Styles', function() {
|
||||||
describe('/styles/' + prefix + '/style.json is valid style', function() {
|
describe('/gl-styles/' + prefix + '/style.json is valid style', function() {
|
||||||
testIs('/styles/' + prefix + '/style.json', /application\/json/);
|
testIs('/gl-styles/' + prefix + '/style.json', /application\/json/);
|
||||||
|
|
||||||
it('contains expected properties', function(done) {
|
it('contains expected properties', function(done) {
|
||||||
supertest(app)
|
supertest(app)
|
||||||
.get('/styles/' + prefix + '/style.json')
|
.get('/gl-styles/' + prefix + '/style.json')
|
||||||
.expect(function(res) {
|
.expect(function(res) {
|
||||||
res.body.version.should.equal(8);
|
res.body.version.should.equal(8);
|
||||||
res.body.name.should.be.String();
|
res.body.name.should.be.String();
|
||||||
|
|
@ -27,15 +27,15 @@ describe('Styles', function() {
|
||||||
}).end(done);
|
}).end(done);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('/styles/streets/style.json is not served', function() {
|
describe('/gl-styles/streets/style.json is not served', function() {
|
||||||
testIs('/styles/streets/style.json', /./, 404);
|
testIs('/gl-styles/streets/style.json', /./, 404);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('/styles/' + prefix + '/sprite[@2x].{format}', function() {
|
describe('/gl-styles/' + prefix + '/sprite[@2x].{format}', function() {
|
||||||
testIs('/styles/' + prefix + '/sprite.json', /application\/json/);
|
testIs('/gl-styles/' + prefix + '/sprite.json', /application\/json/);
|
||||||
testIs('/styles/' + prefix + '/sprite@2x.json', /application\/json/);
|
testIs('/gl-styles/' + prefix + '/sprite@2x.json', /application\/json/);
|
||||||
testIs('/styles/' + prefix + '/sprite.png', /image\/png/);
|
testIs('/gl-styles/' + prefix + '/sprite.png', /image\/png/);
|
||||||
testIs('/styles/' + prefix + '/sprite@2x.png', /image\/png/);
|
testIs('/gl-styles/' + prefix + '/sprite@2x.png', /image\/png/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
var testTile = function(prefix, z, x, y, status) {
|
var testTile = function(prefix, z, x, y, status) {
|
||||||
var path = '/data/' + prefix + '/' + z + '/' + x + '/' + y + '.pbf';
|
var path = '/mbtiles/' + prefix + '/' + z + '/' + x + '/' + y + '.pbf';
|
||||||
it(path + ' returns ' + status, function(done) {
|
it(path + ' returns ' + status, function(done) {
|
||||||
var test = supertest(app).get(path);
|
var test = supertest(app).get(path);
|
||||||
if (status) test.expect(status);
|
if (status) test.expect(status);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
var testTile = function(prefix, z, x, y, format, status, scale, type) {
|
var testTile = function(prefix, z, x, y, format, status, scale, type) {
|
||||||
if (scale) y += '@' + scale + 'x';
|
if (scale) y += '@' + scale + 'x';
|
||||||
var path = '/styles/' + prefix + '/' + z + '/' + x + '/' + y + '.' + format;
|
var path = '/gl-styles/' + prefix + '/' + z + '/' + x + '/' + y + '.' + format;
|
||||||
it(path + ' returns ' + status, function(done) {
|
it(path + ' returns ' + status, function(done) {
|
||||||
var test = supertest(app).get(path);
|
var test = supertest(app).get(path);
|
||||||
test.expect(status);
|
test.expect(status);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue