diff --git a/src/map-extent.js b/src/map-extent.js index bee176365..d4d5979d4 100644 --- a/src/map-extent.js +++ b/src/map-extent.js @@ -375,7 +375,7 @@ export class MapExtent extends HTMLElement { } getMeta(metaName) { let name = metaName.toLowerCase(); - if (name !== 'extent' && name !== 'zoom') return; + if (name !== 'extent' && name !== 'zoom' && name !== 'cs') return; return this.parentLayer.src ? this.querySelector(`:scope > map-meta[name=${name}]`) || this.parentLayer.shadowRoot.querySelector( diff --git a/src/map-feature.js b/src/map-feature.js index dae5bf915..10839a760 100644 --- a/src/map-feature.js +++ b/src/map-feature.js @@ -285,30 +285,22 @@ export class MapFeature extends HTMLElement { // native cs: used by FeatureLayer._geometryToLayer(...), // the fallback cs for map-geometry if its cs attribute is not specified _getFallbackCS() { - let csMeta, cs; + let csMeta; if (this._parentEl.nodeName === 'MAP-LINK') { - // feature attaches to link's shadow - csMeta = this._parentEl.shadowRoot.querySelector( - 'map-meta[name=cs][content]' - ); - let linkCS = this._parentEl._templateVars.values.find( - (input) => input.units - )?.units; - cs = csMeta - ? M._metaContentToObject(csMeta.getAttribute('content')).content - : linkCS - ? linkCS - : 'gcrs'; + // feature attaches to link's shadow root + csMeta = + this._parentEl.shadowRoot.querySelector('map-meta[name=cs][content]') || + this._parentEl.parentElement.getMeta('cs'); } else { let layerEl = this.getLayerEl(); csMeta = layerEl.src - ? layerEl.shadowRoot.querySelector('map-meta[name=cs]') - : layerEl.querySelector('map-meta[name=cs]'); - cs = csMeta - ? M._metaContentToObject(csMeta.getAttribute('content')).content - : 'gcrs'; + ? layerEl.shadowRoot.querySelector('map-meta[name=cs][content]') + : layerEl.querySelector('map-meta[name=cs][content]'); } - return cs; + // even here we could make an effort to use the tref variables to determine + // the coordinate system of the response - would only work with WMS, I think + // the fallback 'gcrs' SHOULD be specified by the MapML spec + return csMeta ? M._metaContentToObject(csMeta.getAttribute('content')).content : 'gcrs'; } // Util functions: