Last active
May 20, 2017 11:09
-
-
Save rrameshkumar76/b2596b20142490f902901a581c8807c0 to your computer and use it in GitHub Desktop.
Leaflet add headers to wms calls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
L.TileLayer.WMS_Headers = L.TileLayer.WMS.extend({ | |
createTile(coords, done) { | |
const url = this.getTileUrl(coords); | |
const img = document.createElement('img'); | |
superagent | |
.get(url) | |
.set(‘header’, ‘header value’) | |
.responseType('blob') | |
.then((response) => { | |
img.src = URL.createObjectURL(response.body); | |
done(null, img); | |
}); | |
return img; | |
} | |
}); | |
L.tileLayer.wms_headers = (url, options) => new L.TileLayer.WMS_Headers(url, options); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment