Commit 33e91804 authored by Elena Grassi's avatar Elena Grassi
Browse files

Map config section refactored to manage also wms tiles sources

WARNING: when this will be merged all map config sections should be adapted (instead of two strings
we are now using the complete config used by the angular leaflet directive and in flmap
look at the type to use the right L.tileLayer function.
parent 425bbe57
......@@ -1377,11 +1377,27 @@
}
},
"map": {
"tile_view": "https://api.mapbox.com/styles/v1/drp0ll0/cizl1thgs000u2ro17h1cv4y2/tiles/256/{z}/{x}/{y}@2x?access_token=pk.eyJ1IjoiZHJwMGxsMCIsImEiOiI4bUpPVm9JIn0.NCRmAUzSfQ_fT3A86d9RvQ",
"tile_view_attribution": "<a target='_blank' href='http://mapbox.com/'>©Mapbox</a> | OpenStreetMap contributors",
"tile_edit": "https://api.mapbox.com/styles/v1/drp0ll0/cizl1sb0l000t2ro16uptawtf/tiles/256/{z}/{x}/{y}@2x?access_token=pk.eyJ1IjoiZHJwMGxsMCIsImEiOiI4bUpPVm9JIn0.NCRmAUzSfQ_fT3A86d9RvQ",
"tile_edit_attribution": "<a target='_blank' href='http://mapbox.com/'>©Mapbox</a> | OpenStreetMap contributors",
"tile_vector": "https://tiles.firstlife.org/tile/{z}/{x}/{y}",
"tile_view" : {
"url": "https://api.mapbox.com/styles/v1/drp0ll0/cizl1thgs000u2ro17h1cv4y2/tiles/256/{z}/{x}/{y}@2x?access_token=pk.eyJ1IjoiZHJwMGxsMCIsImEiOiI4bUpPVm9JIn0.NCRmAUzSfQ_fT3A86d9RvQ",
"name": "view",
"type": "xyz",
"visible": true,
"layerOptions": {
"attribution": "<a target='_blank' href='http://mapbox.com/'>©Mapbox</a> | OpenStreetMap contributors",
"keepBuffer": 0
}
},
"tile_edit" : {
"url": "https://api.mapbox.com/styles/v1/drp0ll0/cizl1sb0l000t2ro16uptawtf/tiles/256/{z}/{x}/{y}@2x?access_token=pk.eyJ1IjoiZHJwMGxsMCIsImEiOiI4bUpPVm9JIn0.NCRmAUzSfQ_fT3A86d9RvQ",
"name": "edit",
"type": "xyz",
"visible": false,
"layerOptions": {
"attribution": "<a target='_blank' href='http://mapbox.com/'>©Mapbox</a> | OpenStreetMap contributors",
"keepBuffer": 0
}
},
"map_default_lat": 45.070312,
"map_default_lng": 7.686856,
"map_autocenter": false,
......
......@@ -34,8 +34,27 @@
"aroundYears": 20
},
"map": {
"tile_edit": "https://api.mapbox.com/styles/v1/drp0ll0/cizl1thgs000u2ro17h1cv4y2/tiles/256/{z}/{x}/{y}@2x?access_token=pk.eyJ1IjoiZHJwMGxsMCIsImEiOiI4bUpPVm9JIn0.NCRmAUzSfQ_fT3A86d9RvQ",
"tile_edit_attribution": "<a target='_blank' href='http://mapbox.com/'>©Mapbox</a> | OpenStreetMap contributors",
"tile_view": {
"type": "wms",
"url": "http://geomap.reteunitaria.piemonte.it/ws/siccms/coto-01/wmsg01/wms_sicc01_dati_di_base?",
"name": "view",
"layerOptions": {
"layers": "DatiDiBase",
"format": "image/png",
"transparent": true,
"attribution": "Ufficio Cartografia Numerica del Comune di Torino"
}
},
"tile_edit" : {
"url": "https://api.mapbox.com/styles/v1/drp0ll0/cizl1thgs000u2ro17h1cv4y2/tiles/256/{z}/{x}/{y}@2x?access_token=pk.eyJ1IjoiZHJwMGxsMCIsImEiOiI4bUpPVm9JIn0.NCRmAUzSfQ_fT3A86d9RvQ",
"name": "edit",
"type": "xyz",
"visible": false,
"layerOptions": {
"attribution": "<a target='_blank' href='http://mapbox.com/'>©Mapbox</a> | OpenStreetMap contributors",
"keepBuffer": 0
}
},
"print": true,
"zoom_create": 19,
"max_zoom": 19
......
......@@ -447,10 +447,29 @@
"zoom_level" : 16,
"cluster_limit": 18,
"max_zoom": 20,
"tile_view" : "https://c.tile.openstreetmap.org/{z}/{x}/{y}.png",
"tile_view_attribution": "Tiles and Data by <a href='http://openstreetmap.org'>OpenStreetMap</a>, under <a href='http://www.openstreetmap.org/copyright'>ODbL</a>.",
"tile_edit" : "http://b.tile.stamen.com/toner/{z}/{x}/{y}.png",
"tile_edit_attribution": "Map tiles by <a href='http://stamen.com'>Stamen Design</a>, under <a href='http://creativecommons.org/licenses/by/3.0'>CC BY 3.0</a>. Data by <a href='http://openstreetmap.org'>OpenStreetMap</a>, under <a href='http://www.openstreetmap.org/copyright'>ODbL</a>."
"tile_view": {
"type": "wms",
"url": "http://geomap.reteunitaria.piemonte.it/ws/siccms/coto-01/wmsg01/wms_sicc01_dati_di_base?",
"name": "view",
"layerOptions": {
"layers": "DatiDiBase",
"format": "image/png",
"transparent": true,
"attribution": "Ufficio Cartografia Numerica del Comune di Torino"
}
},
"tile_edit": {
"type": "wms",
"url": "http://geomap.reteunitaria.piemonte.it/ws/siccms/coto-01/wmsg01/wms_sicc01_dati_di_base?",
"name": "edit",
"visible": false,
"layerOptions": {
"layers": "DatiDiBase",
"format": "image/png",
"transparent": true,
"attribution": "Ufficio Cartografia Numerica del Comune di Torino"
}
}
},
"behaviour":{
"is_login_required" : false
......
......@@ -953,29 +953,8 @@ angular.module('firstlife.controllers')
loaded: false,
layers: {
baselayers: {
view: {
type: 'wms',
url: 'http://geomap.reteunitaria.piemonte.it/ws/siccms/coto-01/wmsg01/wms_sicc01_dati_di_base?',
name: 'view',
layerOptions: {
layers: 'DatiDiBase',
format: 'image/png',
transparent: true,
attribution: 'Ufficio Cartografia Numerica del Comune di Torino'
}
},
edit: {
type: 'wms',
url: 'http://geomap.reteunitaria.piemonte.it/ws/siccms/coto-01/wmsg01/wms_sicc01_dati_di_base?',
name: 'edit',
visible: false,
layerOptions: {
layers: 'DatiDiBase',
format: 'image/png',
transparent: true,
attribution: 'Ufficio Cartografia Numerica del Comune di Torino'
}
}
view: myConfig.map.tile_view,
edit: myConfig.map.tile_edit
},
overlays: {
pie: {
......
......@@ -951,7 +951,15 @@ angular.module('firstlife.directives').directive('flmap',function () {
function addEditLayers() {
// VODKA HERE edit loading tiles
editLayer = L.tileLayer.wms($scope.map.layers.baselayers.edit.url, $scope.map.layers.baselayers.edit.layerOptions);
console.log('herhere', $scope.map.layers.baselayers);
if ($scope.map.layers.baselayers.edit.type === 'wms') {
editLayer = L.tileLayer.wms($scope.map.layers.baselayers.edit.url, $scope.map.layers.baselayers.edit.layerOptions);
} else if ($scope.map.layers.baselayers.edit.type === 'xyz') {
editLayer = L.tileLayer($scope.map.layers.baselayers.edit.url, $scope.map.layers.baselayers.edit.layerOptions);
} else {
$log.error('Config with unknown edit layer type! ', $scope.map.layers.baselayers.edit);
editLayer = L.tileLayer($scope.map.layers.baselayers.edit.url, $scope.map.layers.baselayers.edit.layerOptions);
}
// $log.debug(editLayer);
// add tile layer
editLayer.addTo(mapRef);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment