Skip to content

Commit

Permalink
Use the matrixSet value from the WMTS layer config
Browse files Browse the repository at this point in the history
  • Loading branch information
fredj committed Feb 23, 2018
1 parent 1a44f76 commit 500237d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion contribs/gmf/src/services/syncLayertreeMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ gmf.SyncLayertreeMap.prototype.createWMTSLayer_ = function(gmfLayerWMTS) {
goog.asserts.assert(gmfLayerWMTS.url);
goog.asserts.assert(gmfLayerWMTS.layer);
this.layerHelper_.createWMTSLayerFromCapabilitites(gmfLayerWMTS.url,
gmfLayerWMTS.layer, gmfLayerWMTS.dimensions).then((layer) => {
gmfLayerWMTS.layer, gmfLayerWMTS.matrixSet, gmfLayerWMTS.dimensions).then((layer) => {
newLayer.setSource(layer.getSource());
newLayer.set('capabilitiesStyles', layer.get('capabilitiesStyles'));
});
Expand Down
1 change: 1 addition & 0 deletions contribs/gmf/src/services/themesservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ gmf.Themes.prototype.getBgLayers = function() {
return layerHelper.createWMTSLayerFromCapabilitites(
gmfLayerWMTS.url,
gmfLayerWMTS.layer || '',
gmfLayerWMTS.matrixSet,
gmfLayer.dimensions
).then(callback.bind(null, gmfLayer)).then(null, (response) => {
let message = `Unable to build layer "${gmfLayerWMTS.layer}" from WMTSCapabilities: ${gmfLayerWMTS.url}\n`;
Expand Down
4 changes: 3 additions & 1 deletion src/services/layerHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,13 @@ ngeo.LayerHelper.prototype.createBasicWMSLayer = function(sourceURL,
* as key 'capabilitiesStyles' as param of the new layer.
* @param {string} capabilitiesURL The getCapabilities url.
* @param {string} layerName The name of the layer.
* @param {string|undefined} opt_matrixSet Optional WMTS matrix set.
* @param {Object.<string, string>=} opt_dimensions WMTS dimensions.
* @return {angular.$q.Promise.<ol.layer.Tile>} A Promise with a layer (with source) on success,
* no layer else.
* @export
*/
ngeo.LayerHelper.prototype.createWMTSLayerFromCapabilitites = function(capabilitiesURL, layerName, opt_dimensions) {
ngeo.LayerHelper.prototype.createWMTSLayerFromCapabilitites = function(capabilitiesURL, layerName, opt_matrixSet, opt_dimensions) {
const parser = new ol.format.WMTSCapabilities();
const layer = new ol.layer.Tile({
preload: Infinity
Expand All @@ -125,6 +126,7 @@ ngeo.LayerHelper.prototype.createWMTSLayerFromCapabilitites = function(capabilit
}
if (result) {
const options = ol.source.WMTS.optionsFromCapabilities(result, {
matrixSet: opt_matrixSet,
crossOrigin: 'anonymous',
layer: layerName
});
Expand Down

0 comments on commit 500237d

Please sign in to comment.