You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please read this discussion on the Leaflet issue tracker: Leaflet/Leaflet#2091
The TileLayer class doesn't support custom headers. At the bottom of the discussion they link to a JS plugin you could try.
I don't suppose it's common to need authentication headers for tileservers. I thought they mostly pass the api key as part of the url or as a parameter. What tileserver are you using that requires authentication headers?
Before I start though, I came up with three design alternatives. My preference would be option 1, but you decide. (Or propose something else altogether.)
Option 1
It is for use cases like this that I propose to introduce folium.Class with an include method.
Users would be able to implement the requested functionality like this:
** Option 2 **
As an alternative, I can create a new folium.element.Include that can be added using add_child.
I don't like this option very much. The method add_child with Include can called on any branca.element. Only for certain elements (the ones representing Leaflet classes) would it actually make sense. I am not afraid that people will try it, but it does not feel right.
** Option 3 **
Implement this specifically on TileLayer. E.g. by adding a JsCode parameter to the constructor for create_tile.
Activity
Conengmo commentedon Jun 19, 2020
Please read this discussion on the Leaflet issue tracker: Leaflet/Leaflet#2091
The TileLayer class doesn't support custom headers. At the bottom of the discussion they link to a JS plugin you could try.
I don't suppose it's common to need authentication headers for tileservers. I thought they mostly pass the api key as part of the url or as a parameter. What tileserver are you using that requires authentication headers?
bkanuka commentedon Feb 12, 2021
I'm using a tile server behind OAuth so I'm interested in this.
Yasharesk commentedon Feb 27, 2021
I'm trying to use a tile server that requires the api key to be passed on through header, so I am interested in this as well.
davidcavazos commentedon Oct 6, 2021
+1 Many Cloud providers require OAuth credentials to even reach the server, so I'm also interested in this.
PhilippBuehlerOkeanos commentedon May 17, 2024
+1
[-]Add Authtication header[/-][+]Add Authentication header[/+]hansthen commentedon May 19, 2024
@Conengmo I am willing to take a stab at this.
Before I start though, I came up with three design alternatives. My preference would be option 1, but you decide. (Or propose something else altogether.)
Option 1
It is for use cases like this that I propose to introduce
folium.Classwith anincludemethod.Users would be able to implement the requested functionality like this:
** Option 2 **
As an alternative, I can create a new
folium.element.Includethat can be added usingadd_child.I don't like this option very much. The method
add_childwithIncludecan called on anybranca.element. Only for certain elements (the ones representing Leaflet classes) would it actually make sense. I am not afraid that people will try it, but it does not feel right.** Option 3 **
Implement this specifically on
TileLayer. E.g. by adding a JsCode parameter to the constructor forcreate_tile.james-hinton commentedon May 20, 2025
+1
hansthen commentedon Jun 10, 2025
I am working on a solution that builds on the code here: Leaflet/Leaflet#2091 (comment).