MCPcopy Create free account
hub / github.com/Maps4HTML/MapML.js / getMapML

Function getMapML

src/mapml/layers/TemplatedFeaturesOrTilesLayer.js:201–226  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

199 }),
200 linkEl = this._linkEl,
201 getMapML = (url) => {
202 return fetch(url, { redirect: 'follow', headers: headers })
203 .then(function (response) {
204 return response.text();
205 })
206 .then(function (text) {
207 let parser = new DOMParser();
208 mapml = parser.parseFromString(text, 'application/xml');
209 let frag = document.createDocumentFragment();
210 const legalContentQuery = `
211 map-head > map-link,
212 map-body > map-link,
213 map-head > map-meta,
214 map-body > map-meta,
215 map-head > map-style,
216 map-body > map-style,
217 map-tile,
218 map-feature
219 `.trim(); // excludes map-extent
220 let elements = mapml.querySelectorAll(legalContentQuery);
221 for (let i = 0; i < elements.length; i++) {
222 frag.appendChild(elements[i]);
223 }
224 linkEl.shadowRoot.appendChild(frag);
225 });
226 };
227 const map = this._map;
228 getMapML(this._url)
229 .then(() => {

Calls

no outgoing calls

Tested by

no test coverage detected