[Matplotlib-devel] Possible bug in matplotlib versions 1.4 and higher with basemap arcgisimage imagery

Benjamin Root ben.v.root at gmail.com
Mon Jan 25 11:59:07 EST 2016


Mike, this is where I noticed this before:
https://github.com/matplotlib/basemap/issues/242

Simple example:

import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap
m=Basemap(projection='cyl',llcrnrlon=-90,llcrnrlat=30,urcrnrlon=-60,urcrnrlat=60)
m.arcgisimage(verbose=True)
plt.show()


Ben Root



On Mon, Jan 25, 2016 at 11:32 AM, Michael Droettboom <
mdroettboom at continuum.io> wrote:

> Can you provide a standalone example to reproduce, or fire up the debugger
> and let me know that the value of "basemap_url" is on line 4270 of
> basemap/__init__.py?  Were that to point to somewhere that fails, one would
> expect this error.  (Though in the case of 1.5.1 something additionally
> funky is going on, I'm not necessarily surprised by the result with 1.4.3
> without additional information).
>
> Mike
>
> On Mon, Jan 25, 2016 at 10:53 AM, Benjamin Root <ben.v.root at gmail.com>
> wrote:
>
>> Yes, I recently noticed this, too. CC-ing Mike Droettboom, I think this
>> is caused by our recent changes to _image.cpp to add error-checking.
>>
>> Ben Root
>>
>> On Fri, Jan 22, 2016 at 3:43 AM, Mike Tercek via Matplotlib-devel <
>> matplotlib-devel at python.org> wrote:
>>
>>> When I make a map with the basemap and try to insert a background image
>>> from acrgis servers, the following code works ok if I have maplotlib
>>> version 1.3.1 installed:
>>>
>>> m =
>>> Basemap(llcrnrlon=ll_lon,llcrnrlat=ll_lat,urcrnrlon=ur_lon,urcrnrlat=ur_lat,epsg=3857,lat_0=latz,lon_0=lonz,
>>> fix_aspect = False)
>>> m.arcgisimage(service='ESRI_Imagery_World_2D', xpixels = 2000, verbose=
>>> False, dpi = 80)
>>>
>>> However, if I have matplotlib version 1.4.3 installed I get the
>>> following error:
>>>
>>> Python 3.4.3 (default, Oct 14 2015, 20:28:29)
>>> [GCC 4.8.4] on linux
>>> Type "help", "copyright", "credits" or "license" for more information.
>>> >>> runfile('/media/mt/7670100C700FD1B3/vegviz/contain/xv.py',
>>> wdir=r'/media/mt/7670100C700FD1B3/vegviz/contain')
>>> Content-Type: text/html
>>>
>>> Traceback (most recent call last):
>>>   File "<stdin>", line 1, in <module>
>>>   File
>>> "/usr/local/lib/python3.4/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py",
>>> line 680, in runfile
>>>     execfile(filename, namespace)
>>>   File
>>> "/usr/local/lib/python3.4/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py",
>>> line 85, in execfile
>>>     exec(compile(open(filename, 'rb').read(), filename, 'exec'),
>>> namespace)
>>>   File "/media/mt/7670100C700FD1B3/vegviz/contain/xv.py", line 401, in
>>> <module>
>>>     m,fig =
>>> make_base_map(title,frame_bound,park_bound,inset,inset_location,inset_alignment,ll_lon,ll_lat,ur_lon,ur_lat,latz,lonz,True)
>>>   File "/media/mt/7670100C700FD1B3/vegviz/contain/xv.py", line 110, in
>>> make_base_map
>>>     m.arcgisimage(service='ESRI_Imagery_World_2D', xpixels = 2000,
>>> verbose= False, dpi = 80)
>>>   File
>>> "/usr/local/lib/python3.4/dist-packages/mpl_toolkits/basemap/__init__.py",
>>> line 4270, in arcgisimage
>>>     return
>>> self.imshow(imread(urllib.request.urlopen(basemap_url)),origin='upper')
>>>   File "/usr/local/lib/python3.4/dist-packages/matplotlib/image.py",
>>> line 1270, in imread
>>>     return handler(fname)
>>> RuntimeError: _image_module::readpng: file not recognized as a PNG file
>>>
>>> And if I install matplotlib 1.5.1, I get this error:
>>>
>>> Python 3.4.3 (default, Oct 14 2015, 20:28:29)
>>> [GCC 4.8.4] on linux
>>> Type "help", "copyright", "credits" or "license" for more information.
>>> >>> runfile('/media/mt/7670100C700FD1B3/vegviz/contain/xv.py',
>>> wdir=r'/media/mt/7670100C700FD1B3/vegviz/contain')
>>> Content-Type: text/html
>>>
>>> Traceback (most recent call last):
>>>   File "<stdin>", line 1, in <module>
>>>   File
>>> "/usr/local/lib/python3.4/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py",
>>> line 680, in runfile
>>>     execfile(filename, namespace)
>>>   File
>>> "/usr/local/lib/python3.4/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py",
>>> line 85, in execfile
>>>     exec(compile(open(filename, 'rb').read(), filename, 'exec'),
>>> namespace)
>>>   File "/media/mt/7670100C700FD1B3/vegviz/contain/xv.py", line 401, in
>>> <module>
>>>     m,fig =
>>> make_base_map(title,frame_bound,park_bound,inset,inset_location,inset_alignment,ll_lon,ll_lat,ur_lon,ur_lat,latz,lonz,True)
>>>   File "/media/mt/7670100C700FD1B3/vegviz/contain/xv.py", line 110, in
>>> make_base_map
>>>     m.arcgisimage(service='ESRI_Imagery_World_2D', xpixels = 2000,
>>> verbose= False, dpi = 80)
>>>   File
>>> "/usr/local/lib/python3.4/dist-packages/mpl_toolkits/basemap/__init__.py",
>>> line 4270, in arcgisimage
>>>     return
>>> self.imshow(imread(urllib.request.urlopen(basemap_url)),origin='upper')
>>>   File "/usr/local/lib/python3.4/dist-packages/matplotlib/image.py",
>>> line 1326, in imread
>>>     return handler(fname)
>>> SystemError: error return without exception set
>>>
>>>
>>>
>>> _______________________________________________
>>> Matplotlib-devel mailing list
>>> Matplotlib-devel at python.org
>>> https://mail.python.org/mailman/listinfo/matplotlib-devel
>>>
>>>
>>
>
>
> --
> Michael Droettboom
> Continuum Analytics
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-devel/attachments/20160125/fa8474d2/attachment.html>


More information about the Matplotlib-devel mailing list