From f7785f929a4402a98a2d0bd428ba00968be8cf01 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Thu, 14 Aug 2025 15:59:29 +0200 Subject: =?UTF-8?q?Use=20.UpdateFeature()=20from=20gdal=20=E2=89=A53.7.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- import_source.py | 3 +-- webmap-import | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/import_source.py b/import_source.py index 795bf0f..1948f7b 100644 --- a/import_source.py +++ b/import_source.py @@ -1052,8 +1052,7 @@ def updateLayerCache(lyr : ogr.Layer, cache : ogr.Layer, logging.info('Updated layer "%s" has identical fingerprint %s', layername, fingerprint.hex()[:8]) - # TODO with gdal 3.7 and OLCUpdateFeature capability, use UpdateFeature() instead - if cache.SetFeature(feature) != ogr.OGRERR_NONE: + if cache.UpdateFeature(feature, [1,2], [], False) != ogr.OGRERR_NONE: raise RuntimeError('Could not update feature in layer cache') else: if cache.CreateFeature(feature) != ogr.OGRERR_NONE: diff --git a/webmap-import b/webmap-import index 95c3b41..b4552d5 100755 --- a/webmap-import +++ b/webmap-import @@ -374,10 +374,10 @@ def validateCacheLayer(ds : gdal.Dataset, name : str) -> bool: logging.warning('Table "%s" does not exist', name) return False - #if not (lyr.TestCapability(ogr.OLCRandomWrite) and lyr.TestCapability(ogr.OLCUpdateFeature)): - # logging.warning('Layer "%s" does not support OLCUpdateFeature capability, ' - # 'ignoring cache', name) - # return False + if not (lyr.TestCapability(ogr.OLCRandomWrite) and lyr.TestCapability(ogr.OLCUpdateFeature)): + logging.warning('Layer "%s" does not support OLCUpdateFeature capability, ' + 'ignoring cache', name) + return False defn = lyr.GetLayerDefn() fields = [ -- cgit v1.2.3