Загрузка ортофотоплана
@ -332,10 +332,15 @@
|
||||
|
||||
scanLayer = new ol.layer.Tile({
|
||||
source: new ol.source.XYZ({
|
||||
url: '/static/img/tiles/{z}/{x}/{y}.png',
|
||||
url: '/media/map/orth/tiles/{z}/{x}/{y}.png',
|
||||
}),
|
||||
extent: ol.proj.transformExtent(
|
||||
[86.639393, 53.959368, 86.698046, 54.004628], // [minLon, minLat, maxLon, maxLat]
|
||||
[
|
||||
parseFloat('{{ orth_minLon }}'),
|
||||
parseFloat('{{ orth_minLat }}'),
|
||||
parseFloat('{{ orth_maxLon }}'),
|
||||
parseFloat('{{ orth_maxLat }}')
|
||||
],
|
||||
'EPSG:4326', // Исходная проекция
|
||||
'EPSG:3857' // Целевая проекция
|
||||
)
|
||||
@ -344,7 +349,7 @@
|
||||
|
||||
scanLayer.set('name', 'Ортофотоплан')
|
||||
|
||||
const layers = [
|
||||
const layers = [
|
||||
OSM,
|
||||
mineBorderLayer,
|
||||
SPLayer,
|
||||
|
||||
144
apps/management/templates/add_orthomosaic.html
Normal file
@ -0,0 +1,144 @@
|
||||
{% extends "default.html" %}
|
||||
{% load static %}
|
||||
{% load mysettings %}
|
||||
|
||||
|
||||
{% block header_link %}
|
||||
<!-- Select2 -->
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'lte/plugins/select2/css/select2.min.css' %}?ver={% settings_value 'APP_VER' %}">
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'lte/plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css' %}?ver={% settings_value 'APP_VER' %}">
|
||||
<!-- iCheck for checkboxes and radio inputs -->
|
||||
<link rel="stylesheet"
|
||||
href="{% static 'lte/plugins/icheck-bootstrap/icheck-bootstrap.min.css' %}?ver={% settings_value 'APP_VER' %}">
|
||||
<style>
|
||||
.file-upload-label {
|
||||
cursor: pointer;
|
||||
border: 1px solid #ced4da;
|
||||
padding: .375rem .75rem;
|
||||
border-radius: .25rem;
|
||||
font-weight: normal !important;
|
||||
}
|
||||
</style>
|
||||
{% endblock header_link %}
|
||||
{% block content %}
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h4>Добавление ортофотоплана</h4>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="/management/">Главная</a></li>
|
||||
<li class="breadcrumb-item"><a href="/management/">Параметры системы </a></li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- /.container-fluid -->
|
||||
</section>
|
||||
|
||||
<section class="content">
|
||||
<form autocomplete="off" method="post" enctype="multipart/form-data" class="form-horizontal">
|
||||
{% csrf_token %}
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<!-- /.col -->
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
{% if error %}
|
||||
<div class="alert alert-danger alert-dismissible">
|
||||
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×
|
||||
</button>
|
||||
<h4><i class="icon fa fa-ban"></i> Внимание !</h4>
|
||||
{% for com in error_comment %}
|
||||
<p margin:0;margin-left:10px; ">{{ com }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="min_lon" class="col-sm-2 col-form-label">Минимальная широта: </label>
|
||||
<div class="col-sm-4">
|
||||
<input autocomplete="off" type="text" name="min_lon" class="form-control"
|
||||
autofocus="" required id="min_lon" value="{{ orth_minLon }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="min_lat" class="col-sm-2 col-form-label">Минимальная долгота: </label>
|
||||
<div class="col-sm-4">
|
||||
<input autocomplete="off" type="text" name="min_lat" class="form-control"
|
||||
autofocus="" required id="min_lat" value="{{ orth_minLat }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="max_lon" class="col-sm-2 col-form-label">Максимальная широта: </label>
|
||||
<div class="col-sm-4">
|
||||
<input autocomplete="off" type="text" name="max_lon" class="form-control"
|
||||
autofocus="" required id="max_lon" value="{{ orth_maxLon }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="max_lat" class="col-sm-2 col-form-label">Максимальная долгота: </label>
|
||||
<div class="col-sm-4">
|
||||
<input autocomplete="off" type="text" name="max_lat" class="form-control"
|
||||
autofocus="" required id="max_lat" value="{{ orth_maxLat }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="id_last_name" class="col-sm-2 col-form-label">Архив: </label>
|
||||
<div class="col-sm-4">
|
||||
<label for="icon"
|
||||
class="col-sm-1 col-form-label">{{ gto_icon.model }}</label>
|
||||
<div style="display: flex; flex-direction: column">
|
||||
<label for="archive" class="file-upload-label">Выберите
|
||||
архив</label>
|
||||
<input type="file" name="archive"
|
||||
class="form-control show-name" autofocus=""
|
||||
id="archive" style="visibility:hidden; display: none"
|
||||
accept=".zip" required>
|
||||
<div id="file-name" class="file-name"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
<i class="fas fa-info-circle" style="color: var(--primary);"></i>
|
||||
Необходимо загрузить архив в соответствии с TMS
|
||||
</p>
|
||||
</div><!-- /.card-body -->
|
||||
<div class="card-footer">
|
||||
<button id="btnok" type="submit" class="btn bg-gradient-primary">Сохранить</button>
|
||||
<a href="/management/" type="button" class="btn btn-default float-right">Отмена</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.nav-tabs-custom -->
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div><!-- /.container-fluid -->
|
||||
</form>
|
||||
</section>
|
||||
{% endblock %}
|
||||
{% block script_footer %}
|
||||
<script>
|
||||
const inputArr = document.querySelectorAll('.show-name')
|
||||
for (let arr of inputArr) {
|
||||
arr.addEventListener('change', function (event) {
|
||||
const fileNameDisplay = document.getElementById('file-name');
|
||||
const file = event.target.files[0];
|
||||
|
||||
if (file) {
|
||||
fileNameDisplay.style.display = 'block';
|
||||
fileNameDisplay.innerHTML = `Сейчас выбран: <a href="#" download="${file.name}">${file.name}</a>`;
|
||||
} else {
|
||||
fileNameDisplay.style.display = 'none';
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
{% endblock script_footer %}
|
||||
|
||||
@ -58,6 +58,9 @@
|
||||
id="id_prgr" style="visibility:hidden;" accept=".kml">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<a href="{% url 'add_orthomosaic' %}" class="btn bg-gradient-primary">Загрузить ортофотоплан</a>
|
||||
</div>
|
||||
</div> <!-- /.card-body -->
|
||||
<div class="card-footer">
|
||||
<button id="btnok" type="submit" class="btn bg-gradient-primary">Сохранить</button>
|
||||
|
||||
@ -5,11 +5,12 @@ from apps.management.views import views_user
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.conf.urls import include # Используйте include() чтобы добавлять URL из каталога приложения
|
||||
|
||||
from apps.management.views.views_settings import gto_icon_add
|
||||
from apps.management.views.views_settings import gto_icon_add, add_orthomosaic
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', views_management.main_index, name='main_index'),
|
||||
url(r'^gto_icon_add/$', gto_icon_add, name='gto_icon_add'),
|
||||
url(r'add_orthomosaic/$', add_orthomosaic, name='add_orthomosaic'),
|
||||
url(r'^user/add/$', views_user.user_add, name='user_add'),
|
||||
url(r'^user/$', views_user.user_edit, name='user_edit'),
|
||||
url(r'^user/password/$', views_user.user_password_edit, name='user_password_edit'),
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import os
|
||||
import shutil
|
||||
import traceback
|
||||
import uuid
|
||||
import zipfile
|
||||
from datetime import datetime
|
||||
|
||||
from django.db.models import Q
|
||||
@ -196,3 +198,34 @@ def main_index(request):
|
||||
return redirect('/management/')
|
||||
|
||||
|
||||
@login_required(login_url='/')
|
||||
@never_cache
|
||||
def add_orthomosaic(request):
|
||||
try:
|
||||
minLon = settingsmodule.get_settings('orth_minLon', '')
|
||||
minLat = settingsmodule.get_settings('orth_minLat', '')
|
||||
maxLon = settingsmodule.get_settings('orth_maxLon', '')
|
||||
maxLat = settingsmodule.get_settings('orth_maxLat', '')
|
||||
|
||||
if request.method == "GET":
|
||||
context = generalmodule.get_context_template()
|
||||
return render(request, 'add_orthomosaic.html', context)
|
||||
if request.method == "POST":
|
||||
settingsmodule.set_settings('orth_minLon', request.POST['min_lon'])
|
||||
settingsmodule.set_settings('orth_minLat', request.POST['min_lat'])
|
||||
settingsmodule.set_settings('orth_maxLon', request.POST['max_lon'])
|
||||
settingsmodule.set_settings('orth_maxLat', request.POST['max_lat'])
|
||||
|
||||
archive = request.FILES['archive']
|
||||
path = 'media/map/orth/tiles'
|
||||
shutil.rmtree(path)
|
||||
if not os.path.exists(path):
|
||||
os.makedirs(path)
|
||||
with zipfile.ZipFile(archive, 'r') as zip_ref:
|
||||
zip_ref.extractall(path)
|
||||
|
||||
return redirect('/management/?module=settings')
|
||||
|
||||
except Exception as err:
|
||||
logging.error(traceback.format_exc())
|
||||
return redirect('/management/')
|
||||
|
||||
|
Before Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 5.6 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 36 KiB |
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 65 KiB |
|
Before Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 64 KiB |
|
Before Width: | Height: | Size: 79 KiB |
|
Before Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 96 KiB |
|
Before Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 122 KiB |
|
Before Width: | Height: | Size: 87 KiB |
|
Before Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 97 KiB |
|
Before Width: | Height: | Size: 116 KiB |
|
Before Width: | Height: | Size: 143 KiB |
|
Before Width: | Height: | Size: 122 KiB |
|
Before Width: | Height: | Size: 139 KiB |
|
Before Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 31 KiB |
|
Before Width: | Height: | Size: 115 KiB |
|
Before Width: | Height: | Size: 137 KiB |
|
Before Width: | Height: | Size: 135 KiB |
|
Before Width: | Height: | Size: 121 KiB |
|
Before Width: | Height: | Size: 125 KiB |
|
Before Width: | Height: | Size: 132 KiB |
|
Before Width: | Height: | Size: 55 KiB |
|
Before Width: | Height: | Size: 66 KiB |
|
Before Width: | Height: | Size: 132 KiB |
|
Before Width: | Height: | Size: 108 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 66 KiB |
|
Before Width: | Height: | Size: 129 KiB |
|
Before Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |