-
Notifications
You must be signed in to change notification settings - Fork 398
Closed
Description
Hi!
First of all, thank you for your work on basemap!
I'm looking for a way of reusing the AxesImage instance returned by the arcgisimage
function of basemap, in order to reapply it to following and identical maps on which only the plotted data differs.
I tried using the matplotlib.axes.Axes.add_image()
function on a basemap instance, thinking it might do the trick but alas, it does not.
I may simply be missing something rather obvious that would fulfill my need, but I have no clue of what it might be.
Here's the function that generates basemap instances and contains my (failed) attempt described above, as well as the straightforward -- but very unoptimized -- fix:
def getBasemapsInstances(nbGraphs, axes, swCornerCoord, neCornerCoord, arcgisService):
mAxes = []
swCorLat = swCornerCoord[0]
swCorLon = swCornerCoord[1]
neCorLat = neCornerCoord[0]
neCorLon = neCornerCoord[1]
la0 = swCorLat + (neCorLat - swCorLat)/2
lo0 = swCorLon + (neCorLon - swCorLon)/2
for i in range(1, nbGraphs):
bmap = Basemap(ax=axes[i],
llcrnrlon=swCorLon,llcrnrlat=swCorLat,
urcrnrlon=neCorLon,urcrnrlat=neCorLat,
epsg=3035,lon_0=lo0,lat_0=la0)
''' Doesn't work
if i==1:
arcServInst = bmap.arcgisimage(service=arcgisService,
xpixels = 2000,
dpi=1500,
verbose= True)
else:
bmap.add_image(arcServInst)
'''
arcServInst = bmap.arcgisimage(service=arcgisService,
xpixels = 2000,
dpi=1500,
verbose= True)
bmap.drawmapboundary()
mAxes.append(bmap)
return mAxes
Thanks in advance for any input you may have! :-)
Metadata
Metadata
Assignees
Labels
No labels