Description
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np
my_map = Basemap(projection='merc', lat_0 = 40.595060, lon_0 = -97.519326,
resolution = 'h', area_thresh = 0.1,
llcrnrlon=-124.877061, llcrnrlat=16.002774,
urcrnrlon=-69.808131, urcrnrlat=49.369581, epsg = 4326)
my_map.arcgisimage(service='ESRI_Imagery_World_2D', xpixels = 1500, verbose= True)
plt.show()
lats = [38.48, 32.12, 41.4, 37.42, 35.3, 34.18, 29.24, 30, 31.42, 34.18, 40.24, 34.42]
lons = [-105.12, -107.48, -100, -106, -106.12, -111.3, -98.36, -99.06, -98.3, -111.3, -78.12, -100.24]
x,y = my_map(lons, lats)
my_map.plot(x, y, 'bo', markersize=5)
lats = [34, 30.24, 42.12, 30.24, 34.12]
lons = [-117.24, -115.54, -120.18, -115.54, -119.18]
x,y = my_map(lons, lats)
my_map.plot(x, y, 'ro', markersize=5)
plt.show()
http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/export?bbox=-124.877061,16.002774,-69.80813100000002,49.369581&bboxSR=4326&imageSR=4326&size=1500,908&dpi=96&format=png32&f=image
SystemError Traceback (most recent call last)
in ()
8 urcrnrlon=-69.808131, urcrnrlat=49.369581, epsg = 4326)
9
---> 10 my_map.arcgisimage(service='ESRI_Imagery_World_2D', xpixels = 1500, verbose= True)
11 plt.show()
12
/Users/Gustaf/anaconda/lib/python3.5/site-packages/mpl_toolkits/basemap/init.py in arcgisimage(self, server, service, xpixels, ypixels, dpi, verbose, **kwargs)
4268 if verbose: print(basemap_url)
4269 # return AxesImage instance.
-> 4270 return self.imshow(imread(urllib.request.urlopen(basemap_url)),origin='upper')
4271
4272 def wmsimage(self,server,\
/Users/Gustaf/anaconda/lib/python3.5/site-packages/matplotlib/image.py in imread(fname, format)
1324 return handler(fd)
1325 else:
-> 1326 return handler(fname)
1327
1328
SystemError: returned NULL without setting an error
My hunch is that it has something to do with the arcgis REST API service and that labe anything on the map because of "Supports Dynamic Layers: false". But I'm new to all this. Any ideas?