Skip to content

Commit

Permalink
[AUTO] Sync MapML Build
Browse files Browse the repository at this point in the history
  • Loading branch information
prushforth committed Jun 24, 2022
1 parent 7d3ad9e commit f463141
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 37 deletions.
36 changes: 3 additions & 33 deletions test/dist/mapml.js
Original file line number Diff line number Diff line change
Expand Up @@ -1390,9 +1390,7 @@
},
onAdd: function () {
this._map._addZoomLimit(this);
var mapml, headers = new Headers({'Accept': 'text/mapml'});
var parser = new DOMParser(),
opacity = this.options.opacity || 1,
var opacity = this.options.opacity || 1,
container = this._container,
map = this._map;
if (!this._features) {
Expand All @@ -1415,36 +1413,8 @@
}
});
}
// this was tricky...recursion alwasy breaks my brain
var features = this._features,
_pullFeatureFeed = function (url, limit) {
return (fetch (url,{redirect: 'follow',headers: headers})
.then( function (response) {return response.text();})
.then( function (text) {
mapml = parser.parseFromString(text,"application/xml");
var base = (new URL(mapml.querySelector('map-base') ? mapml.querySelector('map-base').getAttribute('href') : url)).href;
url = mapml.querySelector('map-link[rel=next]')? mapml.querySelector('map-link[rel=next]').getAttribute('href') : null;
url = url ? (new URL(url, base)).href: null;
let nativeZoom = mapml.querySelector("map-meta[name=zoom]") &&
+M.metaContentToObject(mapml.querySelector("map-meta[name=zoom]").getAttribute("content")).value || 0;
let nativeCS = mapml.querySelector("map-meta[name=cs]") &&
M.metaContentToObject(mapml.querySelector("map-meta[name=cs]").getAttribute("content")).content || "GCRS";
features.addData(mapml, nativeCS, nativeZoom);
if (url && --limit) {
return _pullFeatureFeed(url, limit);
}
}));
};
if(map.getZoom() % this._template.step !== 0) {
this._onMoveEnd();
return;
}
_pullFeatureFeed(this._getfeaturesUrl(), 10)
.then(function() {
map.addLayer(features);
map.fire('moveend'); // TODO: replace with moveend handler for layer and not entire map
})
.catch(function (error) { console.log(error);});

map.fire('moveend'); // TODO: replace with moveend handler for layer and not entire map
},
redraw: function() {
this._onMoveEnd();
Expand Down
8 changes: 4 additions & 4 deletions test/dist/mapml.min.js

Large diffs are not rendered by default.

0 comments on commit f463141

Please sign in to comment.