Basemap Data Assets

raw JSON →
2.0.0 verified Mon Apr 27 auth: no python

Data assets for matplotlib basemap. This package provides the shapefiles, topography, and other geospatial data required by the basemap toolkit. Version 2.0.0 is a major release that reorganized data handling and removed deprecated datasets. Release cadence is sporadic, tied to basemap releases.

pip install basemap-data
error ImportError: No module named 'mpl_toolkits.basemap'
cause basemap package not installed.
fix
Run pip install basemap (and also pip install basemap-data for data).
error FileNotFoundError: [Errno 2] No such file or directory: '.../basemap-data/...'
cause basemap-data not installed or path not set correctly.
fix
Run pip install basemap-data. If using custom path, set env var BASEMAP_DATA_DIR.
error AttributeError: module 'mpl_toolkits.basemap' has no attribute 'Basemap'
cause Outdated basemap version (<1.0.0).
fix
Upgrade with pip install --upgrade basemap basemap-data.
breaking Basemap and basemap-data packages are removed from metplotlib. Use Cartopy instead.
fix Migrate to Cartopy: `pip install cartopy` and `import cartopy.crs as ccrs`. See https://matplotlib.org/basemap/users/intro.html
gotcha basemap-data does NOT include the full dataset archive. Some older shapefiles may require separate download from SOEST.
fix If you get missing shapefile errors, ensure basemap-data is installed and you are using a supported projection. Old custom datasets need manual placement in the data directory.
deprecated The 'basemap' package itself is deprecated. No new features, only critical bug fixes.
fix Plan migration to Cartopy (https://scitools.org.uk/cartopy/).

Minimal example: create a Basemap instance and draw coastlines. Ensure basemap-data is installed so shapefiles are found automatically.

import os
os.environ['BASEMAP_DATA_DIR'] = '/path/to/basemap-data'  # optional custom path
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
m = Basemap(projection='mill', llcrnrlat=-60, urcrnrlat=90, llcrnrlon=-180, urcrnrlon=180)
m.drawcoastlines()
plt.show()