Input/output capabilities (cartopy.io)

Cartopy has many built-in image and map acquisition capabilities. These capabilities allow the maps to be loaded, saved, and retrieved in various data formats.

Shapefiles

Cartopy provides a basic interface for accessing shapefiles.

shapereader.Reader

alias of cartopy.io.shapereader.BasicReader

shapereader.BasicReader(filename)

Provide an interface for accessing the contents of a shapefile.

shapereader.Record(shape, attributes, fields)

A single logical entry from a shapefile, combining the attributes with their associated geometry.

shapereader.natural_earth([resolution, ...])

Return the path to the requested natural earth shapefile, downloading and unzipping if necessary.

shapereader.NEShpDownloader([url_template, ...])

Specialise cartopy.io.Downloader to download the zipped Natural Earth shapefiles and extract them to the defined location (typically user configurable).

shapereader.gshhs([scale, level])

Return the path to the requested GSHHS shapefile, downloading and unzipping if necessary.

shapereader.GSHHSShpDownloader([...])

Specialise cartopy.io.Downloader to download the zipped GSHHS shapefiles and extract them to the defined location.

Image collections

img_nest.Img(*args, **kwargs)

img_nest.ImageCollection(name, crs[, images])

img_nest.NestedImageCollection(name, crs, ...)

Image tiles

These classes provide an interface to the respective tile resources to automatically load the proper tile and resolution depending on the desired domain.

img_tiles.OSM([desired_tile_form, ...])

img_tiles.GoogleTiles([desired_tile_form, ...])

img_tiles.GoogleWTS([desired_tile_form, ...])

Implement web tile retrieval using the Google WTS coordinate system.

img_tiles.MapQuestOSM([desired_tile_form, ...])

img_tiles.MapQuestOpenAerial([...])

img_tiles.MapboxStyleTiles(access_token, ...)

Implement web tile retrieval from a user-defined Mapbox style.

img_tiles.MapboxTiles(access_token, map_id)

Implement web tile retrieval from Mapbox.

img_tiles.OrdnanceSurvey(apikey[, layer, ...])

Implement web tile retrieval from Ordnance Survey map data.

img_tiles.QuadtreeTiles([desired_tile_form, ...])

Implement web tile retrieval using the Microsoft WTS quadkey coordinate system.

img_tiles.Stamen([style, desired_tile_form, ...])

Retrieves tiles from maps.stamen.com.

img_tiles.StamenTerrain([cache])

DEPRECATED: This class is deprecated.

Open Geospatial Consortium (OGC)

There are several classes to enable interfacing with OGC clients.

ogc_clients.WFSGeometrySource(service, features)

Web Feature Service (WFS) retrieval for Cartopy.

ogc_clients.WMSRasterSource(service, layers)

A WMS imagery retriever which can be added to a map.

ogc_clients.WMTSRasterSource(wmts, layer_name)

A WMTS imagery retriever which can be added to a map.

Shuttle Radar Topography Mission (SRTM)

The SRTM data can be accessed through the cartopy.io.srtm module using classes and functions defined below.

srtm.SRTM1Source([downloader, max_nx, max_ny])

A source of SRTM1 data, which implements Cartopy's RasterSource interface.

srtm.SRTM3Source([downloader, max_nx, max_ny])

A source of SRTM3 data, which implements Cartopy's RasterSource interface.

srtm.SRTMDownloader(target_path_template[, ...])

Provide a SRTM download mechanism.

srtm.SRTM3_retrieve(lon, lat)

Return the path of a .hgt file for the given SRTM location.

srtm.read_SRTM(fh)

Read the array of (y, x) elevation data from the given named file-handle.

srtm.read_SRTM1(fh)

Read the array of (y, x) elevation data from the given named file-handle.

srtm.read_SRTM3(fh)

Read the array of (y, x) elevation data from the given named file-handle.

srtm.srtm(lon, lat)

Return (elevation, crs, extent) for the given longitude latitude.

srtm.srtm_composite(lon_min, lat_min, nx, ny)

srtm.add_shading(elevation, azimuth, altitude)

Add shading to SRTM elevation data, using azimuth and altitude of the sun.

srtm.fill_gaps(elevation[, max_distance])

Fill gaps in SRTM elevation data for which the distance from missing pixel to nearest existing one is smaller than max_distance.

Base classes and functions

These are the base classes that new resources can leverage to implement a new reader or tile client.

Downloader(url_template, target_path_template)

Represents a resource, that can be configured easily, which knows how to acquire itself (perhaps via HTTP).

DownloadWarning

Issued when a file is being downloaded by a Downloader.

LocatedImage(image, extent)

Define an image and associated extent in the form:

RasterSource()

Define the cartopy raster fetching interface.

RasterSourceContainer(contained_source)

A container which simply calls the appropriate methods on the contained RasterSource.

PostprocessedRasterSource(contained_source, ...)

A RasterSource which wraps another, an then applies a post-processing step on the raster fetched from the contained source.

fh_getter(fh[, mode, needs_filename])

Convenience function for opening files.