условная отрисовка слоев
This commit is contained in:
parent
eda63ac39d
commit
5eef73eb3b
@ -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,
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user