g3w-admin-processing 1.2.1b1.dev1__py3-none-any.whl → 2.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {g3w_admin_processing-1.2.1b1.dev1.dist-info → g3w_admin_processing-2.0.1.dist-info}/METADATA +10 -5
- {g3w_admin_processing-1.2.1b1.dev1.dist-info → g3w_admin_processing-2.0.1.dist-info}/RECORD +32 -28
- {g3w_admin_processing-1.2.1b1.dev1.dist-info → g3w_admin_processing-2.0.1.dist-info}/WHEEL +1 -1
- qprocessing/api/views/models.py +19 -6
- qprocessing/api/views/upload.py +23 -2
- qprocessing/configs.py +43 -0
- qprocessing/receivers.py +3 -0
- qprocessing/run_celery.sh +11 -0
- qprocessing/static/qprocessing/js/components/DrawInputVectorFeatures.js +87 -74
- qprocessing/static/qprocessing/js/components/InputFieldChooser.js +179 -152
- qprocessing/static/qprocessing/js/components/InputPrjRasterLayer.js +179 -92
- qprocessing/static/qprocessing/js/components/InputPrjVectorLayer.js +242 -214
- qprocessing/static/qprocessing/js/components/ModelInput.js +141 -0
- qprocessing/static/qprocessing/js/components/ModelPanel.js +419 -327
- qprocessing/static/qprocessing/js/components/ModelResults.js +31 -16
- qprocessing/static/qprocessing/js/components/OutputFile.js +31 -32
- qprocessing/static/qprocessing/js/components/OutputRasterLayer.js +38 -35
- qprocessing/static/qprocessing/js/components/OutputVectorLayer.js +136 -82
- qprocessing/static/qprocessing/js/i18n/en.js +15 -29
- qprocessing/static/qprocessing/js/i18n/fr.js +17 -0
- qprocessing/static/qprocessing/js/i18n/index.js +2 -0
- qprocessing/static/qprocessing/js/i18n/it.js +13 -29
- qprocessing/static/qprocessing/js/plugin.js +113 -42
- qprocessing/static/qprocessing/js/vendors/jszip.min.js +13 -0
- qprocessing/static/qprocessing/js/vendors/shp.min.js +9 -0
- qprocessing/tasks.py +22 -4
- qprocessing/tests/test_algorithm.py +2 -1
- qprocessing/tests/test_api.py +1 -1
- qprocessing/tests/test_api_models.py +23 -3
- qprocessing/utils/formtypes.py +21 -3
- qprocessing/static/qprocessing/js/components/UploadVectorFile.js +0 -53
- {g3w_admin_processing-1.2.1b1.dev1.dist-info → g3w_admin_processing-2.0.1.dist-info}/licenses/LICENSE +0 -0
- {g3w_admin_processing-1.2.1b1.dev1.dist-info → g3w_admin_processing-2.0.1.dist-info}/top_level.txt +0 -0
{g3w_admin_processing-1.2.1b1.dev1.dist-info → g3w_admin_processing-2.0.1.dist-info}/METADATA
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: g3w-admin-processing
|
|
3
|
-
Version:
|
|
4
|
-
Summary: G3W-ADMIN plugin for use the processing features of QGIS application
|
|
3
|
+
Version: 2.0.1
|
|
4
|
+
Summary: G3W-ADMIN plugin for use the processing features of QGIS application
|
|
5
5
|
Author-email: Gis3w snc <info@gis3w.it>
|
|
6
6
|
License: Mozilla Public License 2.0 (MPL 2.0)
|
|
7
7
|
Project-URL: Homepage, https://github.com/g3w-suite/g3w-admin-processing
|
|
@@ -17,13 +17,18 @@ Classifier: Topic :: Software Development :: Libraries
|
|
|
17
17
|
Description-Content-Type: text/markdown
|
|
18
18
|
License-File: LICENSE
|
|
19
19
|
Requires-Dist: cryptography==3.4.8
|
|
20
|
-
|
|
20
|
+
Requires-Dist: django-bleach==2.0.0
|
|
21
21
|
Dynamic: license-file
|
|
22
22
|
|
|
23
|
-
# G3W-ADMIN-QPROCESSING
|
|
23
|
+
# G3W-ADMIN-QPROCESSING
|
|
24
|
+
|
|
25
|
+
[](https://pypi.org/project/g3w-admin-processing/)
|
|
26
|
+
[](https://deepwiki.com/g3w-suite/g3w-admin-processing)
|
|
24
27
|
|
|
25
28
|
A dedicated [QGIS Processing](https://docs.qgis.org/3.28/en/docs/training_manual/processing/index.html) module for G3W-SUITE framework:
|
|
26
29
|
|
|
30
|
+

|
|
31
|
+
|
|
27
32
|
1. upload a [`.model3`](https://docs.qgis.org/3.28/en/docs/user_manual/processing/modeler.html) file into G3W-ADMIN.
|
|
28
33
|
2. get QGIS Processing tools available within G3W-CLIENT.
|
|
29
34
|
|
|
@@ -66,7 +71,7 @@ pip3 install git+https://github.com/g3w-suite/g3w-admin-processing.git@v1.0.0
|
|
|
66
71
|
# Install module from local folder (git development)
|
|
67
72
|
# pip3 install -e /g3w-admin/plugins/qprocessing
|
|
68
73
|
|
|
69
|
-
# Install module from
|
|
74
|
+
# Install module from PyPI
|
|
70
75
|
# pip3 install g3w-admin-processing
|
|
71
76
|
```
|
|
72
77
|
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
g3w_admin_processing-
|
|
1
|
+
g3w_admin_processing-2.0.1.dist-info/licenses/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
|
|
2
2
|
qprocessing/__init__.py,sha256=sb-_tyZHk9zphmjPPA9__cr8KLT2U3ZlcvrIRaVVnpM,182
|
|
3
3
|
qprocessing/admin.py,sha256=IL2aJMzKeqkmJgscNQODOtZW85dKYm2R_W9QzFjaR2s,501
|
|
4
4
|
qprocessing/apiurls.py,sha256=LwGzN2FH3y2SlYg02XL85mchNMasH1bsqfKq87AYHjE,2093
|
|
5
5
|
qprocessing/apps.py,sha256=H7jxw_nSOjw-Y5F9W0aLTFqqLc0iPkEkhPnUY7OEinY,1229
|
|
6
|
-
qprocessing/configs.py,sha256=
|
|
6
|
+
qprocessing/configs.py,sha256=kgJAXyLevnhYsXvwRSr0ykk5WAGbdthxCsEoHR2SoiY,3477
|
|
7
7
|
qprocessing/forms.py,sha256=jLFNa6Jom5E-agdH0Q1A3KlwBZ-p-0LRnnk9L8zs6VA,4791
|
|
8
8
|
qprocessing/models.py,sha256=Pm7yZUORuY4KvHCn_gQ35Y_DcukHQeNWZtIW-31IgY4,5415
|
|
9
|
-
qprocessing/receivers.py,sha256=
|
|
9
|
+
qprocessing/receivers.py,sha256=LLmhwopIAqh-0ehwkNs2CthOg_pS6CsPBFnNuiTKiP0,4073
|
|
10
|
+
qprocessing/run_celery.sh,sha256=Y7_BnOKNCSuzGL9PTE2-m7RttFhj20fC_2BRHmAHcmM,271
|
|
10
11
|
qprocessing/sitetrees.py,sha256=tvF8sGaVxFeU8X4QKYDcJf2IQvGe4GepSdwRB4igxjo,1526
|
|
11
|
-
qprocessing/tasks.py,sha256=
|
|
12
|
+
qprocessing/tasks.py,sha256=OU0F8Q5-MBnQvUTe6eSlrzEgTRyl-A96N0CSMdvpyGo,4338
|
|
12
13
|
qprocessing/urls.py,sha256=OipyViCs4r1x42Q2DR8GFw2ewUbl0DWaixFHvYVxjK0,1218
|
|
13
14
|
qprocessing/views.py,sha256=AhbexXzZhBi6E_uY-XEl2hvTV8Cgtf7z9DskJpXp_0Q,3338
|
|
14
15
|
qprocessing/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -16,35 +17,38 @@ qprocessing/api/permissions.py,sha256=6xNsPcs4HB1sb6AAMsFBM635IHfZZPQ_PVGyfL6eRh
|
|
|
16
17
|
qprocessing/api/views/__init__.py,sha256=-u2DXLQCBMunag8NZ74-lJnEO2qvwFAKm78353kc36k,88
|
|
17
18
|
qprocessing/api/views/actions.py,sha256=qfm8H98xDmIKjLzBBORrKppqT4WGZ9_QJVJ7zpY0IqY,2726
|
|
18
19
|
qprocessing/api/views/admin.py,sha256=eLECD0KfDXSHApqDAaL2fGsTMnvLyvTdlC3BlaugZBo,2672
|
|
19
|
-
qprocessing/api/views/models.py,sha256=
|
|
20
|
-
qprocessing/api/views/upload.py,sha256=
|
|
20
|
+
qprocessing/api/views/models.py,sha256=mZaSKDrAIoLTIHx3Q9mOLU6gVQXhdRH4vPEuh78E2O0,7394
|
|
21
|
+
qprocessing/api/views/upload.py,sha256=d5Y-48D5GZoX_0QcGNgvtJwVUW1Vt4SzL1CUyxH-A6Q,6640
|
|
21
22
|
qprocessing/migrations/0001_initial.py,sha256=-sNbeLlJH6e8Zc4vPD2DXKPZTZc1rVVHcOxuj6tzqgQ,777
|
|
22
23
|
qprocessing/migrations/0002_auto_20230615_1609.py,sha256=9sgx4s4XObhhqmadghVpe2u9zctcYOzHsayZS8COi5A,712
|
|
23
24
|
qprocessing/migrations/0003_qprocessinginputupload.py,sha256=5TwNTN7ozzcnRqrtDptpc2N6qajpwApZQ28XpvvnQow,1213
|
|
24
25
|
qprocessing/migrations/0004_auto_20230809_0920.py,sha256=t5iJs5htmO6uDpgFidYm5p5rb6kFQ1lwFl-SS6XtUkI,751
|
|
25
26
|
qprocessing/migrations/0005_alter_qprocessinginputupload_user.py,sha256=cGn1sPJkvxqm7Twi5Fhvbdg79VBdV0KoMRjBgYVUzis,621
|
|
26
27
|
qprocessing/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
27
|
-
qprocessing/static/qprocessing/js/plugin.js,sha256=
|
|
28
|
-
qprocessing/static/qprocessing/js/components/DrawInputVectorFeatures.js,sha256=
|
|
29
|
-
qprocessing/static/qprocessing/js/components/InputFieldChooser.js,sha256=
|
|
30
|
-
qprocessing/static/qprocessing/js/components/InputPrjRasterLayer.js,sha256=
|
|
31
|
-
qprocessing/static/qprocessing/js/components/InputPrjVectorLayer.js,sha256=
|
|
32
|
-
qprocessing/static/qprocessing/js/components/
|
|
33
|
-
qprocessing/static/qprocessing/js/components/
|
|
34
|
-
qprocessing/static/qprocessing/js/components/
|
|
35
|
-
qprocessing/static/qprocessing/js/components/
|
|
36
|
-
qprocessing/static/qprocessing/js/components/
|
|
37
|
-
qprocessing/static/qprocessing/js/components/
|
|
38
|
-
qprocessing/static/qprocessing/js/i18n/en.js,sha256=
|
|
39
|
-
qprocessing/static/qprocessing/js/i18n/
|
|
40
|
-
qprocessing/static/qprocessing/js/i18n/
|
|
28
|
+
qprocessing/static/qprocessing/js/plugin.js,sha256=WJEg3UuK8rNjFA92eOGqHO2keK8qTLkwjglJKAu1LpM,6198
|
|
29
|
+
qprocessing/static/qprocessing/js/components/DrawInputVectorFeatures.js,sha256=tSuasSXSI-6AsqsSJJYTXxgexSP0qZPmWgLfYB6ZnU8,6293
|
|
30
|
+
qprocessing/static/qprocessing/js/components/InputFieldChooser.js,sha256=_MIxzCH0Daj1x6Ov4Ggmw-D9j8am59fc4ow8HFjmxAE,8451
|
|
31
|
+
qprocessing/static/qprocessing/js/components/InputPrjRasterLayer.js,sha256=K-CWs9Tntx8oI81xHjAogBqmnSvlrgi193WzGRuFWmo,6715
|
|
32
|
+
qprocessing/static/qprocessing/js/components/InputPrjVectorLayer.js,sha256=MLsfQymeAthw6dDzedK24YLSdrITPqiltOZaoeo9JsY,15331
|
|
33
|
+
qprocessing/static/qprocessing/js/components/ModelInput.js,sha256=Zzd3Xss_X-DFRPb4LMt4odoe3svfumAdvavHPsd9Wek,5320
|
|
34
|
+
qprocessing/static/qprocessing/js/components/ModelPanel.js,sha256=MVKEyYjOYjnDNQRg9hr9HhVFUyxoBqHop9QlehPMmIY,20694
|
|
35
|
+
qprocessing/static/qprocessing/js/components/ModelResults.js,sha256=7I4gBxu3attC-337wE7eKR8NJOGCUgsQpjdph_ePZvc,2799
|
|
36
|
+
qprocessing/static/qprocessing/js/components/OutputFile.js,sha256=JZbfnk2UH-d9wz4jV1geyxCb3YqJkin_khU-bXzIKuM,1407
|
|
37
|
+
qprocessing/static/qprocessing/js/components/OutputRasterLayer.js,sha256=C97puibaBpfQ480a8BMlFUKFplXbpWuplb1M7uc1zYs,1509
|
|
38
|
+
qprocessing/static/qprocessing/js/components/OutputVectorLayer.js,sha256=PZZ38NzPh8fKvA24AXnrO_aaFhjX8FJ11KhhenI426E,5046
|
|
39
|
+
qprocessing/static/qprocessing/js/i18n/en.js,sha256=3KUy-FAKFgHaq-dJ6GCVYBOgB5PpOdqS5eBe2kmYVoY,889
|
|
40
|
+
qprocessing/static/qprocessing/js/i18n/fr.js,sha256=R1Nxq3LzsPpJvSnMO1DVadoutOqbwxGiB660_F6iaN0,948
|
|
41
|
+
qprocessing/static/qprocessing/js/i18n/index.js,sha256=ILge7seUc2pv0qea18ghigtJ9YjU7I-VnSZW9gyxhTM,106
|
|
42
|
+
qprocessing/static/qprocessing/js/i18n/it.js,sha256=Rszi9CVYSnb29zmLZn-P_19Nf4jWinSs7jeCHQXOWiw,858
|
|
43
|
+
qprocessing/static/qprocessing/js/vendors/jszip.min.js,sha256=rMfkFFWoB2W1_Zx-4bgHim0WC7vKRVrq6FTeZclH1Z4,97630
|
|
44
|
+
qprocessing/static/qprocessing/js/vendors/shp.min.js,sha256=EC9OX5m1239XUKKNiKnm9j4vhxTO5S3xuLoVhU5wQWw,99925
|
|
41
45
|
qprocessing/templates/qprocessing/project_form.html,sha256=nDMuqZzfcike8jDBdW2Gk7O8PgKLhPOHqOacLizZk3o,2227
|
|
42
46
|
qprocessing/templates/qprocessing/projects_list.html,sha256=U20zIE1sE3KwKsYmo035PY_gCVQu7XuBPgq8jovcBx0,3406
|
|
43
47
|
qprocessing/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
44
48
|
qprocessing/tests/base.py,sha256=fiwScwjamvnfX0yCDEN6Y6wfMGSLxVqUyepC0Ya5jEw,3524
|
|
45
|
-
qprocessing/tests/test_algorithm.py,sha256=
|
|
46
|
-
qprocessing/tests/test_api.py,sha256=
|
|
47
|
-
qprocessing/tests/test_api_models.py,sha256=
|
|
49
|
+
qprocessing/tests/test_algorithm.py,sha256=9QmyHjNizgO3LhDWJ2ZBmiQGXARTYTfGoFsaf-PN-yg,1945
|
|
50
|
+
qprocessing/tests/test_api.py,sha256=yX_6571Lttav1pW8zGe-SOdEHP1qB2Gr5w1tsymv2jA,7324
|
|
51
|
+
qprocessing/tests/test_api_models.py,sha256=u75sSoSsQzRl6N4PvnIQCE34rcHHxVljToTTSYRqhDo,17769
|
|
48
52
|
qprocessing/tests/data/qprocessing_qprocessing.qgs,sha256=dv2evRB0bJ_5Lesx2CglaejCfqXF6fD6rtCmV_m4xZc,170889
|
|
49
53
|
qprocessing/tests/data/qprocessing_qprocessing_attachments.zip,sha256=f4T60II8183Zu1LUB5v-vWUC2WhpnP3hzYV0NyXFvpA,1992
|
|
50
54
|
qprocessing/tests/data/test_qgis_328.qgs,sha256=ZI_vXOyz-ZoN6PPiHAtmp9QCq1DdsTdTrkwtl96woKo,57056
|
|
@@ -73,8 +77,8 @@ qprocessing/tests/data/upload/shp_to_upload.zip,sha256=3j15VV21bKdae_87xAYPSL173
|
|
|
73
77
|
qprocessing/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
74
78
|
qprocessing/utils/data.py,sha256=d6-hVV205DEwCvuWD8WGRn1VS4qc7xZPYUgyJtlKMew,9263
|
|
75
79
|
qprocessing/utils/exceptions.py,sha256=9IU5AP2Mcg2X7jeev2XxUI1Ls-OVdE6rxDcdRUSqdCQ,502
|
|
76
|
-
qprocessing/utils/formtypes.py,sha256=
|
|
77
|
-
g3w_admin_processing-
|
|
78
|
-
g3w_admin_processing-
|
|
79
|
-
g3w_admin_processing-
|
|
80
|
-
g3w_admin_processing-
|
|
80
|
+
qprocessing/utils/formtypes.py,sha256=ETmiOs3QkccyossRw3k8w4EqYfF_aH4kZXn9wpo7XsI,18371
|
|
81
|
+
g3w_admin_processing-2.0.1.dist-info/METADATA,sha256=3shokml3FuldUneKvJ3p62bR3cJSQ8jzo9GPuOBfPrQ,8058
|
|
82
|
+
g3w_admin_processing-2.0.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
83
|
+
g3w_admin_processing-2.0.1.dist-info/top_level.txt,sha256=Rsb41PTErHYxTtq0eKrzQOgGXleCvAM4U6MrOkRfrXk,12
|
|
84
|
+
g3w_admin_processing-2.0.1.dist-info/RECORD,,
|
qprocessing/api/views/models.py
CHANGED
|
@@ -105,13 +105,18 @@ class QProcessingRunInfoTaskView(G3WAPIView):
|
|
|
105
105
|
ret_status = 500
|
|
106
106
|
|
|
107
107
|
task_model = TaskModel.objects.get(task_id=task_id)
|
|
108
|
-
|
|
108
|
+
if hasattr(task_model, 'progress_count'):
|
|
109
|
+
progress_count = task_model.progress_count
|
|
110
|
+
else:
|
|
111
|
+
progress_count = task_model.progress_info[0]
|
|
109
112
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
progress_percentage = (
|
|
114
|
+
int(100 * progress_count / task_model.total)
|
|
115
|
+
if progress_count is not None and task_model.total else 0
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
if task_model.state.signal_name == 'complete':
|
|
119
|
+
progress_percentage = 100
|
|
115
120
|
|
|
116
121
|
try:
|
|
117
122
|
return JsonResponse({
|
|
@@ -209,6 +214,14 @@ class QProcessingDownLoadOutputView(G3WAPIView):
|
|
|
209
214
|
content_type = 'application/geopackage+sqlite3'
|
|
210
215
|
elif ext == 'sqlite':
|
|
211
216
|
content_type = 'application / vnd.sqlite3'
|
|
217
|
+
elif ext in ['tiff', 'tif']:
|
|
218
|
+
content_type = 'image/tiff'
|
|
219
|
+
elif ext == 'png':
|
|
220
|
+
content_type = 'image/png'
|
|
221
|
+
elif ext in ['jpeg', 'jpg']:
|
|
222
|
+
content_type = 'image/jpeg'
|
|
223
|
+
elif ext == 'vrt':
|
|
224
|
+
content_type = 'application/xml'
|
|
212
225
|
else:
|
|
213
226
|
content_type = 'application/octet-stream'
|
|
214
227
|
|
qprocessing/api/views/upload.py
CHANGED
|
@@ -21,7 +21,13 @@ from core.api.views import G3WAPIView
|
|
|
21
21
|
from core.api.authentication import CsrfExemptSessionAuthentication
|
|
22
22
|
from qprocessing.api.permissions import RunModelPermission
|
|
23
23
|
from qprocessing.models import QProcessingInputUpload, QProcessingProject
|
|
24
|
-
from qprocessing.utils.formtypes import
|
|
24
|
+
from qprocessing.utils.formtypes import (
|
|
25
|
+
MAPPING_QPROCESSINGTYPE_FORMTYPE,
|
|
26
|
+
QProcessingFormTypeException,
|
|
27
|
+
QgsProcessingParameterFeatureSource,
|
|
28
|
+
QgsProcessingParameterVectorLayer,
|
|
29
|
+
QgsProcessingParameterRasterLayer
|
|
30
|
+
)
|
|
25
31
|
|
|
26
32
|
from zipfile import ZipFile
|
|
27
33
|
import os
|
|
@@ -100,7 +106,22 @@ class QProcessingInputUploadView(G3WAPIView):
|
|
|
100
106
|
# Validate by ext
|
|
101
107
|
# -------------------------------------------------
|
|
102
108
|
ext = os.path.splitext(f.name)[-1][1:].lower()
|
|
103
|
-
|
|
109
|
+
|
|
110
|
+
# Get formats to check by input type
|
|
111
|
+
if self.qpm.inputs[kwargs['input_name']]['qprocessing_type'] in [
|
|
112
|
+
QgsProcessingParameterVectorLayer('').type(),
|
|
113
|
+
QgsProcessingParameterFeatureSource('').type()
|
|
114
|
+
]:
|
|
115
|
+
formats = [frm['value'] for frm in settings.QPROCESSING_INPUT_UPLOAD_VECTOR_FORMATS]
|
|
116
|
+
|
|
117
|
+
elif self.qpm.inputs[kwargs['input_name']]['qprocessing_type'] in [
|
|
118
|
+
QgsProcessingParameterRasterLayer('').type()
|
|
119
|
+
]:
|
|
120
|
+
formats = [frm['value'] for frm in settings.QPROCESSING_INPUT_UPLOAD_RASTER_FORMATS]
|
|
121
|
+
|
|
122
|
+
else:
|
|
123
|
+
formats = []
|
|
124
|
+
|
|
104
125
|
if ext not in formats:
|
|
105
126
|
raise QProcessingInputUploadValidationException(
|
|
106
127
|
f"File type not allowed: {ext}. "
|
qprocessing/configs.py
CHANGED
|
@@ -37,6 +37,16 @@ QPROCESSING_OUTPUT_HTML_FORMAT_DEFAULT = 'html'
|
|
|
37
37
|
QPROCESSING_INPUT_SHP_EXTS = ['shp', 'shx', 'prj', 'dbf', 'shx']
|
|
38
38
|
|
|
39
39
|
# Formats available for input upload
|
|
40
|
+
# ----------------------------------
|
|
41
|
+
|
|
42
|
+
# Max file size for upload input files (in bytes),
|
|
43
|
+
# if None no limit
|
|
44
|
+
QPROCESSING_INPUT_UPLOAD_MAX_FILE_SIZE = None
|
|
45
|
+
|
|
46
|
+
# I.e.:
|
|
47
|
+
#QPROCESSING_INPUT_UPLOAD_MAX_FILE_SIZE = 20 * 1024 * 1024 # 20 MB
|
|
48
|
+
|
|
49
|
+
# Vector formats
|
|
40
50
|
QPROCESSING_INPUT_UPLOAD_VECTOR_FORMATS = [
|
|
41
51
|
{
|
|
42
52
|
'value': 'zip',
|
|
@@ -61,6 +71,35 @@ QPROCESSING_INPUT_UPLOAD_VECTOR_FORMATS = [
|
|
|
61
71
|
|
|
62
72
|
]
|
|
63
73
|
|
|
74
|
+
# Raster formats
|
|
75
|
+
QPROCESSING_INPUT_UPLOAD_RASTER_FORMATS = [
|
|
76
|
+
{
|
|
77
|
+
'value': 'vrt',
|
|
78
|
+
'key': 'VRT'
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
'value': 'tiff',
|
|
82
|
+
'key': 'TIFF'
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
'value': 'tif',
|
|
86
|
+
'key': 'TIF'
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
'value': 'png',
|
|
90
|
+
'key': 'PNG'
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
'value': 'jpeg',
|
|
94
|
+
'key': 'JPEG'
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
'value': 'jpg',
|
|
98
|
+
'key': 'JPG'
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
]
|
|
102
|
+
|
|
64
103
|
|
|
65
104
|
# For Processing form type: input/output
|
|
66
105
|
QPROCESSING_OUTPUT_VECTOR_FORMATS = [
|
|
@@ -129,3 +168,7 @@ QPROCESSING_OUTPUT_RASTER_FORMATS = [
|
|
|
129
168
|
QPROCESSING_CRYPTO_KEY = b'aAf72grwGaZYH9R7ZaGHgSSbtQVXPplXB4wpiMsKtJM='
|
|
130
169
|
|
|
131
170
|
|
|
171
|
+
# Time interval (in seconds) for check task info
|
|
172
|
+
QPROCESSING_TASK_INFO_INTERVAL = 5
|
|
173
|
+
|
|
174
|
+
|
qprocessing/receivers.py
CHANGED
|
@@ -42,6 +42,8 @@ def set_initconfig_value(sender, **kwargs):
|
|
|
42
42
|
'version': get_version('qprocessing'),
|
|
43
43
|
'gid': f"{kwargs['projectType']}:{kwargs['project']}",
|
|
44
44
|
'async': settings.QPROCESSING_ASYNC_RUN,
|
|
45
|
+
'max_upload_file_size': settings.QPROCESSING_INPUT_UPLOAD_MAX_FILE_SIZE,
|
|
46
|
+
'task_info_interval': settings.QPROCESSING_TASK_INFO_INTERVAL,
|
|
45
47
|
'urls': {
|
|
46
48
|
'run': f'/qprocessing{__BASE_RUN_MODEL_URL}',
|
|
47
49
|
'taskinfo': f'/qprocessing{__BASE_TASK_INFO_URL}',
|
|
@@ -51,6 +53,7 @@ def set_initconfig_value(sender, **kwargs):
|
|
|
51
53
|
'models': [{
|
|
52
54
|
**QProcessingModel(str(qpp.model.file)).render2dict(),
|
|
53
55
|
'id': qpp.pk,
|
|
56
|
+
'note': qpp.note,
|
|
54
57
|
'results': [],
|
|
55
58
|
# TODO: move the following into render2dict? (converts [admin] model inputs into [client] form inputs)
|
|
56
59
|
'inputs': [{
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Run Celery worker for Qprocessing module
|
|
3
|
+
|
|
4
|
+
set -x
|
|
5
|
+
|
|
6
|
+
# run rabbimq/redis
|
|
7
|
+
# docker run -d --hostname my-rabbit -p 5672:5672 --name some-rabbit rabbitmq
|
|
8
|
+
# docker run --name some-redis -p 6379:6379 -d redis
|
|
9
|
+
|
|
10
|
+
# run celery
|
|
11
|
+
celery -A base worker -l info #-n wrk1@%h
|
|
@@ -1,65 +1,71 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
|
|
1
|
+
const GUI = g3w.app;
|
|
2
|
+
const _ = g3w.gettext;
|
|
4
3
|
export default ({
|
|
5
4
|
|
|
6
5
|
// language=html
|
|
7
6
|
template: /* html */ `
|
|
8
7
|
<div
|
|
9
|
-
class
|
|
10
|
-
style
|
|
8
|
+
class = "qprocessing-draw-vector-features"
|
|
9
|
+
style = "font-size: 1.3em;"
|
|
10
|
+
|
|
11
11
|
>
|
|
12
12
|
<button
|
|
13
13
|
class = "btn skin-background-color"
|
|
14
14
|
style = "height: 100%; margin-right: 0 !important;"
|
|
15
15
|
@click.stop.prevent = "toggled = !toggled"
|
|
16
|
+
v-t-tooltip:top.create = "'plugins.qprocessing.inputs.drawfeatures'"
|
|
16
17
|
>
|
|
17
|
-
<i
|
|
18
|
+
<i class = "fas fa-pencil-alt"></i>
|
|
18
19
|
</button>
|
|
19
20
|
</div>
|
|
20
21
|
`,
|
|
21
22
|
|
|
22
23
|
name: "DrawInputVectorFeatures",
|
|
24
|
+
|
|
23
25
|
props: {
|
|
24
|
-
datatypes: {
|
|
25
|
-
|
|
26
|
-
default: []
|
|
27
|
-
},
|
|
28
|
-
upload:{
|
|
29
|
-
type: Boolean, //Boolean when file is upload ot not
|
|
30
|
-
}
|
|
26
|
+
datatypes: { type: Array, default: [] }, // array of datatypes from input
|
|
27
|
+
upload: { type: Boolean } // Boolean when file is upload ot not
|
|
31
28
|
},
|
|
29
|
+
|
|
32
30
|
data() {
|
|
31
|
+
// Initialize drawing and upload state.
|
|
33
32
|
return {
|
|
34
33
|
toggled: false, //draw button toggled
|
|
35
34
|
drawTool: {
|
|
36
|
-
loading:
|
|
35
|
+
loading: this.upload,
|
|
37
36
|
disabled: true
|
|
38
37
|
}
|
|
39
38
|
}
|
|
40
39
|
},
|
|
40
|
+
|
|
41
41
|
methods: {
|
|
42
|
+
|
|
42
43
|
/**
|
|
43
|
-
|
|
44
|
+
* Configure and activate the map drawing interaction.
|
|
44
45
|
*/
|
|
45
|
-
setDrawInteraction(type=this.drawGeometryTypes[0]){
|
|
46
|
-
GUI.
|
|
46
|
+
setDrawInteraction(type = this.drawGeometryTypes[0]){
|
|
47
|
+
GUI.disableClickMapControls(true); // avoid click conflicts
|
|
47
48
|
this.drawLayer.getSource().clear(); // clear previous features
|
|
48
|
-
GUI.
|
|
49
|
+
GUI.removeInteraction(this.drawInteraction); // remove previous draw interaction
|
|
49
50
|
this.drawInteraction = new ol.interaction.Draw({ type, source: this.drawLayer.getSource() }); // create draw interaction
|
|
50
51
|
this.drawInteraction.on('drawend', () => this.drawTool.disabled = false); // enable upload button on drawend
|
|
51
|
-
GUI.
|
|
52
|
+
GUI.addInteraction(this.drawInteraction); // add interaction to Map
|
|
52
53
|
},
|
|
54
|
+
|
|
55
|
+
// Clear drawn features and release the active map interaction.
|
|
53
56
|
clear() {
|
|
54
57
|
this.drawLayer.getSource().clear();
|
|
55
|
-
GUI.
|
|
56
|
-
GUI.
|
|
58
|
+
GUI.disableClickMapControls(false);
|
|
59
|
+
GUI.removeInteraction(this.drawInteraction);
|
|
57
60
|
GUI.closeUserMessage();
|
|
58
61
|
},
|
|
62
|
+
|
|
59
63
|
},
|
|
64
|
+
|
|
60
65
|
watch: {
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
|
|
67
|
+
// Start or stop the drawing tool and its user prompt.
|
|
68
|
+
toggled(bool) {
|
|
63
69
|
if (!bool) {
|
|
64
70
|
this.clear();
|
|
65
71
|
this.$emit('toggled-tool', !bool);
|
|
@@ -69,44 +75,44 @@ export default ({
|
|
|
69
75
|
this.setDrawInteraction();
|
|
70
76
|
//whow tool component
|
|
71
77
|
GUI.showUserMessage({
|
|
72
|
-
title:
|
|
73
|
-
type:
|
|
74
|
-
size:
|
|
78
|
+
title: 'plugins.qprocessing.inputs.drawfeatures', //@TODO add translation title
|
|
79
|
+
type: 'tool',
|
|
80
|
+
size: 'small',
|
|
75
81
|
closable: false,
|
|
76
82
|
hooks: {
|
|
77
83
|
body: {
|
|
78
84
|
template: /* html */`
|
|
79
|
-
<div style="width: 100%; padding: 5px;" v-disabled="state.loading">
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
85
|
+
<div style = "width: 100%; padding: 5px;" v-disabled = "state.loading">
|
|
86
|
+
<x-select
|
|
87
|
+
:value = "type"
|
|
88
|
+
ref = "select"
|
|
89
|
+
@change = "type = $event.target.value"
|
|
90
|
+
style = "width: 100%">
|
|
91
|
+
<x-option
|
|
92
|
+
v-for = "type in types"
|
|
93
|
+
:key = "type"
|
|
94
|
+
:value = "type"
|
|
95
|
+
v-t-plugin = "'qprocessing.draw_types.'+type"
|
|
96
|
+
></x-option>
|
|
97
|
+
</x-select>
|
|
98
|
+
|
|
99
|
+
<div v-if = "state.loading" class = "bar-loader"></div>
|
|
100
|
+
|
|
101
|
+
<button
|
|
102
|
+
v-disabled = "state.disabled"
|
|
103
|
+
class = "btn skin-background-color"
|
|
104
|
+
@click.stop.prevent = "uploadLayer(type)"
|
|
105
|
+
style = "margin: 3px; width: 100%"
|
|
106
|
+
>
|
|
107
|
+
<i class = "fas fa-cloud-upload-alt"></i>
|
|
108
|
+
</button>
|
|
103
109
|
|
|
104
110
|
</div>`,
|
|
105
111
|
data: () => {
|
|
106
112
|
return {
|
|
107
113
|
state: this.drawTool,
|
|
108
114
|
types: this.drawGeometryTypes,
|
|
109
|
-
type:
|
|
115
|
+
type: this.drawGeometryTypes[0]
|
|
110
116
|
};
|
|
111
117
|
},
|
|
112
118
|
watch: {
|
|
@@ -115,21 +121,20 @@ export default ({
|
|
|
115
121
|
* @listens type change of drawed geometry
|
|
116
122
|
* @fires change-draw-type
|
|
117
123
|
*/
|
|
118
|
-
'type':
|
|
119
|
-
this.setDrawInteraction(type);
|
|
120
|
-
},
|
|
124
|
+
'type': type => this.setDrawInteraction(type),
|
|
121
125
|
|
|
122
126
|
},
|
|
123
127
|
methods: {
|
|
128
|
+
// Emit the drawn features as an uploadable layer.
|
|
124
129
|
uploadLayer: async (type) => {
|
|
125
|
-
const qprocessing =
|
|
126
|
-
const features
|
|
130
|
+
const qprocessing = GUI.getPlugin('qprocessing');
|
|
131
|
+
const features = this.drawLayer.getSource().getFeatures();
|
|
127
132
|
await this.$nextTick();
|
|
128
133
|
//emit event
|
|
129
134
|
this.$emit('add-layer', {
|
|
130
135
|
file: qprocessing.createGeoJSONFile({
|
|
131
136
|
features,
|
|
132
|
-
name: `${
|
|
137
|
+
name: `${_('plugins.qprocessing.draw_filename')}(${_('plugins.qprocessing.draw_types.' + type)})`
|
|
133
138
|
}),
|
|
134
139
|
features,
|
|
135
140
|
type: 'draw'
|
|
@@ -141,40 +146,48 @@ export default ({
|
|
|
141
146
|
});
|
|
142
147
|
this.$emit('toggled-tool', !bool);
|
|
143
148
|
},
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
149
|
+
|
|
150
|
+
// Prepare supported geometries and add the temporary layer to the map.
|
|
151
|
+
// Keep drawing controls synchronized with the upload state.
|
|
152
|
+
upload(bool) {
|
|
153
|
+
this.drawTool.loading = bool;
|
|
147
154
|
this.drawTool.disabled = !bool;
|
|
148
155
|
if (!bool) {
|
|
149
156
|
this.clear();
|
|
150
157
|
this.toggled = bool;
|
|
151
158
|
}
|
|
152
|
-
}
|
|
159
|
+
},
|
|
160
|
+
|
|
153
161
|
},
|
|
154
|
-
created() {
|
|
155
162
|
|
|
163
|
+
created() {
|
|
164
|
+
// Prepare supported geometries and add the temporary layer to the map.
|
|
156
165
|
//set geometries type
|
|
157
166
|
this.drawGeometryTypes = Object.entries({
|
|
158
|
-
point:
|
|
159
|
-
line:
|
|
167
|
+
point: 'Point',
|
|
168
|
+
line: 'LineString',
|
|
160
169
|
polygon: 'Polygon'
|
|
161
|
-
}).reduce((
|
|
162
|
-
|
|
163
|
-
|
|
170
|
+
}).reduce((a, [ type, olGeometry ]) => {
|
|
171
|
+
// Remove the temporary layer and release drawing resources.
|
|
172
|
+
if (this.datatypes.find(dt => 'anygeometry' === dt)){
|
|
173
|
+
a.push(olGeometry);
|
|
164
174
|
} else {
|
|
165
|
-
this.datatypes.find(
|
|
175
|
+
this.datatypes.find(dt => type === dt) && a.push(olGeometry)
|
|
166
176
|
}
|
|
167
|
-
return
|
|
177
|
+
return a;
|
|
168
178
|
}, []);
|
|
169
179
|
|
|
170
180
|
this.drawInteraction = null;
|
|
171
|
-
this.drawLayer
|
|
172
|
-
GUI.
|
|
181
|
+
this.drawLayer = new ol.layer.Vector({ source: new ol.source.Vector() });
|
|
182
|
+
GUI.getMap().addLayer(this.drawLayer);
|
|
173
183
|
},
|
|
184
|
+
|
|
174
185
|
beforeDestroy() {
|
|
186
|
+
// Remove the temporary layer and release drawing resources.
|
|
175
187
|
this.clear();
|
|
176
|
-
GUI.
|
|
177
|
-
this.drawLayer
|
|
188
|
+
GUI.getMap().removeLayer(this.drawLayer);
|
|
189
|
+
this.drawLayer = null;
|
|
178
190
|
this.drawInteraction = null;
|
|
179
|
-
}
|
|
191
|
+
},
|
|
192
|
+
|
|
180
193
|
});
|