@@ -4228,6 +4228,21 @@ def arcgisimage(self,server='http://server.arcgisonline.com/ArcGIS',\
42284228
42294229 returns a matplotlib.image.AxesImage instance.
42304230 """
4231+
4232+
4233+ # fix PIL import on some versions of OSX and scipy
4234+ try :
4235+ from PIL import Image
4236+ except ImportError :
4237+ try :
4238+ import Image
4239+ except ImportError :
4240+ msg = ('warpimage method requires PIL '
4241+ '(http://pillow.readthedocs.io)' )
4242+ raise ImportError (msg )
4243+
4244+
4245+
42314246 if not hasattr (self ,'epsg' ):
42324247 msg = dedent ("""
42334248 Basemap instance must be creating using an EPSG code
@@ -4247,7 +4262,7 @@ def arcgisimage(self,server='http://server.arcgisonline.com/ArcGIS',\
42474262 arcgisimage cannot handle images that cross
42484263 the dateline for cylindrical projections.""" )
42494264 raise ValueError (msg )
4250- if self .projection = = 'cyl' :
4265+ if self .projection ! = 'cyl' :
42514266 xmin = (180. / np .pi )* xmin ; xmax = (180. / np .pi )* xmax
42524267 ymin = (180. / np .pi )* ymin ; ymax = (180. / np .pi )* ymax
42534268 # ypixels not given, find by scaling xpixels by the map aspect ratio.
@@ -4268,8 +4283,8 @@ def arcgisimage(self,server='http://server.arcgisonline.com/ArcGIS',\
42684283 # print URL?
42694284 if verbose : print (basemap_url )
42704285 # return AxesImage instance.
4271- return self . imshow ( imread ( urlopen (basemap_url )), ax = ax ,
4272- origin = 'upper' )
4286+ img = Image . open ( urlopen (basemap_url ))
4287+ return self . imshow ( img , ax = ax , origin = 'upper' )
42734288
42744289 def wmsimage (self ,server ,\
42754290 xpixels = 400 ,ypixels = None ,\
0 commit comments