-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
26 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,28 +2,25 @@ | |
__license__ = 'GPL version 3' | ||
__email__ = '[email protected]' | ||
|
||
import binascii | ||
|
||
from functools import lru_cache | ||
from typing import Tuple, Union | ||
|
||
from qgis.core import ( | ||
Qgis, | ||
QgsCoordinateReferenceSystem, | ||
QgsCoordinateTransform, | ||
QgsDataSourceUri, | ||
QgsFeatureRequest, | ||
QgsGeometry, | ||
QgsProject, | ||
QgsProviderConnectionException, | ||
QgsProviderRegistry, | ||
QgsSpatialIndex, | ||
QgsVectorLayer, | ||
) | ||
from qgis.PyQt.QtCore import QVariant | ||
|
||
if Qgis.QGIS_VERSION_INT > 31000: | ||
import binascii | ||
|
||
from qgis.core import QgsProviderRegistry | ||
|
||
from lizmap_server.logger import Logger, profiling | ||
|
||
# TODO implement LRU cache with this variable | ||
|
@@ -161,7 +158,7 @@ def subset_sql(self, groups: tuple) -> Tuple[str, str]: | |
|
||
# We need to have a cache for this, valid for the combo polygon layer id & user_groups | ||
# as it will be done for each WMS or WFS query | ||
if self.polygon.providerType() == 'postgres' and Qgis.QGIS_VERSION_INT > 31000: | ||
if self.polygon.providerType() == 'postgres': | ||
polygon = self._polygon_for_groups_with_sql_query(groups) | ||
else: | ||
polygon = self._polygon_for_groups_with_qgis_api(groups) | ||
|
@@ -178,7 +175,7 @@ def subset_sql(self, groups: tuple) -> Tuple[str, str]: | |
) | ||
|
||
if self.layer.providerType() == 'postgres': | ||
if self.use_st_relationship or Qgis.QGIS_VERSION_INT > 31000: | ||
if self.use_st_relationship: | ||
uri = QgsDataSourceUri(self.layer.source()) | ||
use_st_intersect = False if self.spatial_relationship == 'contains' else True | ||
st_relation = self._format_sql_st_relationship( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[general] | ||
name=Lizmap server | ||
qgisMinimumVersion=3.4 | ||
qgisMinimumVersion=3.10 | ||
qgisMaximumVersion=3.99 | ||
author=3Liz | ||
[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
__license__ = 'GPL version 3' | ||
__email__ = '[email protected]' | ||
|
||
from qgis.core import Qgis | ||
from qgis.server import QgsServerInterface, QgsServerOgcApi | ||
|
||
from lizmap_server.expression_service import ExpressionService | ||
|
@@ -11,11 +10,9 @@ | |
from lizmap_server.lizmap_filter import LizmapFilter | ||
from lizmap_server.lizmap_service import LizmapService | ||
from lizmap_server.logger import Logger | ||
from lizmap_server.server_info_handler import ServerInfoHandler | ||
from lizmap_server.tools import check_environment_variable, version | ||
|
||
if Qgis.QGIS_VERSION_INT >= 31000: | ||
from lizmap_server.server_info_handler import ServerInfoHandler | ||
|
||
|
||
class LizmapServer: | ||
"""Plugin for QGIS server | ||
|
@@ -30,22 +27,17 @@ def __init__(self, server_iface: QgsServerInterface) -> None: | |
service_registry = server_iface.serviceRegistry() | ||
|
||
# Register API | ||
if Qgis.QGIS_VERSION_INT < 31000: | ||
self.logger.warning( | ||
'Not possible to register the API needed for Lizmap Web Client ≥ 3.5. ' | ||
'QGIS Server/Desktop must be 3.10 minimum.') | ||
else: | ||
lizmap_api = QgsServerOgcApi( | ||
self.server_iface, | ||
'/lizmap', | ||
'Lizmap', | ||
'The Lizmap API endpoint', | ||
self.version) | ||
service_registry.registerApi(lizmap_api) | ||
lizmap_api.registerHandler(ServerInfoHandler()) | ||
self.logger.info('API "/lizmap" loaded with the server info handler') | ||
lizmap_api = QgsServerOgcApi( | ||
self.server_iface, | ||
'/lizmap', | ||
'Lizmap', | ||
'The Lizmap API endpoint', | ||
self.version) | ||
service_registry.registerApi(lizmap_api) | ||
lizmap_api.registerHandler(ServerInfoHandler()) | ||
self.logger.info('API "/lizmap" loaded with the server info handler') | ||
|
||
check_environment_variable() | ||
check_environment_variable() | ||
|
||
# Register service | ||
try: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters