From 4bca5a93e14a86fffeeddec288ee3c5e7c448357 Mon Sep 17 00:00:00 2001 From: "arnaud.morvan@camptocamp.com" Date: Fri, 21 Feb 2020 17:52:57 +0100 Subject: [PATCH] [api] Fix getFeaturesFromIds For GMF layers with multiple child layers. --- api/src/Querent.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/api/src/Querent.js b/api/src/Querent.js index a8e9dc1bab3c..1372201a99b8 100644 --- a/api/src/Querent.js +++ b/api/src/Querent.js @@ -54,14 +54,20 @@ export function getFeaturesFromIds(layer, ids) { return; } - const featureIds = ids.map(id => `${layer}.${id}`); + const gmfLayer = /** @type import('gmf/themes.js').GmfLayerWMS */ (overlayDef.layer); + const childLayerNames = []; + let featureIds = []; + for (const childLayer of gmfLayer.childLayers) { + childLayerNames.push(childLayer.name); + featureIds = featureIds.concat(ids.map(id => `${childLayer.name}.${id}`)); + } const params = { 'FEATUREID': featureIds.join(','), - 'MAXFEATURES': ids.length, + 'MAXFEATURES': featureIds.length, 'REQUEST': 'GetFeature', 'SERVICE': 'WFS', - 'TYPENAME': layer, + 'TYPENAME': childLayerNames.join(','), 'VERSION': '1.0.0' }; const url = olUriAppendParams(overlayDef.ogcServer.urlWfs, params);