From d0fd81e8165a2e2c9b51ba174d9ad5b4b777a594 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Sun, 29 Oct 2023 09:34:01 +0700 Subject: [PATCH] Fix exporting of geometry-less vector layers when offlining using area of interest --- offline_converter.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/offline_converter.py b/offline_converter.py index d50fdaa..e2cc5ca 100644 --- a/offline_converter.py +++ b/offline_converter.py @@ -253,15 +253,22 @@ def _convert(self, project: QgsProject) -> None: if layer_action == SyncAction.OFFLINE: if self.project_configuration.offline_copy_only_aoi: - extent = QgsCoordinateTransform( - QgsCoordinateReferenceSystem(self.area_of_interest_crs), - layer.crs(), - QgsProject.instance(), - ).transformBoundingBox(self.area_of_interest.boundingBox()) - layer.selectByRect(extent) - - if not layer.selectedFeatureCount(): - layer.selectByIds([FID_NULL]) + if ( + layer.geometryType() is not Qgis.GeometryType.Null + and layer.geometryType() is not Qgis.GeometryType.Unknown + ): + extent = QgsCoordinateTransform( + QgsCoordinateReferenceSystem(self.area_of_interest_crs), + layer.crs(), + QgsProject.instance(), + ).transformBoundingBox(self.area_of_interest.boundingBox()) + layer.selectByRect(extent) + + if not layer.selectedFeatureCount(): + layer.selectByIds([FID_NULL]) + else: + # insure that geometry-less layers do not have selected features that would interfere with the process + layer.removeSelection() self.__offline_layers.append(layer) self.__offline_layer_names.append(layer.name())