aboutsummaryrefslogtreecommitdiffstats
path: root/webmap-import
diff options
context:
space:
mode:
Diffstat (limited to 'webmap-import')
-rwxr-xr-xwebmap-import49
1 files changed, 14 insertions, 35 deletions
diff --git a/webmap-import b/webmap-import
index 5be25ca..ef728a9 100755
--- a/webmap-import
+++ b/webmap-import
@@ -53,7 +53,6 @@ from common import (
getSourcePathLockFileName
)
from common_gdal import (
- gdalVersionMin,
gdalGetMetadataItem,
getSRS,
getExtent,
@@ -99,21 +98,10 @@ def validate_schema(layers : dict[str, Any],
(We need the driver of the output dataset to determine capability on
constraints.)"""
- # Cf. https://github.com/OSGeo/gdal/blob/master/NEWS.md
- if gdalVersionMin(maj=3, min=7):
- # list of capability flags supported by the CreateField() API
- drvoFieldDefnFlags = drvo.GetMetadataItem(gdalconst.DMD_CREATION_FIELD_DEFN_FLAGS)
- drvoFieldDefnFlags = drvoFieldDefnFlags.split(' ') if drvoFieldDefnFlags is not None else []
- drvoSupportsFieldComment = 'Comment' in drvoFieldDefnFlags
- # GetTZFlag()/SetTZFlag() and OGR_TZFLAG_* constants added in 3.8.0
- hasTZFlagSupport = gdalVersionMin(maj=3, min=8)
- else:
- # list of flags supported by the OGRLayer::AlterFieldDefn() API
- drvoFieldDefnFlags = drvo.GetMetadataItem(gdalconst.DMD_ALTER_FIELD_DEFN_FLAGS)
- drvoFieldDefnFlags = drvoFieldDefnFlags.split(' ') if drvoFieldDefnFlags is not None else []
- # GetComment()/SetComment() added in 3.7.0
- drvoSupportsFieldComment = False
- hasTZFlagSupport = False
+ # list of capability flags supported by the CreateField() API
+ drvoFieldDefnFlags = drvo.GetMetadataItem(gdalconst.DMD_CREATION_FIELD_DEFN_FLAGS)
+ drvoFieldDefnFlags = drvoFieldDefnFlags.split(' ') if drvoFieldDefnFlags is not None else []
+ drvoSupportsFieldComment = 'Comment' in drvoFieldDefnFlags
# cache driver capabilities
drvoSupportsFieldWidthPrecision = 'WidthPrecision' in drvoFieldDefnFlags
@@ -177,11 +165,7 @@ def validate_schema(layers : dict[str, Any],
elif k2 == 'subtype':
fld_def2['SubType'] = parseSubFieldType(v)
elif k2 == 'tz':
- if hasTZFlagSupport:
- fld_def2['TZFlag'] = parseTimeZone(v)
- else:
- logging.debug('Ignoring TZ="%s" on field "%s" (OGR v%s is too old)',
- v, fld_name, gdal.__version__)
+ fld_def2['TZFlag'] = parseTimeZone(v)
elif k2 == 'width' and v is not None and isinstance(v, int):
setFieldIf(drvoSupportsFieldWidthPrecision,
'Width', v, fld_def2, fld_name, drvo.ShortName)
@@ -390,12 +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
-# gdalVersionMin(maj=3, min=7) and
-# lyr.TestCapability(ogr.OLCUpdateFeature)):
-# logging.warning('Layer "%s" does not support OLCUpdateFeature capability, '
-# 'ignoring cache', name)
-# return None
+ #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 = [
@@ -424,11 +406,10 @@ def validateCacheLayer(ds : gdal.Dataset, name : str) -> bool:
logging.warning('Layer cache "%s" has %d > 0 geometry field(s): %s',
name, n, ', '.join(geomFieldNames))
- if gdalVersionMin(maj=3, min=5):
- style = lyr.GetStyleTable()
- if style is not None:
- logging.warning('Layer cache "%s" has a style table "%s"',
- name, style.GetLastStyleName())
+ style = lyr.GetStyleTable()
+ if style is not None:
+ logging.warning('Layer cache "%s" has a style table "%s"',
+ name, style.GetLastStyleName())
return True
def areSourceFilesNewer(layername : str,
@@ -482,9 +463,7 @@ def areSourceFilesNewer(layername : str,
# https://gdal.org/en/stable/api/python/vector_api.html#osgeo.ogr.Feature.GetFieldAsDateTime
# [ year, month, day, hour, minute, second, timezone flag ]
dt = feature.GetFieldAsDateTime(1)
- if not gdalVersionMin(maj=3, min=8):
- tz = None # assume local time
- elif dt[6] == ogr.TZFLAG_UNKNOWN:
+ if dt[6] == ogr.TZFLAG_UNKNOWN:
logging.warning('Datetime specified with unknown timezone in layer cache\'s '
'field #%d "%s", assuming local time', 1,
feature.GetDefnRef().GetFieldDefn(1).GetName())