@@ -4229,6 +4229,21 @@ def arcgisimage(self,server='http://server.arcgisonline.com/ArcGIS',\
4229
4229
4230
4230
returns a matplotlib.image.AxesImage instance.
4231
4231
"""
4232
+
4233
+
4234
+ # fix PIL import on some versions of OSX and scipy
4235
+ try :
4236
+ from PIL import Image
4237
+ except ImportError :
4238
+ try :
4239
+ import Image
4240
+ except ImportError :
4241
+ msg = ('arcgisimage method requires PIL '
4242
+ '(http://pillow.readthedocs.io)' )
4243
+ raise ImportError (msg )
4244
+
4245
+
4246
+
4232
4247
if not hasattr (self ,'epsg' ):
4233
4248
msg = dedent ("""
4234
4249
Basemap instance must be creating using an EPSG code
@@ -4248,7 +4263,7 @@ def arcgisimage(self,server='http://server.arcgisonline.com/ArcGIS',\
4248
4263
arcgisimage cannot handle images that cross
4249
4264
the dateline for cylindrical projections.""" )
4250
4265
raise ValueError (msg )
4251
- if self .projection = = 'cyl' :
4266
+ if self .projection ! = 'cyl' :
4252
4267
xmin = (180. / np .pi )* xmin ; xmax = (180. / np .pi )* xmax
4253
4268
ymin = (180. / np .pi )* ymin ; ymax = (180. / np .pi )* ymax
4254
4269
# ypixels not given, find by scaling xpixels by the map aspect ratio.
@@ -4269,8 +4284,8 @@ def arcgisimage(self,server='http://server.arcgisonline.com/ArcGIS',\
4269
4284
# print URL?
4270
4285
if verbose : print (basemap_url )
4271
4286
# return AxesImage instance.
4272
- return self . imshow ( imread ( urlopen (basemap_url )), ax = ax ,
4273
- origin = 'upper' )
4287
+ img = Image . open ( urlopen (basemap_url ))
4288
+ return self . imshow ( img , ax = ax , origin = 'upper' )
4274
4289
4275
4290
def wmsimage (self ,server ,\
4276
4291
xpixels = 400 ,ypixels = None ,\
0 commit comments