Skip to content

Commit

Permalink
Fix exporting of geometry-less vector layers when offlining using are…
Browse files Browse the repository at this point in the history
…a of interest
  • Loading branch information
nirvn committed Oct 29, 2023
1 parent 313f1a5 commit d0fd81e
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions offline_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit d0fd81e

Please sign in to comment.