@@ -4228,6 +4228,21 @@ def arcgisimage(self,server='http://server.arcgisonline.com/ArcGIS',\
4228
4228
4229
4229
returns a matplotlib.image.AxesImage instance.
4230
4230
"""
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
+
4231
4246
if not hasattr (self ,'epsg' ):
4232
4247
msg = dedent ("""
4233
4248
Basemap instance must be creating using an EPSG code
@@ -4247,7 +4262,7 @@ def arcgisimage(self,server='http://server.arcgisonline.com/ArcGIS',\
4247
4262
arcgisimage cannot handle images that cross
4248
4263
the dateline for cylindrical projections.""" )
4249
4264
raise ValueError (msg )
4250
- if self .projection = = 'cyl' :
4265
+ if self .projection ! = 'cyl' :
4251
4266
xmin = (180. / np .pi )* xmin ; xmax = (180. / np .pi )* xmax
4252
4267
ymin = (180. / np .pi )* ymin ; ymax = (180. / np .pi )* ymax
4253
4268
# 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',\
4268
4283
# print URL?
4269
4284
if verbose : print (basemap_url )
4270
4285
# 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' )
4273
4288
4274
4289
def wmsimage (self ,server ,\
4275
4290
xpixels = 400 ,ypixels = None ,\
0 commit comments