-
-
Notifications
You must be signed in to change notification settings - Fork 85
Description
The new providers (https://github.com/darribas/contextily/pull/66) contain also a set of sources for "overlay" tiles (like Stamen.TonerLabels
or OpenMapSurfer.AdminBounds
).
Those are tiles with a transparent background that can be added on top of another layer. We can load them, but the problem is that currently, due to the way we are reading the image and storing it as an array, the transparent background gets converted into a black background (of course defeating the purpose of being able to overlay it).
Example:
df = geopandas.read_file(geopandas.datasets.get_path('nybb')).to_crs(epsg=3857)
ax = df.plot(figsize=(9, 9), alpha=0.5)
ctx.add_basemap(ax, url=ctx.providers.Stamen.TonerLabels)
# or
ctx.add_basemap(ax, url=ctx.providers.OpenMapSurfer.AdminBounds)
gives
If we want to support this, we have to investigate if imshow
can support transparency (I think yes, by using alpha / RGBA colors, see eg https://matplotlib.org/3.1.1/gallery/images_contours_and_fields/image_transparency_blend.html) and how to read the tiles into an array with those alpha values included.
All providers that are of overlay type can be seen from this query in the leaflet-providers code: