From d375ecd3737b984980fdda2917b6415034dfe346 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Tue, 11 Jun 2024 17:00:38 +0200 Subject: 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. --- webmap-import | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'webmap-import') 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() -- cgit v1.2.3