Cartopy

Table Of Contents

Previous topic

Introduction

Next topic

Who uses cartopy

This Page

What’s new in Cartopy 0.5

Release:0.5.0
Date:?? ???, 2012

This document explains the new/changed features of Cartopy in version 0.5.

Release 0.5 of Cartopy continues the work to expand the feature-set of Cartopy to encompass common operations, and provide performance improvements.

Cartopy 0.5 features

A summary of the main features added with version 0.5:

  • An improved feature API to support future expansion and sophistication, and a wider range of pre-defined Natural Earth datasets.

Incompatible changes

None

Deprecations

  • The method Axes.natural_earth_shp() has been replaced by the method Axes.add_feature() and the cartopy.feature module.

Feature API

Features (i.e. collections of lines and polygons) are now added to a map via the add_feature() method.

Pre-defined features exist for the small-scale (1:110m) Natural Earth datasets detailed below:

Name Description
BORDERS Country boundaries.
COASTLINE Coastline, including major islands.
LAKES Natural and artificial lakes.
LAND Land polygons, including major islands.
OCEAN Ocean polygons.
RIVERS Single-line drainages, including lake centerlines.

But any Natural Earth dataset can easily be used by creating an instance of cartopy.feature.NaturalEarthFeature.

For example, one can draw a map of Africa demonstrating all of the pre-defined features with the following code:

import cartopy
import matplotlib.pyplot as plt

ax = plt.axes(projection=cartopy.crs.PlateCarree())
ax.add_feature(cartopy.feature.LAND)
ax.add_feature(cartopy.feature.OCEAN)
ax.add_feature(cartopy.feature.COASTLINE)
ax.add_feature(cartopy.feature.BORDERS, linestyle=':')
ax.add_feature(cartopy.feature.LAKES, alpha=0.5)
ax.add_feature(cartopy.feature.RIVERS)
ax.set_xlim((-20, 60))
ax.set_ylim((-40, 40))
plt.show()

(Source code, png)

_images/features.png