diff --git a/.gitignore b/.gitignore
index 2031b809..7036bab8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,3 +23,4 @@ test/data/*.gpkg-wal
test/data/*.qgs~
test/data/*.qgz~
test/data/*_attachments.zip
+test/data/*.asc.aux.xml
diff --git a/lizmap_server/core.py b/lizmap_server/core.py
index f189e812..f8fff25f 100755
--- a/lizmap_server/core.py
+++ b/lizmap_server/core.py
@@ -49,15 +49,11 @@ def find_vector_layer_from_params(params, project):
return True, layer
-def find_vector_layer(layer_name: str, project: QgsProject) -> Optional[QgsVectorLayer]:
- """ Find vector layer with name, short name or layer id. """
+def find_layer(layer_name: str, project: QgsProject) -> Optional[QgsMapLayer]:
+ """ Find layer with name, short name or layer ID. """
found = None
for layer in project.mapLayers().values():
- # only vector layer
- if layer.type() != QgsMapLayer.VectorLayer:
- continue
-
# check name
if layer.name() == layer_name:
found = layer
@@ -75,18 +71,30 @@ def find_vector_layer(layer_name: str, project: QgsProject) -> Optional[QgsVecto
if not found:
Logger.warning(
- "The vector layer '{}' has not been found in the project '{}'".format(layer_name, project.fileName()))
+ "The layer '{}' has not been found in the project '{}'".format(layer_name, project.fileName()))
return None
- found: QgsVectorLayer
+ found: QgsMapLayer
if not found.isValid():
Logger.warning(
- f"The vector layer '{layer_name}' has been found but it is not valid in the project "
+ f"The layer '{layer_name}' has been found but it is not valid in the project "
f"'{project.fileName()}'",
)
return found
+def find_vector_layer(layer_name: str, project: QgsProject) -> Optional[QgsVectorLayer]:
+ """ Find vector layer with name, short name or layer ID. """
+ layer = find_layer(layer_name, project)
+ if not layer:
+ return None
+
+ if not layer.type() == QgsMapLayer.VectorLayer:
+ return None
+
+ return layer
+
+
def get_server_fid(feature: QgsFeature, pk_attributes: list) -> str:
""" Build server feature ID. """
if not pk_attributes:
diff --git a/lizmap_server/get_legend_graphic.py b/lizmap_server/get_legend_graphic.py
index 7d61bf01..069c6a93 100644
--- a/lizmap_server/get_legend_graphic.py
+++ b/lizmap_server/get_legend_graphic.py
@@ -11,12 +11,12 @@
from collections import namedtuple
from typing import Optional
-from qgis.core import Qgis, QgsProject, QgsVectorLayer
+from qgis.core import Qgis, QgsMapLayer, QgsProject, QgsVectorLayer
from qgis.PyQt.QtCore import QBuffer, QIODevice
from qgis.PyQt.QtGui import QImage
from qgis.server import QgsServerFilter
-from lizmap_server.core import find_vector_layer
+from lizmap_server.core import find_layer
from lizmap_server.logger import Logger, exception_handler
from lizmap_server.tools import to_bool
@@ -86,11 +86,11 @@ def responseComplete(self):
show_feature_count = to_bool(params.get('SHOWFEATURECOUNT'), default_value=False)
current_style = ''
- layer = find_vector_layer(layer_name, project)
+ layer = find_layer(layer_name, project)
if not layer:
- logger.info("Skipping the layer '{}' because it's not a vector layer".format(layer_name))
return
+ layer: QgsMapLayer
if not layer.isValid():
logger.warning(
f"Layer '{layer_name}' is not valid, returning a warning icon in the legend for project "
@@ -109,6 +109,12 @@ def responseComplete(self):
handler.appendBody(json.dumps(json_data).encode('utf8'))
return
+ if layer.type() != QgsMapLayer.VectorLayer:
+ logger.info("Skipping the layer '{}' because it's not a vector layer".format(layer_name))
+ return
+
+ layer: QgsVectorLayer
+
try:
current_style = layer.styleManager().currentStyle()
diff --git a/test/data/legend.qgs b/test/data/legend.qgs
index 9be0f2e3..36423c9c 100644
--- a/test/data/legend.qgs
+++ b/test/data/legend.qgs
@@ -1,9 +1,8 @@
-
-
-
+
+
-
-
+
+
GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]]
@@ -17,47 +16,54 @@
true
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
- france_parts_78ada204_99d6_483e_a197_329cdfb3bae2
- unique_symbol_09a1e655_d748_4562_be27_3a32301dcd7b
- categorized_fb292c38_4877_42d0_9b05_f429c4f86885
+ - raster_6f751d1e_87a0_4c43_afc4_31fa3b5de704
-
+
-
-
-
+
+
+
-
-
+
+
degrees
- -5.33889081436202328
- 46.19300890773994439
- 3.32419280355761426
- 49.81265618522981953
+ -7.41955013181315781
+ 45.10016458762831348
+ 6.15370831637321825
+ 50.77140246960161107
0
@@ -74,28 +80,170 @@
0
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+ degrees
+
+ 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368
+ 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368
+ -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368
+ -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368
+
+ 0
+
+
+ GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]]
+ +proj=longlat +datum=WGS84 +no_defs
+ 3452
+ 4326
+ EPSG:4326
+ WGS 84
+ longlat
+ EPSG:7030
+ true
+
+
+ 0
+
+
+
Annotations_f7e4d112_938c_4fe7_8caf_72e75257659c
@@ -122,7 +270,8 @@
-
+
+
@@ -138,27 +287,24 @@
false
-
+
-
+
+
+ 1
+ 1
+ 1
+ 0
+
+
+
+
1
0
-
+
-
-
- -5.1326269186972695
- 46.2791909857754149
- 3.11792890789286048
- 49.72647410719434902
-
-
- -5.1326269186972695
- 46.2791909857754149
- 3.11792890789286048
- 49.72647410719434902
-
+
categorized_fb292c38_4877_42d0_9b05_f429c4f86885
./france_parts/france_parts.shp
@@ -194,7 +340,8 @@
-
+
+
@@ -211,7 +358,7 @@
-
+
@@ -221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
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
+
0
- # -*- coding: utf-8 -*-
"""
QGIS forms can have a Python function that is called when the form is
opened.
@@ -1129,147 +1319,135 @@ from qgis.PyQt.QtWidgets import QWidget
def my_form_open(dialog, layer, feature):
geom = feature.geometry()
control = dialog.findChild(QWidget, "MyLineEdit")
-]]>
+
0
generatedlayout
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
"NAME_0"
-
+
-
-
- -5.1326269186972695
- 46.2791909857754149
- 3.11792890789286048
- 49.72647410719434902
-
-
- -5.1326269186972695
- 46.2791909857754149
- 3.11792890789286048
- 49.72647410719434902
-
+
france_parts_78ada204_99d6_483e_a197_329cdfb3bae2
./france_parts/france_parts.shp
@@ -1305,7 +1483,8 @@ def my_form_open(dialog, layer, feature):
-
+
+
@@ -1322,7 +1501,7 @@ def my_form_open(dialog, layer, feature):
-
+
@@ -1332,254 +1511,257 @@ def my_form_open(dialog, layer, feature):
ogr
-
-
-
-
+
+
+
+
-
+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
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
+
0
- # -*- coding: utf-8 -*-
"""
QGIS forms can have a Python function that is called when the form is
opened.
@@ -2108,147 +2330,357 @@ from qgis.PyQt.QtWidgets import QWidget
def my_form_open(dialog, layer, feature):
geom = feature.geometry()
control = dialog.findChild(QWidget, "MyLineEdit")
-]]>
+
0
generatedlayout
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
"NAME_0"
-
+
-
+
- -5.1326269186972695
- 46.2791909857754149
- 3.11792890789286048
- 49.72647410719434902
+ -0.0055
+ 47.61250000000000426
+ 0.17049999999999998
+ 47.66750000000000398
- -5.1326269186972695
- 46.2791909857754149
- 3.11792890789286048
- 49.72647410719434902
+ -0.0055
+ 47.61250000000000426
+ 0.17049999999999998
+ 47.66750000000000398
+ raster_6f751d1e_87a0_4c43_afc4_31fa3b5de704
+ ./raster.asc
+
+
+
+ raster
+
+
+ GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]]
+ +proj=longlat +datum=WGS84 +no_defs
+ 3452
+ 4326
+ EPSG:4326
+ WGS 84
+ longlat
+ EPSG:7030
+ true
+
+
+
+
+
+
+ dataset
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+
+
+
+
+ false
+
+
+
+
+ gdal
+
+
+
+
+
+
+
+
+ 1
+ 1
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MinMax
+ WholeRaster
+ Estimated
+ 0.02
+ 0.98
+ 2
+
+
+ 50
+ 125
+ StretchToMinimumMaximum
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ resamplingFilter
+
+ 0
+
+
unique_symbol_09a1e655_d748_4562_be27_3a32301dcd7b
./france_parts/france_parts.shp
@@ -2284,7 +2716,8 @@ def my_form_open(dialog, layer, feature):
-
+
+
@@ -2301,7 +2734,7 @@ def my_form_open(dialog, layer, feature):
-
+
@@ -2311,421 +2744,424 @@ def my_form_open(dialog, layer, feature):
ogr
-
-
-
-
+
+
+
+
-
+
-
-
+
+
1
1
1
0
-
+
-
+
-
-
+
+
+
-
+
-
-
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
-
+
-
-
+
+
+
-
+
-
-
-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
QGIS forms can have a Python function that is called when the form is
opened.
@@ -3254,139 +3730,140 @@ from qgis.PyQt.QtWidgets import QWidget
def my_form_open(dialog, layer, feature):
geom = feature.geometry()
control = dialog.findChild(QWidget, "MyLineEdit")
-]]>
+
0
generatedlayout
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
"NAME_0"
-
+
-
-
-
+
+
+
+
@@ -3414,6 +3891,7 @@ def my_form_open(dialog, layer, feature):
5
2.5
+ false
false
false
1
@@ -3445,13 +3923,13 @@ def my_form_open(dialog, layer, feature):
-
-
+
+
+
-
-
+
+
@@ -3459,158 +3937,162 @@ def my_form_open(dialog, layer, feature):
-
+
+
+
+
Etienne Trimaille
2023-06-19T14:13:55
-
+
-
-
-
+
+
+
-
+
-
-
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
+
-
+
-
+
-
-
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
+
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
+
-
-
-
+
+
+
-
-
+
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
+
-
+
+
-
+
-
-
+
+
+
-
-
+
+
GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]]
+proj=longlat +datum=WGS84 +no_defs
@@ -3624,41 +4106,41 @@ def my_form_open(dialog, layer, feature):
-
-
+
+
-
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -3675,4 +4157,7 @@ def my_form_open(dialog, layer, feature):
-
+
+
+
+
\ No newline at end of file
diff --git a/test/data/legend_invalid.qgs b/test/data/legend_invalid.qgs
index 9e889b86..aeeec572 100644
--- a/test/data/legend_invalid.qgs
+++ b/test/data/legend_invalid.qgs
@@ -1,9 +1,8 @@
-
-
-
+
+
-
-
+
+
GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]]
@@ -17,47 +16,54 @@
true
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
- france_parts_78ada204_99d6_483e_a197_329cdfb3bae2
- unique_symbol_09a1e655_d748_4562_be27_3a32301dcd7b
- categorized_fb292c38_4877_42d0_9b05_f429c4f86885
+ - raster_ea11ee6f_d5f4_4348_9724_68b302770ce9
-
+
-
-
-
+
+
+
-
-
+
+
degrees
- -5.33889081436202328
- 46.19300890773994439
- 3.32419280355761426
- 49.81265618522981953
+ 3.84409999999999963
+ 43.5717250000000007
+ 4.02890000000000104
+ 43.62947499999999934
0
@@ -74,28 +80,170 @@
0
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+ degrees
+
+ 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368
+ 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368
+ -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368
+ -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368
+
+ 0
+
+
+ GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]]
+ +proj=longlat +datum=WGS84 +no_defs
+ 3452
+ 4326
+ EPSG:4326
+ WGS 84
+ longlat
+ EPSG:7030
+ true
+
+
+ 0
+
+
+
Annotations_f7e4d112_938c_4fe7_8caf_72e75257659c
@@ -122,7 +270,8 @@
-
+
+
@@ -138,15 +287,24 @@
false
-
+
-
+
+
+ 1
+ 1
+ 1
+ 0
+
+
+
+
1
0
-
+
-
+
-5.1326269186972695
46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@ from qgis.PyQt.QtWidgets import QWidget
def my_form_open(dialog, layer, feature):
geom = feature.geometry()
control = dialog.findChild(QWidget, "MyLineEdit")
-]]>
+
0
generatedlayout
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
"NAME_0"
-
+
-5.1326269186972695
46.2791909857754149
@@ -1305,7 +1463,7 @@ def my_form_open(dialog, layer, feature):
-
+
@@ -1322,7 +1480,7 @@ def my_form_open(dialog, layer, feature):
-
+
@@ -1332,254 +1490,254 @@ def my_form_open(dialog, layer, feature):
ogr
-
-
-
-
+
+
+
+
-
+
-
-
+
+
1
1
1
0
-
+
-
+
-
-
+
+
+
-
+
-
-
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
-
+
-
-
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
-
+
-
-
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+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
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
+
0
- # -*- coding: utf-8 -*-
"""
QGIS forms can have a Python function that is called when the form is
opened.
@@ -2108,135 +2266,358 @@ from qgis.PyQt.QtWidgets import QWidget
def my_form_open(dialog, layer, feature):
geom = feature.geometry()
control = dialog.findChild(QWidget, "MyLineEdit")
-]]>
+
0
generatedlayout
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
"NAME_0"
-
+
+
+ 3.84850000000000003
+ 43.57310000000000372
+ 4.02449999999999974
+ 43.62810000000000343
+
+
+ 3.84850000000000003
+ 43.57310000000000372
+ 4.02450000000000152
+ 43.62809999999999633
+
+ raster_ea11ee6f_d5f4_4348_9724_68b302770ce9
+ ../../../../../python/lizmap-plugin/lizmap/test/data/raster.asc
+ raster
+
+
+
+ raster
+
+
+ GEOGCRS["WGS 84 (CRS84)",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic longitude (Lon)",east,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic latitude (Lat)",north,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Not known."],AREA["World."],BBOX[-90,-180,90,180]],ID["OGC","CRS84"]]
+ +proj=longlat +datum=WGS84 +no_defs
+ 63159
+ 520003159
+ OGC:CRS84
+ WGS 84 (CRS84)
+ longlat
+ EPSG:7030
+ true
+
+
+
+
+
+
+ dataset
+
+
+
+
+
+
+
+
+ GEOGCRS["WGS 84 (CRS84)",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic longitude (Lon)",east,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic latitude (Lat)",north,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Not known."],AREA["World."],BBOX[-90,-180,90,180]],ID["OGC","CRS84"]]
+ +proj=longlat +datum=WGS84 +no_defs
+ 63159
+ 520003159
+ OGC:CRS84
+ WGS 84 (CRS84)
+ longlat
+ EPSG:7030
+ true
+
+
+
+
+ gdal
+
+
+
+
+
+
+
+
+ 1
+ 1
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MinMax
+ WholeRaster
+ Estimated
+ 0.02
+ 0.98
+ 2
+
+
+ 50
+ 125
+ StretchToMinimumMaximum
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ resamplingFilter
+
+ 0
+
+
-5.1326269186972695
46.2791909857754149
@@ -2284,7 +2665,7 @@ def my_form_open(dialog, layer, feature):
-
+
@@ -2301,7 +2682,7 @@ def my_form_open(dialog, layer, feature):
-
+
@@ -2311,421 +2692,421 @@ def my_form_open(dialog, layer, feature):
ogr
-
-
-
-
+
+
+
+
-
+
-
-
+
+
1
1
1
0
-
+
-
+
-
-
+
+
+
-
+
-
-
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
-
+
-
-
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
-
+
-
-
+
+
+
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+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
-
+
0
- # -*- coding: utf-8 -*-
"""
QGIS forms can have a Python function that is called when the form is
opened.
@@ -3254,139 +3635,140 @@ from qgis.PyQt.QtWidgets import QWidget
def my_form_open(dialog, layer, feature):
geom = feature.geometry()
control = dialog.findChild(QWidget, "MyLineEdit")
-]]>
+
0
generatedlayout
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
"NAME_0"
-
-
-
+
+
+
+
@@ -3414,6 +3796,7 @@ def my_form_open(dialog, layer, feature):
5
2.5
+ false
false
false
1
@@ -3434,24 +3817,38 @@ def my_form_open(dialog, layer, feature):
1
+
+
+ lizmap_repository
+ lizmap_user
+ lizmap_user_groups
+
+
+ antoine
+
+
+
+
-5.338890814362023
44.01211922647708
3.3241928035576143
51.99354586649268
+ 1
+ legend_invalid
True
legend
-
-
+
+
+
-
-
+
+
@@ -3459,158 +3856,162 @@ def my_form_open(dialog, layer, feature):
-
+
+
+
+
Etienne Trimaille
2023-06-19T14:13:55
-
+
-
-
-
+
+
+
-
+
-
-
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
+
-
+
-
+
-
-
+
+
+
-
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
-
+
-
-
-
+
+
+
-
-
+
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
+
-
-
-
+
+
+
-
-
+
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
+
-
+
+
-
+
-
-
+
+
+
-
-
+
+
GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],MEMBER["World Geodetic System 1984 (G2139)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]]
+proj=longlat +datum=WGS84 +no_defs
@@ -3624,41 +4025,41 @@ def my_form_open(dialog, layer, feature):
-
-
+
+
-
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -3675,4 +4076,7 @@ def my_form_open(dialog, layer, feature):
-
+
+
+
+
\ No newline at end of file
diff --git a/test/data/raster.asc b/test/data/raster.asc
new file mode 100755
index 00000000..a70b95e7
--- /dev/null
+++ b/test/data/raster.asc
@@ -0,0 +1,15 @@
+NCOLS 16
+NROWS 5
+XLLCENTER 0
+YLLCENTER 47.618
+DX 0.011
+DY 0.011
+NODATA_VALUE -1
+050 050 050 050 050 050 050 050 050 050 050 050 050 050 050 050
+075 075 075 075 075 075 075 075 075 075 075 075 075 075 075 075
+100 100 100 100 100 100 100 100 100 100 100 100 100 100 100 100
+125 125 125 125 125 125 125 -1 -1 -1 -1 -1 125 125 125 125
+125 125 125 125 125 125 125 -1 -1 -1 -1 -1 125 125 125 125
+
+CRS
+NOTES
diff --git a/test/test_legend.py b/test/test_legend.py
index 693483cf..56ac58d6 100644
--- a/test/test_legend.py
+++ b/test/test_legend.py
@@ -166,6 +166,78 @@ def test_simple_rule_based_feature_count(client):
assert b['nodes'][0]['title'] == 'rule_based [4]', b['nodes'][0]['title']
+def test_valid_raster_layer(client):
+ """ Test valid raster layer. """
+ qs = dict(BASE_QUERY)
+ qs['MAP'] = PROJECT
+ qs['LAYER'] = 'raster'
+ rv = client.get(_build_query_string(qs), PROJECT)
+ b = _check_request(rv)
+
+ # Answer straight from QGIS Server
+ if Qgis.QGIS_VERSION_INT < 32200:
+ expected = {
+ 'nodes': [
+ {
+ 'symbols': [
+ {
+ # 'icon': '',
+ 'title': '50',
+ }, {
+ # 'icon': '',
+ 'title': '125',
+ },
+ ],
+ 'title': qs['LAYER'],
+ 'type': 'layer',
+ },
+ ],
+ 'title': '',
+ }
+ del b['nodes'][0]['symbols'][0]['icon']
+ del b['nodes'][0]['symbols'][1]['icon']
+ elif 32200 <= Qgis.QGIS_VERSION_INT < 33400:
+ expected = {
+ 'nodes': [
+ {
+ 'symbols': [
+ {
+ 'title': 'Band 1',
+ }, {
+ 'title': '',
+ },
+ ],
+ 'title': qs['LAYER'],
+ 'type': 'layer',
+ },
+ ],
+ 'title': '',
+ }
+ else:
+ expected = {
+ 'nodes': [
+ {
+ 'symbols': [
+ {
+ 'title': 'Band 1',
+ }, {
+ # 'icon': '',
+ 'max': 125,
+ 'min': 50,
+ 'title': '',
+ },
+ ],
+ 'title': qs['LAYER'],
+ 'type': 'layer',
+ },
+ ],
+ 'title': '',
+ }
+ del b['nodes'][0]['symbols'][1]['icon']
+
+ assert b == expected, b
+
+
def test_invalid_layer_symbol_layer(client):
""" Test unique symbol for layer. """
qs = dict(BASE_QUERY)
@@ -183,6 +255,36 @@ def test_invalid_layer_symbol_layer(client):
assert 'symbols' not in b['nodes'][0]
+def test_invalid_layer_raster_layer(client):
+ """ Test invalid raster layer. """
+ qs = dict(BASE_QUERY)
+ qs['MAP'] = PROJECT_INVALID
+ qs['LAYER'] = 'raster'
+ rv = client.get(_build_query_string(qs), PROJECT_INVALID)
+ b = _check_request(rv)
+
+ expected = {
+ 'title': '',
+ 'nodes': [
+ {
+ 'type': 'layer',
+ 'title': qs['LAYER'],
+ 'icon': GetLegendGraphicFilter.warning_icon(),
+ 'valid': False,
+ },
+ ],
+ }
+ assert b == expected, b
+
+ assert b['title'] == '', b
+ assert len(b['nodes']) == 1, b
+ assert b['nodes'][0]['title'] == qs['LAYER']
+ assert b['nodes'][0].get('valid') is False
+ assert b['nodes'][0].get('icon') == GetLegendGraphicFilter.warning_icon()
+ assert 'icon' in b['nodes'][0]
+ assert 'symbols' not in b['nodes'][0]
+
+
def test_invalid_layer_categorized_symbol_layer(client):
""" Test categorized symbol for layer. """
qs = dict(BASE_QUERY)
diff --git a/test/test_lizmap_accesscontrol.py b/test/test_lizmap_accesscontrol.py
index 105a0c0e..c55aac93 100644
--- a/test/test_lizmap_accesscontrol.py
+++ b/test/test_lizmap_accesscontrol.py
@@ -66,12 +66,14 @@ def test_invalid_layer(client):
layers = rv.xpath('//wms:Layer')
assert layers is not None
- assert len(layers) == 4, len(layers)
+ assert len(layers) == 5, len(layers)
# Layer is WMS
layer = "unique_symbol"
assert layer in rv.content.decode('utf-8')
+ assert 'raster' in rv.content.decode('utf-8')
+
qs['SERVICE'] = "WFS"
rv = client.get(_build_query_string(qs), project_invalid)
_check_request(rv, 'text/xml')