Skip to content

Commit

Permalink
Added GetMap onlineResource to layer in getCapabilities (#1448)
Browse files Browse the repository at this point in the history
* Added GetMap onlineResource to layer

* fixe on Mauro's request
  • Loading branch information
kappu72 authored and mbarto committed Feb 13, 2017
1 parent d8e1e31 commit 053933c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions web/client/api/WMS.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ const flatLayers = (root) => {
return previous.concat(flatLayers(current)).concat((current.Layer && current.Name) ? [current] : []);
}, []) : (root.Name && [root] || []);
};

const getOnlineResource = (c) => {
return c.Request && c.Request.GetMap && c.Request.GetMap.DCPType && c.Request.GetMap.DCPType.HTTP && c.Request.GetMap.DCPType.HTTP.Get && c.Request.GetMap.DCPType.HTTP.Get.OnlineResource && c.Request.GetMap.DCPType.HTTP.Get.OnlineResource.$ || undefined;
};
const searchAndPaginate = (json, startPosition, maxRecords, text) => {
const root = (json.WMS_Capabilities || json.WMT_MS_Capabilities).Capability;
const onlineResource = getOnlineResource(root);
const SRSList = (root.Layer && (root.Layer.SRS || root.Layer.CRS)) || [];
const layersObj = flatLayers(root);
const layers = isArray(layersObj) ? layersObj : [layersObj];
Expand All @@ -48,7 +51,7 @@ const searchAndPaginate = (json, startPosition, maxRecords, text) => {
service: json.WMS_Capabilities.Service,
records: filteredLayers
.filter((layer, index) => index >= (startPosition - 1) && index < (startPosition - 1) + maxRecords)
.map((layer) => assign({}, layer, {SRS: SRSList}))
.map((layer) => assign({}, layer, {onlineResource, SRS: SRSList}))
};
};

Expand Down

0 comments on commit 053933c

Please sign in to comment.