Skip to content

arcgisimage doesn't work #591

Closed
Closed
@Jinyin-Hu

Description

@Jinyin-Hu

I tried to use arcgisimage to plot a background map, but found it not working any way. And the example/testarcgis.py is also not working. Any help with this? Thanks

matplotlib version: 3.6.2
basemap version: 1.2.2 (same issue with 1.3.8)

these are the print information when runing testarcgis.py

http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer/export?bbox=-5156.620156177409,1718.8733853924696,-3437.746770784939,3437.746770784939&bboxSR=4326&imageSR=4326&size=400,400&dpi=96&format=png32&transparent=true&f=image

HTTPError Traceback (most recent call last)
/var/folders/_m/wrfhq7ws5lj9_z9rjlf9bp6d_ll1t2/T/ipykernel_9229/3229385272.py in <cell line: 13>()
11 m=Basemap(projection='cyl',llcrnrlon=-90,llcrnrlat=30,urcrnrlon=-60,urcrnrlat=60,resolution='i')
12 # default 'blue marble' image.
---> 13 m.arcgisimage(verbose=True)
14 m.drawmeridians(np.arange(-180,180,10),labels=[0,0,0,1],color='y')
15 m.drawparallels(np.arange(-90,90,10),labels=[1,0,0,0],color='y')

~/opt/anaconda3/envs/mti/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

~/opt/anaconda3/envs/mti/lib/python3.8/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
220 else:
221 opener = _opener
--> 222 return opener.open(url, data, timeout)
223
224 def install_opener(opener):

~/opt/anaconda3/envs/mti/lib/python3.8/urllib/request.py in open(self, fullurl, data, timeout)
529 for processor in self.process_response.get(protocol, []):
530 meth = getattr(processor, meth_name)
--> 531 response = meth(req, response)
532
533 return response

~/opt/anaconda3/envs/mti/lib/python3.8/urllib/request.py in http_response(self, request, response)
638 # request was successfully received, understood, and accepted.
639 if not (200 <= code < 300):
--> 640 response = self.parent.error(
641 'http', request, response, code, msg, hdrs)
642

~/opt/anaconda3/envs/mti/lib/python3.8/urllib/request.py in error(self, proto, *args)
561 http_err = 0
562 args = (dict, proto, meth_name) + args
--> 563 result = self._call_chain(*args)
564 if result:
565 return result

~/opt/anaconda3/envs/mti/lib/python3.8/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)
500 for handler in handlers:
501 func = getattr(handler, meth_name)
--> 502 result = func(*args)
503 if result is not None:
504 return result

~/opt/anaconda3/envs/mti/lib/python3.8/urllib/request.py in http_error_302(self, req, fp, code, msg, headers)
753 fp.close()
754
--> 755 return self.parent.open(new, timeout=req.timeout)
756
757 http_error_301 = http_error_303 = http_error_307 = http_error_302

~/opt/anaconda3/envs/mti/lib/python3.8/urllib/request.py in open(self, fullurl, data, timeout)
529 for processor in self.process_response.get(protocol, []):
530 meth = getattr(processor, meth_name)
--> 531 response = meth(req, response)
532
533 return response

~/opt/anaconda3/envs/mti/lib/python3.8/urllib/request.py in http_response(self, request, response)
638 # request was successfully received, understood, and accepted.
639 if not (200 <= code < 300):
--> 640 response = self.parent.error(
641 'http', request, response, code, msg, hdrs)
642

~/opt/anaconda3/envs/mti/lib/python3.8/urllib/request.py in error(self, proto, *args)
567 if http_err:
568 args = (dict, 'default', 'http_error_default') + orig_args
--> 569 return self._call_chain(*args)
570
571 # XXX probably also want an abstract factory that knows when it makes

~/opt/anaconda3/envs/mti/lib/python3.8/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)
500 for handler in handlers:
501 func = getattr(handler, meth_name)
--> 502 result = func(*args)
503 if result is not None:
504 return result

~/opt/anaconda3/envs/mti/lib/python3.8/urllib/request.py in http_error_default(self, req, fp, code, msg, hdrs)
647 class HTTPDefaultErrorHandler(BaseHandler):
648 def http_error_default(self, req, fp, code, msg, hdrs):
--> 649 raise HTTPError(req.full_url, code, msg, hdrs, fp)
650
651 class HTTPRedirectHandler(BaseHandler):

HTTPError: HTTP Error 400: Bad Request

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions