提交 469660ab 编写于 作者: S serge-rider

#5937 Layers selector fix + disable layers selector for non-map geometries


Former-commit-id: 3b0ef215
上级 9f7f7061
...@@ -30,6 +30,24 @@ ...@@ -30,6 +30,24 @@
var geoMap = L.map('gisMap'); var geoMap = L.map('gisMap');
if (${showMap}) { if (${showMap}) {
let baseLayersObj = {
'Street': L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
maxZoom: 18,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/" target="_new">OpenStreetMap</a> contributors ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/" target="_new">CC-BY-SA</a>, ' +
'Imagery <a href="https://www.mapbox.com/" target="_new">Mapbox</a>',
id: 'mapbox.streets'
}),
'Topography': L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png',
{
maxZoom: 17,
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>,' +
' &copy; <a href="http://viewfinderpanoramas.org" target="_blank">SRTM</a>,' +
' &copy; <a href="https://opentopomap.org" target="_blank">OpenTopoMap</a>',
}),
};
L.control.layers(baseLayersObj).addTo(geoMap);
L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', { L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
maxZoom: 18, maxZoom: 18,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/" target="_new">OpenStreetMap</a> contributors ' + attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/" target="_new">OpenStreetMap</a> contributors ' +
...@@ -39,24 +57,6 @@ ...@@ -39,24 +57,6 @@
}).addTo(geoMap); }).addTo(geoMap);
} }
let baseLayersObj = {
'Street': L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
maxZoom: 18,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/" target="_new">OpenStreetMap</a> contributors ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/" target="_new">CC-BY-SA</a>, ' +
'Imagery <a href="https://www.mapbox.com/" target="_new">Mapbox</a>',
id: 'mapbox.streets'
}),
'Topography': L.tileLayer('https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png',
{
maxZoom: 17,
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a>,' +
' &copy; <a href="http://viewfinderpanoramas.org" target="_blank">SRTM</a>,' +
' &copy; <a href="https://opentopomap.org" target="_blank">OpenTopoMap</a>',
}),
};
L.control.layers(baseLayersObj).addTo(geoMap);
const geojsonMarkerOptions = { const geojsonMarkerOptions = {
radius: 4, radius: 4,
...@@ -93,6 +93,12 @@ ...@@ -93,6 +93,12 @@
}); });
vectorLayer.addTo(geoMap); vectorLayer.addTo(geoMap);
if (${showMap}) {
// Make streetview active
var layerControlElement = document.getElementsByClassName('leaflet-control-layers')[0];
layerControlElement.getElementsByTagName('input')[0].click();
}
for (i = 0; i < sourceValues.length; i++) { for (i = 0; i < sourceValues.length; i++) {
var geomValue = sourceValues[i]; var geomValue = sourceValues[i];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册