From c1ac8ecc817795a5b98a29f4546628be27007328 Mon Sep 17 00:00:00 2001 From: signedav Date: Thu, 18 Apr 2024 12:55:40 +0200 Subject: [PATCH] Concern multiple geometries in same layer for geopackage --- modelbaker/db_factory/gpkg_layer_uri.py | 5 +++++ modelbaker/iliwrapper/ili2dbconfig.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/modelbaker/db_factory/gpkg_layer_uri.py b/modelbaker/db_factory/gpkg_layer_uri.py index 20cb936..44b425c 100644 --- a/modelbaker/db_factory/gpkg_layer_uri.py +++ b/modelbaker/db_factory/gpkg_layer_uri.py @@ -31,7 +31,12 @@ def __init__(self, uri): self.provider = "ogr" def get_data_source_uri(self, record): + data_source_uri = "{uri}|layername={table}".format( uri=self.uri, table=record["tablename"] ) + if record["geometry_column"]: + data_source_uri = "{} ({})".format( + data_source_uri, record["geometry_column"] + ) return data_source_uri diff --git a/modelbaker/iliwrapper/ili2dbconfig.py b/modelbaker/iliwrapper/ili2dbconfig.py index 2dde42e..67033b8 100644 --- a/modelbaker/iliwrapper/ili2dbconfig.py +++ b/modelbaker/iliwrapper/ili2dbconfig.py @@ -20,6 +20,7 @@ from qgis.core import QgsNetworkAccessManager from qgis.PyQt.QtNetwork import QNetworkProxy +from .globals import DbIliMode from .ili2dbutils import get_all_modeldir_in_path @@ -298,6 +299,10 @@ def to_ili2db_args(self, extra_args=[], with_action=True): elif self.db_ili_version is None or self.db_ili_version > 3: self.append_args(args, ["--createBasketCol=False"]) + print(f"{self.tool} is") + if self.tool == DbIliMode.gpkg: + self.append_args(args, ["--gpkgMultiGeomPerTable"], True) + self.append_args(args, ["--defaultSrsAuth", self.srs_auth]) self.append_args(args, ["--defaultSrsCode", "{}".format(self.srs_code)])