From ac27cbd67d944d1f2f20ca9422b7392cc8dcafeb Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Sun, 22 Jul 2018 02:50:49 -0400 Subject: [PATCH] Add support for 512px Mapbox Satellite tiles The tiler and projection are still not aware of the 512px size. This results in fetching 512px images but placing them in the 256px slippy map and scalling them down. (This is dumb but at least they look nicer than before) --- data/imagery.json | 104 ++++++++++++++++++++++++++++++++- data/update_imagery.js | 9 ++- modules/renderer/tile_layer.js | 3 +- 3 files changed, 113 insertions(+), 3 deletions(-) diff --git a/data/imagery.json b/data/imagery.json index 8716aaeca..b1c9998e8 100644 --- a/data/imagery.json +++ b/data/imagery.json @@ -38932,6 +38932,107 @@ "terms_url": "http://data2.loire-atlantique.fr/licences/", "terms_text": "Département de Loire-Atlantique" }, + { + "id": "Loire_Atlantique-Orthophotos-2016", + "name": "Loire-Atlantique - Orthophotos 2016 - 10 cm", + "type": "wms", + "template": "https://wms-vuduciel2.makina-corpus.net/geoserver/wms?SERVICE=WMS&FORMAT=image/jpeg&VERSION=1.1.1&SERVICE=WMS&REQUEST=GetMap&LAYERS=cg44:ortho44-2016&STYLES=&SRS={proj}&WIDTH={width}&HEIGHT={height}&BBOX={bbox}", + "projection": "EPSG:3857", + "endDate": "2016-01-01T00:00:00.000Z", + "startDate": "2016-01-01T00:00:00.000Z", + "zoomExtent": [0, 20], + "polygon": [ + [ + [-1.48638, 46.87691], + [-1.54437, 46.84873], + [-1.73468, 46.87246], + [-1.89276, 46.94234], + [-1.95475, 46.98084], + [-2.07067, 47.08521], + [-2.2678, 47.12656], + [-2.22627, 47.17124], + [-2.19217, 47.16914], + [-2.19341, 47.25546], + [-2.29694, 47.22769], + [-2.41658, 47.25336], + [-2.54862, 47.28575], + [-2.63913, 47.41678], + [-2.50573, 47.50812], + [-2.31063, 47.53021], + [-2.24836, 47.52384], + [-2.23223, 47.51499], + [-2.12109, 47.54674], + [-2.11783, 47.60126], + [-2.1001, 47.61123], + [-2.09981, 47.62005], + [-2.11141, 47.62873], + [-2.10055, 47.65141], + [-2.08121, 47.66578], + [-1.98016, 47.70751], + [-1.83077, 47.72419], + [-1.67455, 47.72544], + [-1.63735, 47.77463], + [-1.49601, 47.81752], + [-1.49911, 47.84166], + [-1.38133, 47.84415], + [-1.346, 47.81086], + [-1.23007, 47.78587], + [-1.21643, 47.75838], + [-1.22635, 47.73628], + [-1.21086, 47.7317], + [-1.18668, 47.73462], + [-1.15196, 47.69332], + [-1.13151, 47.63654], + [-1.09121, 47.6332], + [-0.99265, 47.6027], + [-0.98459, 47.58598], + [-1.0317, 47.55001], + [-1.13585, 47.55628], + [-1.13275, 47.5161], + [-1.0317, 47.51778], + [-0.94863, 47.50103], + [-0.93686, 47.47715], + [-0.93376, 47.43859], + [-0.9009, 47.39874], + [-0.92694, 47.37482], + [-0.97157, 47.35845], + [-1.28339, 47.32736], + [-1.23379, 47.26093], + [-1.20032, 47.26935], + [-1.16498, 47.24957], + [-1.14143, 47.1763], + [-1.1563, 47.15818], + [-1.20652, 47.12402], + [-1.20838, 47.10968], + [-1.15568, 47.10504], + [-1.14081, 47.08056], + [-1.09431, 47.0717], + [-1.09989, 47.03199], + [-1.14453, 47.01636], + [-1.21582, 47.02904], + [-1.26727, 47.06325], + [-1.28524, 47.02185], + [-1.34972, 47.02397], + [-1.33918, 46.969], + [-1.3491, 46.94446], + [-1.45014, 46.91186], + [-1.47504, 46.9176], + [-1.48775, 46.93063], + [-1.49235, 46.98433], + [-1.48644, 46.99943], + [-1.49213, 47.02722], + [-1.52764, 47.00541], + [-1.52961, 46.97252], + [-1.50507, 46.94439], + [-1.50222, 46.92973], + [-1.51142, 46.91371], + [-1.48622, 46.89724], + [-1.48638, 46.87691] + ] + ], + "terms_url": "http://data2.loire-atlantique.fr/licences/", + "terms_text": "© Loire-Atlantique ouverture des données publiques" + }, { "id": "Lombardia-Italy-CTR-DBT", "name": "Lombardia - Italy (CTR DBT)", @@ -40343,7 +40444,8 @@ "id": "Mapbox", "name": "Mapbox Satellite", "type": "tms", - "template": "https://{switch:a,b,c,d}.tiles.mapbox.com/v4/mapbox.satellite/{zoom}/{x}/{y}.jpg?access_token=pk.eyJ1Ijoib3BlbnN0cmVldG1hcCIsImEiOiJjaml5MjVyb3MwMWV0M3hxYmUzdGdwbzE4In0.q548FjhsSJzvXsGlPsFxAQ", + "template": "https://{switch:a,b,c,d}.tiles.mapbox.com/v4/mapbox.satellite/{zoom}/{x}/{y}@2x.jpg?access_token=pk.eyJ1Ijoib3BlbnN0cmVldG1hcCIsImEiOiJjaml5MjVyb3MwMWV0M3hxYmUzdGdwbzE4In0.q548FjhsSJzvXsGlPsFxAQ", + "tileSize": 512, "zoomExtent": [0, 22], "terms_url": "https://www.mapbox.com/about/maps", "terms_text": "Terms & Feedback", diff --git a/data/update_imagery.js b/data/update_imagery.js index fbf604950..4375f5d3f 100644 --- a/data/update_imagery.js +++ b/data/update_imagery.js @@ -91,6 +91,13 @@ sources.concat(whitelist).forEach(function(source) { template: source.url }; + + // supports 512px tiles + if (source.id === 'Mapbox') { + im.template = im.template.replace('.jpg', '@2x.jpg'); + im.tileSize = 512; + } + if (source.type === 'wms') { im.projection = supportedProjection; } @@ -149,7 +156,7 @@ sources.concat(whitelist).forEach(function(source) { im.terms_html = attribution.html; } - ['best', 'default', 'description', 'icon', 'overlay'].forEach(function(a) { + ['best', 'default', 'description', 'icon', 'overlay', 'tileSize'].forEach(function(a) { if (source[a]) { im[a] = source[a]; } diff --git a/modules/renderer/tile_layer.js b/modules/renderer/tile_layer.js index 03af506d6..454e71400 100644 --- a/modules/renderer/tile_layer.js +++ b/modules/renderer/tile_layer.js @@ -272,7 +272,8 @@ export function rendererTileLayer(context) { _source = _; _tileSize = _source.tileSize; _cache = {}; - tiler.tileSize(_source.tileSize).zoomExtent(_source.zoomExtent); + // tiler.tileSize(_source.tileSize).zoomExtent(_source.zoomExtent); // not yet + tiler.zoomExtent(_source.zoomExtent); return background; };