Open augusts-bit opened 3 months ago
Looks like the image is only worked out at the first draw, and there is a comment in the code that suggests there was an intention to change that at some point:
Note that we do have an add_raster()
method which uses SlippyImageArtist
https://github.com/SciTools/cartopy/blob/b8618af24f02a312c06bc6fb4ba05e9a3c1d0dc6/lib/cartopy/mpl/geoaxes.py#L1181
But, it doesn't look like GoogleTiles
inherit from the RasterSource
to be used with that method.
This would be nice to add some examples explaining how to use these capabilities and it probably needs some updates to the various artist classes to allow for that dynamic image grabbing from more sources.
I see someone has posted a workaround on StackOverflow: https://stackoverflow.com/a/78804739/3501128
Description
I want to create an animation of a trajectory using Cartopy and FuncAnimation. I have the trajectory stored in a GeoDataFrame with latitude, longitude and date time columns, which I want to visualise.
The trajectory moves across the globe, but I want to zoom in and therefore aim to have the basemap to be updated depending on the extent. I want to use satellite imagery as basemap, and I am using GoogleTiles from cartopy.io.img_tiles.
However, the image seems to only load at the initial extent, and is not updated in the new frames. The same happens when using 'stock_img()'. Interestingly, features such as coastlines and borders do load for the entire globe. To visualise my problem, view the images attached.
Code to reproduce
Function I am using:
Without success, I have tried the following:
My question therefore is: how do I correctly update the basemap image so that it loads when the point is moving across the globe? Is this possible, or am I misunderstanding something?