Skip to content

Commit

Permalink
[api] Fix getFeaturesFromIds
Browse files Browse the repository at this point in the history
For GMF layers with multiple child layers.
  • Loading branch information
arnaud-morvan committed May 28, 2020
1 parent 116200f commit 1a38265
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions api/src/Querent.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function getFeaturesFromIds(layer, ids) {

/** Array<import('ol/Feature.js').default> */
let features = [];
const overlayDef = overlayDefs.get(layer);
const overlayDef = /** @type import('gmf/themes.js').GmfLayerWMS */ overlayDefs.get(layer);

if (!overlayDef) {
reject(`Layer "${layer}" was not found in themes.`);
Expand All @@ -54,14 +54,19 @@ export function getFeaturesFromIds(layer, ids) {
return;
}

const featureIds = ids.map(id => `${layer}.${id}`);
const childLayerNames = [];
let featureIds = [];
for (const childLayer of overlayDef.layer.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);
Expand Down

0 comments on commit 1a38265

Please sign in to comment.