'Order of Layers in Folium

I am working on creating a map where I am using weather data, as well as overlaying images to show where things are. My problem is that the ImageOverlay raster layer is always below the polygons (if there is overlap). Is there a way to have the ImageOverlay layer be above the polygon?

Here is an example of what I am talking about which can be put into a jupyter notebook and be ran (assuming you have the necessary packages installed)

import folium
m = folium.Map([37, 0], zoom_start=1, tiles="stamentoner")

folium.raster_layers.ImageOverlay(
    image="https://upload.wikimedia.org/wikipedia/commons/f/f4/Mercator_projection_SW.jpg",
    name="I am a jpeg",
    bounds=[[-82, -180], [82, 180]],
    opacity=1,
    interactive=False,
    cross_origin=False,
    zindex=1,
    alt="Wikipedia File:Mercator projection SW.jpg",
).add_to(m)
polygon = {
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {},
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [
            [
              -87.01171875,
              40.3130432088809
            ],
            [
              -86.7041015625,
              35.639441068973944
            ],
            [
              -79.4970703125,
              35.53222622770337
            ],
            [
              -79.716796875,
              40.38002840251183
            ],
            [
              -87.01171875,
              40.3130432088809
            ]
          ]
        ]
      }
    }
  ]
}
geo_j  = folium.GeoJson(polygon)
geo_j.add_to(m)
m

In this example, the polygon would be completely behind the raster and would not be of benefit, but I would like some help figuring it out.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source