-
Notifications
You must be signed in to change notification settings - Fork 392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error using arcgisimage in basemap #257
Comments
There are a couple of issues here. I think that URL is out of date, and I haven't found out a replacement yet (see #242). Another problem might be with your version of matplotlib. There is currently a fix in place in the master branch of matplotlib, but not yet backported to matplotlib v1.5.x or v2.x (and the bug supposedly exists as far back as v1.4): matplotlib/matplotlib#5910 |
The imread() fix will be backported to v1.5.x in matplotlib/matplotlib#5927. #242 is still outstanding. |
Whoops, the URL issue was for Please reopen if that is not the case. |
So I'm using v1.5.1 and it's still not working. |
The patch was merged to 1.5.x 2 days ago but Matplotlib 1.5.1 was tagged on January 10 so naturally this is not in 1.5.1 but it will be in the next release. |
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?
The text was updated successfully, but these errors were encountered: