aboutsummaryrefslogtreecommitdiffstats
path: root/webmap-publish
diff options
context:
space:
mode:
Diffstat (limited to 'webmap-publish')
-rwxr-xr-xwebmap-publish9
1 files changed, 8 insertions, 1 deletions
diff --git a/webmap-publish b/webmap-publish
index 1c1e9a2..f3c6c5d 100755
--- a/webmap-publish
+++ b/webmap-publish
@@ -212,7 +212,14 @@ def getSourceLayer(ds_src, layerdef, extent=None):
elif ogr.GT_IsSubClassOf(geomType, ogr.wkbCurve) or ogr.GT_IsSubClassOf(geomType, ogr.wkbMultiCurve):
columns.append('ROUND(CAST(ST_Length(m.' + geomFieldName_esc + ') * '
+ str(linearUnits) + ' AS numeric), 2) AS "GeomLength"')
- columns.append('m.' + geomFieldName_esc)
+
+ transform_geometry = layerdef.get('transform-geometry', None)
+ if transform_geometry is None:
+ columns.append('m.' + geomFieldName_esc)
+ elif transform_geometry == 'centroid':
+ columns.append('ST_Centroid(m.' + geomFieldName_esc + ') AS ' + geomFieldName_esc)
+ else:
+ raise Exception(f'Unsupported geometry transformation: {transform_geometry}')
query = 'SELECT ' + ', '.join(columns) + ' FROM ' + escapeIdentifier(lyr_src.GetName()) + ' m'