diff --git a/modules/renderer/background_source.js b/modules/renderer/background_source.js index 8546082ba..770dcc60d 100644 --- a/modules/renderer/background_source.js +++ b/modules/renderer/background_source.js @@ -112,19 +112,19 @@ export function rendererBackgroundSource(data) { source.url = function(coord) { - var result = _template; + var result = _template.replace(/#.*/su, ''); // strip hash part of URL if (result === '') return result; // source 'none' // Guess a type based on the tokens present in the template // (This is for 'custom' source, where we don't know) if (!source.type || source.id === 'custom') { - if (/SERVICE=WMS|\{(proj|wkid|bbox)\}/.test(_template)) { + if (/SERVICE=WMS|\{(proj|wkid|bbox)\}/.test(result)) { source.type = 'wms'; source.projection = 'EPSG:3857'; // guess - } else if (/\{(x|y)\}/.test(_template)) { + } else if (/\{(x|y)\}/.test(result)) { source.type = 'tms'; - } else if (/\{u\}/.test(_template)) { + } else if (/\{u\}/.test(result)) { source.type = 'bing'; } }