0

when I use Basemap to visualize trajectory point based on arcgis REST API service, but there are always a urllib.error.HTTPError: HTTP Error 500: Internal Server Error, I do not know how to solve this problem, could someone give me some suggestions? code are followiing:

df = pd.read_csv('G:\\data\\vancouver.csv')
x = list(df['LON'])
y = list(df['LAT'])
plt.figure(figsize=(12, 9))
map = Basemap(llcrnrlon=-124.7,llcrnrlat=48.0,urcrnrlon=-122,urcrnrlat=50.5)
map.arcgisimage(service='NatGeo_World_Map', xpixels = 1500, ypixels=None,dpi=120, verbose= True)
lon, lat = map(x,y)
map.plot(lon, lat)
plt.show()

and the error is followed:

Traceback (most recent call last):
  File "C:/Users/DELL/code/picture/地图可视化.py", line 18, in <module>
    map.arcgisimage(service='NatGeo_World_Map', xpixels = 1500, ypixels=None,dpi=120, verbose= True)
  File "F:\anaconda\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 4296, in arcgisimage
    img = Image.open(urlopen(basemap_url))
  File "F:\anaconda\lib\urllib\request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "F:\anaconda\lib\urllib\request.py", line 531, in open
    response = meth(req, response)
  File "F:\anaconda\lib\urllib\request.py", line 640, in http_response
    response = self.parent.error(
  File "F:\anaconda\lib\urllib\request.py", line 569, in error
    return self._call_chain(*args)
  File "F:\anaconda\lib\urllib\request.py", line 502, in _call_chain
    result = func(*args)
  File "F:\anaconda\lib\urllib\request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 500: Internal Server Error
  • can u share the url basemap tries to connect to? the command should print it (verbose=True) – Lukr Sep 28 '21 at 09:25
  • this is the url:http://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/export?bbox=118.00000000000001,24.26,118.3,24.6&bboxSR=4326&imageSR=4326&size=1500,1700&dpi=120&format=png32&transparent=true&f=image – proceeding Sep 28 '21 at 09:29
  • I get a internal server error 500 for this request, meaning, the server failed at some point to produce the image for you. I don't know the ArcGIS API, but I just played a bit with the values and found that an image is given if the size is reduced (tryed 120,170 instead of 1200,1700). Maybe there is a limit in pixels or filesize that cause your request to fail? – Lukr Oct 07 '21 at 07:48
  • @proceeding try to lower down your resolution. probably it is to big for you. try 1000. I have tried it and it working on my machine – Azam Sep 26 '22 at 02:02

0 Answers0