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 3abd509
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import config from './src/constants.js';
import Map from './src/Map.js';

config.themesUrl = 'https://geomapfish-demo-2-4.camptocamp.com/themes?' +
'version=2&background=background&interface=api';
'version=2&background=background&interface=desktop';

config.localeUrl = 'https://geomapfish-demo-2-4.camptocamp.com/locale.json';

Expand Down
11 changes: 8 additions & 3 deletions api/src/Querent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 3abd509

Please sign in to comment.