Skip to content

Commit

Permalink
Merge pull request #87 from opengisch/gpkg
Browse files Browse the repository at this point in the history
GPKG per default
  • Loading branch information
m-kuhn authored Sep 17, 2018
2 parents 4616646 + a4283fd commit 1867188
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions qfieldsync/core/offline_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,24 @@ def convert(self):

# save the offline project twice so that the offline plugin can "know" that it's a relative path
QgsProject.instance().write(project_path)

# Run the offline plugin
spatialite_filename = "data.sqlite"
if self.__offline_layers:
offline_layer_ids = [l.id() for l in self.__offline_layers]
if not self.offline_editing.convertToOfflineProject(self.export_folder, spatialite_filename,
offline_layer_ids,
self.project_configuration.offline_copy_only_aoi):
raise Exception(self.tr("Error trying to convert layers to offline layers"))
try:
# Run the offline plugin for gpkg
gpkg_filename = "data.gpkg"
if self.__offline_layers:
offline_layer_ids = [l.id() for l in self.__offline_layers]
if not self.offline_editing.convertToOfflineProject(self.export_folder, gpkg_filename,
offline_layer_ids,
self.project_configuration.offline_copy_only_aoi, self.offline_editing.GPKG):
raise Exception(self.tr("Error trying to convert layers to offline layers"))
except AttributeError:
# Run the offline plugin for spatialite
spatialite_filename = "data.sqlite"
if self.__offline_layers:
offline_layer_ids = [l.id() for l in self.__offline_layers]
if not self.offline_editing.convertToOfflineProject(self.export_folder, spatialite_filename,
offline_layer_ids,
self.project_configuration.offline_copy_only_aoi):
raise Exception(self.tr("Error trying to convert layers to offline layers"))

# Now we have a project state which can be saved as offline project
QgsProject.instance().write(project_path)
Expand Down

0 comments on commit 1867188

Please sign in to comment.