Basemap Returns a Blank Map

Viewed 724

I'm trying to animate a heat map of some information regarding geographic locations in Pittsburgh using matplotlib and basemap in Python 3. Right now I'm having issues getting basemap to use ARCGis imagery as the background. The following code only produces a blue square

import pandas as pd
import matplotlib.pyplot as plt
from mpl_toolkits.basemap import Basemap


m =Basemap(llcrnrlon=40.361369,llcrnrlat=-80.0955278,
urcrnrlon=40.501368,urcrnrlat=-79.865723,epsg=2272)

m.arcgisimage(service='ESRI_StreetMap_World_2D', xpixels=7000,dpi=96,verbose=True)

I've pulled down and run several examples from the internet about how to use arcgis images with basemap and they have run so I'm pretty sure its not a connection issue. I've tried several different projections and EPSG's including the world and US EPSGs, but no luck. Any help would be appreciated.

1 Answers

You have the longitudes and latitudes mixed up (see here):

from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt

m = Basemap(
    llcrnrlat=40.361369, llcrnrlon=-80.0955278,
    urcrnrlat=40.501368, urcrnrlon=-79.865723,
    epsg = 2272
)
m.arcgisimage(service='ESRI_StreetMap_World_2D', xpixels=7000, verbose=True)
plt.show()

produces this image:

the final picture

Related