-
Notifications
You must be signed in to change notification settings - Fork 394
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
arcgisimage() fails with io.UnsupportedOperation: seek #499
Comments
I get exactly the same issue running basemap with windows 10. I am using basemap 1.2.2 and python 3.8.6 http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/export?bbox=2506055.846693921,4410720.871992808,2506637.203006063,4411028.421318711&bboxSR=3110&imageSR=3110&size=1000,529&dpi=100&format=png32&transparent=true&f=image I need to solve this issue! |
I have the same issue.
---------------------------------------------------------------------------
UnsupportedOperation Traceback (most recent call last)
<ipython-input-37-05bc67db5411> in <module>
15 linewidth=0.5
16 )
---> 17 bm.arcgisimage(service="World_Shaded_Relief",
18 xpixels=3000,
19 verbose=True)
~/local/anaconda3/envs/py38a/lib/python3.8/site-packages/mpl_toolkits/basemap/__init__.py in arcgisimage(self, server, service, xpixels, ypixels, dpi, verbose, **kwargs)
4271 if verbose: print(basemap_url)
4272 # return AxesImage instance.
-> 4273 return self.imshow(imread(urlopen(basemap_url)),ax=ax,
4274 origin='upper')
4275
~/local/anaconda3/envs/py38a/lib/python3.8/site-packages/matplotlib/image.py in imread(fname, format)
1494 response = io.BytesIO(response.read())
1495 return imread(response, format=ext)
-> 1496 with img_open(fname) as image:
1497 return (_pil_png_to_float_array(image)
1498 if isinstance(image, PIL.PngImagePlugin.PngImageFile) else
~/local/anaconda3/envs/py38a/lib/python3.8/site-packages/PIL/ImageFile.py in __init__(self, fp, filename)
119 try:
120 try:
--> 121 self._open()
122 except (
123 IndexError, # end of data
~/local/anaconda3/envs/py38a/lib/python3.8/site-packages/PIL/PngImagePlugin.py in _open(self)
690 # get next chunk
691
--> 692 cid, pos, length = self.png.read()
693
694 try:
~/local/anaconda3/envs/py38a/lib/python3.8/site-packages/PIL/PngImagePlugin.py in read(self)
160 s = self.fp.read(8)
161 cid = s[4:]
--> 162 pos = self.fp.tell()
163 length = i32(s)
164
UnsupportedOperation: seek |
This pull request is supposed to fix the problem: You are welcome to try and test it and maybe there will be more motivation to merge it. |
Yes Peter: Please test the one in my repo: https://github.com/guziy/basemap/tree/fix_arcgis_image Just use the fix_arcgis_image branch. When you checkout the branch try using
You might need to specify the path to geos installation:
Cheers |
Sorry, Peter: I have no idea about windows, the commands I wrote are for Linux, might work on a mac... Cheers |
I guess you need to specify the correct branch as they say here. Sorry I just sent you the HTML view link... https://stackoverflow.com/questions/20101834/pip-install-from-git-repo-branch
or https
Cheers |
Dear Sasha
Yes, that installs fine on Windows 10.
pip install [email protected]:guziy/basemap.git@fix_arcgis_image<mailto:[email protected]:guziy/basemap.git@fix_arcgis_image>
However I still get the seek error?
Traceback (most recent call last):
File "C:\Machine Learning\Waste\WCC_Bin_Map_URL.py", line 22, in <module>
m.arcgisimage(service='World_Street_Map',xpixels=1000,ypixels=None,dpi=400)
File "C:\Users\peter\AppData\Local\Programs\Python\Python38\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 4271, in arcgisimage
return self.imshow(imread(urlopen(basemap_url)),ax=ax,
File "C:\Users\peter\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\image.py", line 1496, in imread
with img_open(fname) as image:
File "C:\Users\peter\AppData\Local\Programs\Python\Python38\lib\site-packages\PIL\ImageFile.py", line 121, in __init__
self._open()
File "C:\Users\peter\AppData\Local\Programs\Python\Python38\lib\site-packages\PIL\PngImagePlugin.py", line 692, in _open
cid, pos, length = self.png.read()
File "C:\Users\peter\AppData\Local\Programs\Python\Python38\lib\site-packages\PIL\PngImagePlugin.py", line 162, in read
pos = self.fp.tell()
io.UnsupportedOperation: seek
I am moving to Cartopy so if it is too hard to fix this issue, I suggest abandoning it!
Regards
Peter
From: Huziy Oleksandr (Sasha) <[email protected]>
Sent: Tuesday, December 8, 2020 6:06 AM
To: matplotlib/basemap <[email protected]>
Cc: metonics <[email protected]>; Comment <[email protected]>
Subject: Re: [matplotlib/basemap] arcgisimage() fails with io.UnsupportedOperation: seek (#499)
I guess you need to specify the correct branch as they say here. Sorry I just sent you the HTML view link...
https://stackoverflow.com/questions/20101834/pip-install-from-git-repo-branch<https://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstackoverflow.com%2Fquestions%2F20101834%2Fpip-install-from-git-repo-branch&data=04%7C01%7C%7C7f333c6d63604acdfd7508d89ae32e74%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637429647808503529%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=9epPX3Y7n32uiuWpGe%2FjvkiEoxH%2FbsWPGA59ussGB84%3D&reserved=0>
pip install [email protected]:guziy/basemap.git@fix_arcgis_image<mailto:[email protected]:guziy/basemap.git@fix_arcgis_image>
or https
pip install git+https://github.com/guziy/basemap.git@fix_arcgis_image
Cheers
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<https://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmatplotlib%2Fbasemap%2Fissues%2F499%23issuecomment-740118380&data=04%7C01%7C%7C7f333c6d63604acdfd7508d89ae32e74%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637429647808503529%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=81D6hZAj8SGOwWNrfM%2BxZH%2Fcb7fWPJhReWKiKEJCDtA%3D&reserved=0>, or unsubscribe<https://eur04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FARORH5PF3BZYMF4AX5V7NF3STURSXANCNFSM4Q2FSIXA&data=04%7C01%7C%7C7f333c6d63604acdfd7508d89ae32e74%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637429647808513525%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=zTnpid5%2B00sSon3PHPGeB9XaHCuSxEf3efyCqTrnXDs%3D&reserved=0>.
|
It is a good idea to move to cartopy. But your error message is still saying it is using imread, whereas in my version of the code imread is removed... c4a19b7#diff-cd2bf9b319d30dd03cdbcd9fd49b22e0735faf3c2797ae78ab60a775d1349d1cR4286 Not sure how you install or use things, but you might still be using some other version of basemap... PS: please use the GitHub interface for messages, it is hard to follow when your email client copies so many links... Cheers |
pip install git+https://github.com/guziy/basemap.git@fix_arcgis_image - eventually worked to install the forked version Thanks for all your efforts! Yes, it is now working - or at least not crashing. I am having issues getting the imagery to load up however and will do more investigation with the test codes. |
this seems to now work correctly. I was having issues with the epsg parameter - If I leave it off the images install fine. |
The text was updated successfully, but these errors were encountered: