From 4bb2f6c1f548af2149061aaff1107f30b2de299f Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Sat, 15 Jul 2017 16:14:54 +0200 Subject: [PATCH 1/2] Use de-facto standard 512px tile size for vectortile layers --- examples/mapbox-vector-tiles.js | 4 ++-- examples/osm-vector-tiles.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/mapbox-vector-tiles.js b/examples/mapbox-vector-tiles.js index eaa3261388..32e6354ea8 100644 --- a/examples/mapbox-vector-tiles.js +++ b/examples/mapbox-vector-tiles.js @@ -23,8 +23,8 @@ var map = new ol.Map({ '© ' + 'OpenStreetMap contributors', format: new ol.format.MVT(), - tileGrid: ol.tilegrid.createXYZ({maxZoom: 22}), - tilePixelRatio: 16, + tileGrid: ol.tilegrid.createXYZ({tileSize: 512, maxZoom: 22}), + tilePixelRatio: 8, url: 'https://{a-d}.tiles.mapbox.com/v4/mapbox.mapbox-streets-v6/' + '{z}/{x}/{y}.vector.pbf?access_token=' + key }), diff --git a/examples/osm-vector-tiles.js b/examples/osm-vector-tiles.js index 6df8ba0460..fa837c2a18 100644 --- a/examples/osm-vector-tiles.js +++ b/examples/osm-vector-tiles.js @@ -70,7 +70,7 @@ var map = new ol.Map({ layerName: 'layer', layers: ['water', 'roads', 'buildings'] }), - tileGrid: ol.tilegrid.createXYZ({maxZoom: 19}), + tileGrid: ol.tilegrid.createXYZ({tileSize: 512, maxZoom: 19}), url: 'https://tile.mapzen.com/mapzen/vector/v1/all/{z}/{x}/{y}.topojson?api_key=' + key }), style: function(feature, resolution) { From e79a4dd006c4c61ed550bf7ae89cc515d5286e42 Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Sat, 15 Jul 2017 16:15:14 +0200 Subject: [PATCH 2/2] Fix resolution creation function --- examples/mapbox-vector-tiles-advanced.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/mapbox-vector-tiles-advanced.js b/examples/mapbox-vector-tiles-advanced.js index 3dfc4950c5..3fa9e6f3fe 100644 --- a/examples/mapbox-vector-tiles-advanced.js +++ b/examples/mapbox-vector-tiles-advanced.js @@ -17,7 +17,7 @@ var key = 'pk.eyJ1IjoiYWhvY2V2YXIiLCJhIjoiRk1kMWZaSSJ9.E5BkluenyWQMsBLsuByrmg'; // Calculation of resolutions that match zoom levels 1, 3, 5, 7, 9, 11, 13, 15. var resolutions = []; -for (var i = 0; i <= 7; ++i) { +for (var i = 0; i <= 8; ++i) { resolutions.push(156543.03392804097 / Math.pow(2, i * 2)); } // Calculation of tile urls for zoom levels 1, 3, 5, 7, 9, 11, 13, 15.