aboutsummaryrefslogtreecommitdiffstats
path: root/webmap-import
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2025-08-14 17:33:21 +0200
committerGuilhem Moulin <guilhem@fripost.org>2025-08-14 18:23:16 +0200
commit7d0dafa2d6c41e594217b784e19c0e463c062bce (patch)
tree482d688aba2b592bfaa334d848b4c698f21d0ba0 /webmap-import
parentf7785f929a4402a98a2d0bd428ba00968be8cf01 (diff)
Add a NOT NULL contraint on geometry columns when creating the output layer.
When the output driver supports altering GeomFieldDefn's nullable flag after the fact. PostgreSQL supports that. GPKG doesn't, but one can use GEOMETRY_NULLABLE=NO in layer creation options instead. See https://gdal.org/en/stable/development/rfc/rfc53_ogr_notnull_default.html This commit partially reverts 2c3ee79cb434fc4cf315ee3a6a526156053d76c4.
Diffstat (limited to 'webmap-import')
-rwxr-xr-xwebmap-import9
1 files changed, 9 insertions, 0 deletions
diff --git a/webmap-import b/webmap-import
index b4552d5..a68d60e 100755
--- a/webmap-import
+++ b/webmap-import
@@ -256,6 +256,15 @@ def processOutputLayer(ds : gdal.Dataset,
raise RuntimeError(f'Output layer "{layername}" has no working '
'CreateFeature() method')
+ geom_field_idx = 0
+ geom_field = lyr.GetLayerDefn().GetGeomFieldDefn(geom_field_idx)
+ logging.debug('Geometry column #%d: name="%s\", type="%s", srs=%s, nullable=%s',
+ geom_field_idx, geom_field.GetName(),
+ ogr.GeometryTypeToName(geom_field.GetType()),
+ '-' if geom_field.GetSpatialRef() is None
+ else '"' + geom_field.GetSpatialRef().GetName() + '"',
+ bool(geom_field.IsNullable()))
+
sources = layerdef['sources']
if not (lyrcache is None or force or
areSourceFilesNewer(layername, sources=sources,