aboutsummaryrefslogtreecommitdiffstats
path: root/webmap-import
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2024-06-11 17:00:38 +0200
committerGuilhem Moulin <guilhem@fripost.org>2024-06-11 17:03:52 +0200
commitd375ecd3737b984980fdda2917b6415034dfe346 (patch)
treed2c5b175329dd3a112bf4d08e2cea24f105dbf7c /webmap-import
parent131fa48317966984cc89faa4ff87980811372875 (diff)
webmap-import: Add error-checking for CreateFeature().
Despite using gdal.UseExceptions() a failed call doesn't raise an exception, so we need to check the return value to avoid missing features.
Diffstat (limited to 'webmap-import')
-rwxr-xr-xwebmap-import4
1 files changed, 3 insertions, 1 deletions
diff --git a/webmap-import b/webmap-import
index fccdc84..56d907c 100755
--- a/webmap-import
+++ b/webmap-import
@@ -994,7 +994,9 @@ def importSource2(lyr_dst, path, args={}, basedir=None, extent=None):
f'to {ogr.GeometryTypeToName(eGType_dst)} not implemented')
feature2.SetGeometryDirectly(geom)
- lyr_dst.CreateFeature(feature2)
+ if lyr_dst.CreateFeature(feature2) != ogr.OGRERR_NONE:
+ raise Exception(f'Could not transfer source feature #{feature.GetFID()}')
+
n += 1
feature = lyr.GetNextFeature()