SHARE
TWEET

Untitled

a guest May 19th, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. L.TileLayer.WMS_Headers = L.TileLayer.WMS.extend({
  2.   createTile(coords, done) {
  3.     const url = this.getTileUrl(coords);
  4.     const img = document.createElement('img');
  5.     superagent
  6.       .get(url)
  7.       .set(‘header’, ‘header value’)
  8.       .responseType('blob')
  9.       .then((response) => {
  10.         img.src = URL.createObjectURL(response.body);
  11.         done(null, img);
  12.       });
  13.     return img;
  14.   }
  15. });
  16.  
  17. L.tileLayer.wms_headers = (url, options) => new L.TileLayer.WMS_Headers(url, options);
RAW Paste Data
Top