The cartopy Feature interface¶
The data copyright, license and attribution can be blended on the map using text annotations (mpl docs) as shown in feature_creation.
Specific Feature subclasses have been defined for common functionality, such as accessing Natural Earth or GSHHS shapefiles. A list of these can be found in the reference documentation.
To simplify some very common cases, some pre-defined Features exist as cartopy.feature
constants. The pre-defined Features are all small-scale (1:110m)
Natural Earth datasets, and can be added with methods
such as GeoAxes.add_feature
:
Name |
Description |
---|---|
|
Country boundaries. |
|
Coastline, including major islands. |
|
Natural and artificial lakes. |
|
Land polygons, including major islands. |
|
Ocean polygons. |
|
Single-line drainages, including lake centerlines. |
|
Internal, first-order administrative boundaries (limited to the
United States at this scale).
Natural Earth have first-order admin boundaries for most
countries at the 1:10,000,000 scale; these may be
accessed with |
Note
Any Natural Earth dataset can be used by creating an
instance of cartopy.feature.NaturalEarthFeature
. For
example:
import cartopy.feature as cfeature
land_50m = cfeature.NaturalEarthFeature('physical', 'land', '50m',
edgecolor='face',
facecolor=cfeature.COLORS['land'])
A dictionary of some useful colors for drawing features also exists in cartopy.feature.COLORS
.
For a full list of names in this dictionary:
>>> import cartopy.feature
>>> sorted(cartopy.feature.COLORS.keys())
['land', 'land_alt1', 'water']