In https://github.com/vega/altair_tiles/issues/38 it came up that for certain tile providers, the tiles are missing in an exported PNG but they show up in a Jupyter notebook and in an SVG chart.
Minimal example
import altair as alt
import altair_tiles as til
import geopandas as gpd
gdf_ne = gpd.read_file("https://naciscdn.org/naturalearth/110m/cultural/ne_110m_admin_0_countries.zip") # zipped shapefile
extent_roi = gdf_ne.loc[gdf_ne["CONTINENT"] == "Africa", ["CONTINENT", "geometry"]]
chart = (
alt.Chart(extent_roi)
.mark_geoshape(fillOpacity=0.1, stroke="green", strokeWidth=2)
.project(type="mercator")
)
chart = til.add_tiles(chart, provider=til.providers.Esri.WorldGrayCanvas).properties(
width=600, height=400
)
chart
Chart displays as expected with tiles:
When saving to SVG and PNG, only the SVG image shows the tiles so seems like they get lost when downloading and embedding them.
chart.save("chart.svg")
chart.save("chart.png")
If you switch the provider in the above example to til.providers.OpenStreetMap.Mapnik, the tiles also show up in PNG. Sorry I don't know how to debug this any further but maybe it's something related to #63 where certain providers require specific request headers or so? In #64 you mentioned that we could set RUST_LOG to vl_convert but at least in a notebook, nothing shows up and I don't have cargo set up to install the CLI.
In https://github.com/vega/altair_tiles/issues/38 it came up that for certain tile providers, the tiles are missing in an exported PNG but they show up in a Jupyter notebook and in an SVG chart.
Minimal example
Chart displays as expected with tiles:
When saving to SVG and PNG, only the SVG image shows the tiles so seems like they get lost when downloading and embedding them.
If you switch the provider in the above example to
til.providers.OpenStreetMap.Mapnik
, the tiles also show up in PNG. Sorry I don't know how to debug this any further but maybe it's something related to #63 where certain providers require specific request headers or so? In #64 you mentioned that we could setRUST_LOG
tovl_convert
but at least in a notebook, nothing shows up and I don't have cargo set up to install the CLI.