Cartopy

0.25.0 · active · verified Sat Apr 11

Cartopy is a Python package designed for geospatial data processing and cartographic visualizations, building on Matplotlib. It provides object-oriented projection definitions, transformations between various map projections, and powerful vector data handling. The library is currently at version 0.25.0 and maintains an active release cadence, frequently updating to support modern Python and geospatial libraries.

Warnings

Install

Imports

Quickstart

This quickstart creates a basic global map using the Plate Carree projection, adding standard geographical features such as land, ocean, coastlines, country borders, lakes, and rivers. It demonstrates the typical import pattern and usage of `add_subplot` with a Cartopy projection and `add_feature` for geographical elements.

import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature

fig = plt.figure(figsize=(10, 8))
ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree())

ax.set_global()

# Add basic features
ax.add_feature(cfeature.LAND)
ax.add_feature(cfeature.OCEAN)
ax.add_feature(cfeature.COASTLINE)
ax.add_feature(cfeature.BORDERS, linestyle=':')
ax.add_feature(cfeature.LAKES, alpha=0.5)
ax.add_feature(cfeature.RIVERS)

plt.title('Basic Cartopy Map with Plate Carree Projection')
plt.show()

view raw JSON →