diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2024-10-19 17:08:33 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2024-10-19 18:12:10 +0200 |
commit | 4f56801e9737e1f9201ea5e2d1f23f759d65d437 (patch) | |
tree | 912a7bbf58c45e6f1859bd3d8ba43d61cea3fe53 /webmap-publish | |
parent | e61fd88fe81363d8f84e8f9c42b52c64314c4286 (diff) |
Add layers from Svenska Kraftnät (SvK).
Diffstat (limited to 'webmap-publish')
-rwxr-xr-x | webmap-publish | 9 |
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' |