diff --git a/examples/mapbox-vector-tiles-simple.html b/examples/mapbox-vector-tiles-simple.html index 36da8db103..9a9d32764a 100644 --- a/examples/mapbox-vector-tiles-simple.html +++ b/examples/mapbox-vector-tiles-simple.html @@ -7,6 +7,8 @@ docs: > tags: "simple, mapbox, vector, tiles" resources: - resources/mapbox-streets-v6-style.js +cloak: + pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg: Your Mapbox access token from http://mapbox.com/ here ---
diff --git a/examples/mapbox-vector-tiles-simple.js b/examples/mapbox-vector-tiles-simple.js index 3d68525c4d..783e2462af 100644 --- a/examples/mapbox-vector-tiles-simple.js +++ b/examples/mapbox-vector-tiles-simple.js @@ -11,9 +11,7 @@ goog.require('ol.style.Style'); goog.require('ol.style.Text'); -// Mapbox access token - request your own at http://mapbox.com -var accessToken = - 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg'; +var key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg'; var map = new ol.Map({ layers: [ @@ -28,7 +26,7 @@ var map = new ol.Map({ tileGrid: ol.tilegrid.createXYZ({maxZoom: 22}), tilePixelRatio: 16, url: 'http://{a-d}.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/' + - '{z}/{x}/{y}.vector.pbf?access_token=' + accessToken + '{z}/{x}/{y}.vector.pbf?access_token=' + key }), style: createMapboxStreetsV6Style() }) diff --git a/examples/mapbox-vector-tiles.html b/examples/mapbox-vector-tiles.html index c7cb0b45d3..12aa0017fc 100644 --- a/examples/mapbox-vector-tiles.html +++ b/examples/mapbox-vector-tiles.html @@ -3,10 +3,12 @@ template: example.html title: Mapbox vector tiles example shortdesc: Example of a Mapbox vector tiles map. docs: > - A vector tiles map which reuses the same tiles for subsequent zoom levels to save bandwith on mobile devices. **Note**: Make sure to get your own Mapbox API key when using this example. No map will be visible when the API key has expired. + A vector tiles map which reuses the same tiles for subsequent zoom levels to save bandwith on mobile devices. **Note**: No map will be visible when the access token has expired. tags: "simple, mapbox, vector, tiles" resources: - resources/mapbox-streets-v6-style.js +cloak: + pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg: Your Mapbox access token from http://mapbox.com/ here ---
diff --git a/examples/mapbox-vector-tiles.js b/examples/mapbox-vector-tiles.js index 97529fd143..aaa0736fcc 100644 --- a/examples/mapbox-vector-tiles.js +++ b/examples/mapbox-vector-tiles.js @@ -13,9 +13,7 @@ goog.require('ol.style.Text'); goog.require('ol.tilegrid.TileGrid'); -// Mapbox access token - request your own at http://mapbox.com -var accessToken = - 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg'; +var key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg'; // For how many zoom levels do we want to use the same vector tiles? // 1 means "use tiles from all zoom levels". 2 means "use the same tiles for 2 @@ -34,7 +32,7 @@ for (var z = zoomOffset / reuseZoomLevels; z <= 22 / reuseZoomLevels; ++z) { } function tileUrlFunction(tileCoord) { return ('http://{a-d}.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/' + - '{z}/{x}/{y}.vector.pbf?access_token=' + accessToken) + '{z}/{x}/{y}.vector.pbf?access_token=' + key) .replace('{z}', String(tileCoord[0] * reuseZoomLevels + zoomOffset)) .replace('{x}', String(tileCoord[1])) .replace('{y}', String(-tileCoord[2] - 1))