cartograph.feature

class cartograph.feature.Feature(style)

Generic map feature.

plot(axes)

Plot the feature on axes. The method should be overridden by subclasses and append any artists created to self.artists. By default it does nothing.

set_visible(visible)

Make the feature visible or not (after it has been plotted).

remove()

Remove the feature from the plot.

class cartograph.feature.Area(boundary, style)

Subclass of Feature

Area feature with (2,N) numpy array boundary and AreaStyle style. To add an Area to a Map one would typically use add_area().

is_inbounds(bounds)

Check whether at least one vertex of the boundary is within bounds.

plot(axes)

Plot the area on axes.

class cartograph.feature.Way(vertices, style)

Subclass of Feature

Way feature with (2,N) numpy array vertices and WayStyle style. To add a Way to a Map one would typically use add_way().

is_inbounds(bounds)

Check whether at least one vertex is within bounds.

plot(axes)

Plot the way on axes.

class cartograph.feature.Name(name, location, style)

Subclass of Feature

Name feature with name, (2,) numpy array location and NameStyle style. To add a Name to a Map one would typically use add_name().

is_inbounds(bounds)

Check whether the location is in bounds. Currently this method always returns True.

plot(axes)

Plot the name on axes.

class cartograph.feature.Node(location, style)

Subclass of Name

Node feature with (2,) numpy array location and NodeStyle style. To add a Node to a Map one would typically use add_node().

class cartograph.feature.Elevation(data, style)

Subclass of Feature

Elevation feature with ElevationStyle style. The data is expected to be an (3,N) numpy array where each row gives an x-coordinate, y-coordinate and elevation.

generate_elevation_grid(bounds, resolution=(100, 100), padding=1)

Interpolate the elevation data on a regular grid given by bounds and resolution. padding is used to eliminate edge effects from interpolation.

draw_background_image(axes)

Draw an image from the elevation data on axes. The generate_elevation_grid() must be called before this method. The image is not automatically send to the back of the figure.

draw_hillshade(axes)

Draw hillshade from the elevation data on axes. The generate_elevation_grid() must be called before this method.

plot_contours(axes)

Draw labelled contours from the elevation data on axes. The generate_elevation_grid() must be called before this method.

remove_contours()

Remove contours and labels.