Skip to content

Commit

Permalink
getMetadataRecordById: fix finding metadataURL in GetCapabilities doc…
Browse files Browse the repository at this point in the history
…uments with multiple layers

- layer names might not have : in them, only geoserver does this
- reuse removeWorkspace from layers epic to properly extract layer name
- make sure to use metadataURL children XML element, not the layer itself
  • Loading branch information
landryb committed Feb 14, 2022
1 parent 388e066 commit 6ac558a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion web/client/epics/catalog.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
setSupportedFormats, ADD_LAYER_AND_DESCRIBE, describeError, addLayer
} from '../actions/catalog';
import {showLayerMetadata, SELECT_NODE, changeLayerProperties, addLayer as addNewLayer} from '../actions/layers';
import { removeWorkspace } from '../epics/layers';
import { error, success } from '../actions/notifications';
import { SET_CONTROL_PROPERTY, setControlProperties, setControlProperty } from '../actions/controls';
import { closeFeatureGrid } from '../actions/featuregrid';
Expand Down Expand Up @@ -325,7 +326,7 @@ export default (API) => ({
return Rx.Observable.defer(() => API.wms.getCapabilities(getCapabilitiesUrl(layer)))
.switchMap((caps) => {
const layersXml = get(caps, 'capability.layer.layer', [get(caps, 'capability.layer')]);
const metadataUrls = layersXml.length === 1 ? layersXml[0].metadataURL : find(layersXml, l => l.name === layer.name.split(':')[1]);
const metadataUrls = layersXml.length === 1 ? layersXml[0].metadataURL : find(layersXml, l => l.name === removeWorkspace(layer.name)).metadataURL;
const metadataUrl = get(find(metadataUrls, mUrl => isString(mUrl.type) &&
mUrl.type.toLowerCase() === 'iso19115:2003' &&
(mUrl.format === 'application/xml' || mUrl.format === 'text/xml')), 'onlineResource.href');
Expand Down

0 comments on commit 6ac558a

Please sign in to comment.