Menu

[r6860]: / trunk / toolkits / basemap / doc / users / geography.rst  Maximize  Restore  History

Download this file

55 lines (39 with data), 2.0 kB

Drawing a Map Background

Basemap includes the GSSH coastline dataset, as well as datasets for rivers, state and country boundaries from GMT. These datasets can be used to draw coastlines, rivers and political boundaries on maps at several different resolutions. The relevant Basemap methods are:

  • :func:`~mpl_toolkits.basemap.Basemap.drawcoastlines`: draw coastlines.
  • :func:`~mpl_toolkits.basemap.Basemap.fillcontinents`: color the interior of continents (by filling the coastline polygons).
  • :func:`~mpl_toolkits.basemap.Basemap.drawcountries`: draw country boundaries.
  • :func:`~mpl_toolkits.basemap.Basemap.drawstates`: draw state boundaries in North America.
  • :func:`~mpl_toolkits.basemap.Basemap.drawrivers`: draw rivers.

Instead of drawing coastlines and political boundaries, an image can be used as a map background. Basemap provides several options for this:

  • :func:`~mpl_toolkits.basemap.Basemap.drawlsmask`: draw a high-resolution land-sea mask as an image, with land and ocean colors specified.
  • :func:`~mpl_toolkits.basemap.Basemap.bluemarble`: draw a NASA Blue Marble image as a map background.
  • :func:`~mpl_toolkits.basemap.Basemap.warpimage`: use an abitrary image as a map background. The image must be global, covering the world in lat/lon coordinates from the international dateline eastward and the South Pole northward.

Here are examples of the three different ways to draw a map background.

  1. Draw coastlines, filling ocean and land areas.
figures/background1.png
  1. Draw a land-sea mask as an image.
figures/background2.png
  1. Draw the NASA 'Blue Marble' image.
figures/background3.png
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.