From 482b5b482aa42e66f30338338faf03b215ef7ea1 Mon Sep 17 00:00:00 2001 From: Albert Fisas Date: Thu, 7 May 2015 00:04:31 +0200 Subject: [PATCH] Added Max Zoom 20 for all maps. Issue #1 --- web/assets/js/site.js | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/web/assets/js/site.js b/web/assets/js/site.js index 2a502ad..7056038 100644 --- a/web/assets/js/site.js +++ b/web/assets/js/site.js @@ -14,64 +14,76 @@ var attribution = 'Datos © Colaboradores Equipo Humanitario OpenStreetMap' + attribution: 'Teselas Equipo Humanitario OpenStreetMap', + zoom: '20' }, osmfr: { name: 'OSM Francia', url: 'http://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', - attribution: 'Teselas OpenStreetMap Francia' + attribution: 'Teselas OpenStreetMap Francia', + zoom: '20' }, cycle: { name: 'Bicicleta', url: 'http://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png', - attribution: 'Teselas ThunderForest' + attribution: 'Teselas ThunderForest', + zoom: '18' }, transport: { name: 'Transporte Público', url: 'http://{s}.tile.thunderforest.com/transport/{z}/{x}/{y}.png', - attribution: 'Teselas ThunderForest' + attribution: 'Teselas ThunderForest', + zoom: '20' }, landscape: { name: 'Paisaje', url: 'http://{s}.tile.thunderforest.com/landscape/{z}/{x}/{y}.png', - attribution: 'Teselas ThunderForest' + attribution: 'Teselas ThunderForest', + zoom: '18' }, outdoor: { name: 'Al Aire Libre', url: 'http://{s}.tile.thunderforest.com/outdoors/{z}/{x}/{y}.png', - attribution: 'Teselas ThunderForest' + attribution: 'Teselas ThunderForest', + zoom: '18' }, lyrk: { name: 'Lyrk', url: 'http://tiles.lyrk.org/ls/{z}/{x}/{y}?apikey=3d836013a4ab468f965bfd1328d89522', - attribution: 'Teselas Lyrk' + attribution: 'Teselas Lyrk', + zoom: '18' }, mapbox: { name: 'MapBox (Calles)', url: 'http://{s}.tiles.mapbox.com/v3/51114u9.kogin3jb/{z}/{x}/{y}.png', - attribution: 'Teselas MapBox' + attribution: 'Teselas MapBox', + zoom: '19' }, mapquest: { name: 'MapQuest Open', url: 'http://otile{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png', attribution: 'Teselas MapQuest', - subdomains: '123' + subdomains: '123', + zoom: '18' }, mapsurfer: { name: 'OpenMapSurfer', url: 'http://openmapsurfer.uni-hd.de/tiles/roads/x={x}&y={y}&z={z}', - attribution: 'Teselas GIScience Research Group @ Heidelberg University' + attribution: 'Teselas GIScience Research Group @ Heidelberg University', + zoom: '19' } }; var tileLayers = {}; for (tile in tileLayerData) { var tileAttribution; + var tilemaxZoom = tileLayerData[tile].zoom; var subdomains = tileLayerData[tile].subdomains ? tileLayerData[tile].subdomains : 'abc'; if (tileLayerData[tile].attribution) { tileAttribution = tileLayerData[tile].attribution + ' — ' + attribution; @@ -80,13 +92,14 @@ for (tile in tileLayerData) { tileLayers[tileLayerData[tile].name] = L.tileLayer( tileLayerData[tile].url, - {attribution: tileAttribution, subdomains: subdomains} + {maxNativeZoom: tilemaxZoom, maxZoom: 20, attribution: tileAttribution, subdomains: subdomains} ) } tileLayers['Estándar (Mapnik)'].addTo(map); L.control.layers(tileLayers).addTo(map); + // https://github.com/perliedman/leaflet-control-geocoder var geocoder = L.Control.geocoder({ position: 'topleft',