Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression with basemap creation, which also uses area of interest #73

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions libqfieldsync/offline_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ def __init__(
self.attachment_dirs = attachment_dirs
self.dirs_to_copy = dirs_to_copy

assert (
self.area_of_interest_crs.isValid()
), f"Invalid CRS specified for area of interest {area_of_interest_crs}"

self.offliner = offliner

self.offliner.layerProgressUpdated.connect(self._on_offline_editing_next_layer)
Expand All @@ -124,6 +120,15 @@ def __init__(

self.project_configuration = ProjectConfiguration(project)

if (
self.project_configuration.offline_copy_only_aoi
or self.project_configuration.create_base_map
):
assert self.area_of_interest.isValid()[0]
assert (
self.area_of_interest_crs.isValid()
), f"Invalid CRS specified for area of interest {area_of_interest_crs}"

# flake8: noqa: max-complexity: 33
def convert(self, reload_original_project: bool = True) -> None:
"""
Expand Down Expand Up @@ -295,7 +300,7 @@ def _convert(self, project: QgsProject) -> None:
gpkg_filename = str(self.export_folder.joinpath("data.gpkg"))
if offline_layers:
bbox = None
if self.area_of_interest.isValid():
if self.project_configuration.offline_copy_only_aoi:
bbox = QgsCoordinateTransform(
QgsCoordinateReferenceSystem(self.area_of_interest_crs),
QgsProject.instance().crs(),
Expand Down
Loading