Skip to content

No background map from arcgisimage #481

Closed

Description

@tonino0013

Dear All,
I am working with Python3.5.2 with matplotlib '3.0.3' version, my basemap version is the 1.1.0. I have an Ubuntu 16.04 Laptop.
I have this code (to plot a seismic epicenter over the background map from arcgisimage server):

m = Basemap(projection='mill', llcrnrlon=-70.20, llcrnrlat=-30.00, urcrnrlon=-56.90, urcrnrlat=-9.10,
            resolution='c',epsg= 4326, ax=ax1)
m.arcgisimage(service='World_Topo_Map', xpixels = 2000, verbose= False)
m.drawcoastlines()
m.drawcountries(color='yellow',linewidth=2.7)
m.drawmeridians(np.arange(0, 360, 2.5), labels=[True,False,False,True])
m.drawparallels(np.arange(-90, 90, 2.5),labels=[False,True,True,False])

with open(epi) as f:
    reader=csv.reader(f, delimiter=';')
    next(reader)
    for uhu in reader:
        lat.append(float(uhu[0]))
        lon.append(float(uhu[1]))
        mag.append(float(uhu[2]))
        depth.append(float(uhu[3]))

min_marker_size = 1.7
for lons, lats, mags in zip(lon, lat, mag):
    x,y = m(lons, lats)
    msize = mags * min_marker_size
    m.plot(x, y, 'ro', markersize=msize)

plt.show()

Under Windows 10 this code works nice and I can see the wonderful background map, however at Linux O.S. I am not able to see the background map, is this an issue of matplotlib or basemap?.

The first figure is taken from Win10, the second figure is taken from Ubuntu16.04

Regards,

basemap_Windows10

basamap_Ubuntu

Activity

  1. WeatherGod commented on Dec 28, 2019

    @WeatherGod
    Member
  2. tonino0013 commented on Dec 29, 2019

    @tonino0013
    Author

    Dear @WeatherGod ,

    I saw just a warning updating the 'verbose=True'

    FutureWarning: '+init=<authority>:<code>' syntax is deprecated. '<authority>:<code>' is the preferred initialization method.
      return _prepare_from_string(" ".join(pjargs))
    http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/export?bbox=-4022.163721818379,-1718.8733853924696,-3260.129854294384,-521.3915935690491&bboxSR=4326&imageSR=4326&size=2000,3142&dpi=96&format=png32&transparent=true&f=image
    
    

    The link under my Ubuntu 16.04 it is just an empty image
    Thank you for your time.
    Tonino

  3. FMassin commented on Jul 20, 2020

    @FMassin
    Contributor

    I have the same issue on Mac OSX...

  4. vc1492a commented on Feb 14, 2021

    @vc1492a

    Same here, on macOS 10.15.7 (Catalina) Python 3.8 Matplotlib version 3.2.1.

  5. molinav commented on Feb 14, 2021

    @molinav
    Member

    @vc1492a I think this issue could be the same one as in #499 and the current master already includes the bugfix. Which basemap version are you using?

  6. vc1492a commented on Feb 16, 2021

    @vc1492a

    @molinav thanks for the prompt reply - after some more diagnosis ended up being an unrelated issue, thanks!

  7. molinav commented on Aug 10, 2022

    @molinav
    Member

    I am closing this issue because the problem in the OP is actually solved now. The key point is the traceback of the URL:

    http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/export?bbox=-4022.163721818379,-1718.8733853924696,-3260.129854294384,-521.3915935690491&bboxSR=4326&imageSR=4326&size=2000,3142&dpi=96&format=png32&transparent=true&f=image
    

    where the bounding box should contain "standard" latitudes and longitudes (since the OP uses EPSG 4326), but instead it contains out-of-bound values due to an unexpected radian-to-degree conversion factor applied inside Basemap.arcgisimage before generating the URL.

    This problem was fixed in PR #505 by @guziy, but this PR introduced a new bug in any projection different from "cyl". This new bug was finally fixed in PR #548 and released with basemap version 1.3.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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