diff --git a/apps/main/templates/main_index.html b/apps/main/templates/main_index.html
index efa9838..29ee218 100644
--- a/apps/main/templates/main_index.html
+++ b/apps/main/templates/main_index.html
@@ -340,8 +340,24 @@
'EPSG:3857' // Целевая проекция
)
});
+
+
scanLayer.set('name', 'Ортофотоплан')
+ const layers = [
+ OSM,
+ mineBorderLayer,
+ SPLayer,
+ VlocationLayer,
+ GTOLayer,
+ ]
+
+ const scanLayerExists = Boolean(parseInt('{{ scan_layer_enable }}'))
+
+ if (scanLayerExists) {
+ layers.splice(1, 0, scanLayer)
+ }
+
// Создание карты
map = new ol.Map({
target: 'map', // ID элемента, куда встроится карта
@@ -350,14 +366,7 @@
new ol.control.ScaleLine(),
new ol.control.ZoomSlider()
],
- layers: [
- OSM,
- {#scanLayer,#}
- mineBorderLayer,
- SPLayer,
- VlocationLayer,
- GTOLayer,
- ],
+ layers: layers,
view: new ol.View({
center: ol.proj.fromLonLat([centerLat, centerLon]), // Центр карты
zoom: 12,
diff --git a/apps/main/views/views_main.py b/apps/main/views/views_main.py
index 179a040..a0e5a6a 100644
--- a/apps/main/views/views_main.py
+++ b/apps/main/views/views_main.py
@@ -30,12 +30,13 @@ def mainindex(request):
lat = str(float(settingsmodule.get_settings('latitude',
'55.344251210827814'))) # широта
kml_path = settingsmodule.get_settings('kml_path', '')
-
+ scan_layer_enable = settingsmodule.get_settings('scan_layer_enable', '0')
context = generalmodule.get_context_template()
context.update({
'lon': lon.replace(',', '.'),
'lat': lat.replace(',', '.'),
'kml_path': kml_path,
+ 'scan_layer_enable': scan_layer_enable,
'updatepage': True,
})
return render(request, 'main_index.html', context)