diff --git a/src/featureinfo.js b/src/featureinfo.js index abcac4bed..1449b9ee1 100644 --- a/src/featureinfo.js +++ b/src/featureinfo.js @@ -150,6 +150,10 @@ const Featureinfo = function Featureinfo(options = {}) { selection.coordinates = firstFeature.getGeometry().getCoordinates(); selection.id = firstFeature.getId() != null ? firstFeature.getId() : firstFeature.ol_uid; selection.type = typeof selectionLayer.getSourceLayer() === 'string' ? selectionLayer.getFeatureLayer().type : selectionLayer.getSourceLayer().get('type'); + if (selection.type === 'WFS') { + const idSuffix = selection.id.substring(selection.id.lastIndexOf('.') + 1, selection.id.length); + selection.id = `${selectionLayer.getSourceLayer().get('name')}.${idSuffix}`; + } if (selection.type !== 'WFS') { const name = typeof selectionLayer.getSourceLayer() === 'string' ? selectionLayer.getSourceLayer() : selectionLayer.getSourceLayer().get('name'); const id = firstFeature.getId() || selection.id; diff --git a/src/viewer.js b/src/viewer.js index 02313485a..73cd7fe17 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -406,7 +406,7 @@ const Viewer = function Viewer(targetOption, options = {}) { }); if (urlParams.feature) { - const featureId = urlParams.feature; + let featureId = urlParams.feature; const layerName = featureId.split('.')[0]; const layer = getLayer(layerName); const type = layer.get('type'); @@ -420,6 +420,9 @@ const Viewer = function Viewer(targetOption, options = {}) { if (type === 'WFS' && clusterSource) { feature = clusterSource.getFeatureById(featureId); } else if (type === 'WFS') { + if (featureId.includes('__')) { + featureId = featureId.replace(featureId.substring(featureId.lastIndexOf('__'), featureId.lastIndexOf('.')), ''); + } feature = layer.getSource().getFeatureById(featureId); } else if (clusterSource) { feature = clusterSource.getFeatureById(id);