tracktable.render.map_decoration.geographic_decoration module

Module contents

Render cities, coastlines, etc onto maps

tracktable.render.map_decoration.geographic_decoration.draw_cities(map_axes, cities_to_draw, label_size=12, dot_size=2, label_color='white', dot_color='white', zorder=10, transform=None)[source]

Decorate a map with specified number of cities

Parameters
  • map_axes (GeoAxes) – Map to decorate

  • cities_to_draw (int) – Draw specified amount of cities

Keyword Arguments
  • label_size (int) – Font size (points) for label (Default: 10)

  • dot_size (int) – Size (in points) of dot marking city location (Default: 2)

  • label_color (str) – Color (name or hex string) for city labels (Default: ‘white’)

  • dot_color (str) – Color (name or hex string) for city markers (Default: ‘white’)

  • zorder (int) – Image layer (z-order) for cities (Default: 10)

  • transform (cartopy crs object) – Transform the corrdinate system (Default: None)

Returns

A list of artists added to the axes

tracktable.render.map_decoration.geographic_decoration.draw_cities_larger_than(map_axes, minimum_population, label_size=10, dot_size=2, label_color='white', dot_color='white', zorder=10, axes=None)[source]

Decorate a map with all cities larger than a given population

Parameters
  • mymap (Basemap) – Basemap instance to decorate

  • minimum_population (int) – Draw cities with at least this large a population

Keyword Arguments
  • label_size (int) – Font size (points) for label (Default: 10)

  • dot_size (int) – Size (in points) of dot marking city location (Default: 2)

  • label_color (str) – Color (name or hex string) for city labels (Default: ‘white’)

  • dot_color (str) – Color (name or hex string) for city markers (Default: ‘white’)

  • zorder (int) – Image layer (z-order) for cities (Default: 10)

  • axes (Matplotlib axes) – Matplotlib axes instance to render into (Default: None)

Returns

A list of artists added to the axes

tracktable.render.map_decoration.geographic_decoration.draw_coastlines(map_axes, edgecolor='#808080', resolution='50m', linewidth=0.2, zorder=5, **kwargs)[source]

Draw coastlines onto a GeoAxes instance

Parameters

map_axes (GeoAxes) – GeoAxes from mapmaker

Keyword Arguments
  • border_color (colorspec) – Color for coastlines (Default: #808080, Medium Gray)

  • resolution (str) – Resolution for coastlines. A value of None means ‘don’t draw’. The values ‘110m’, ‘50m’ and ‘10m’ specify increasingly detailed coastlines. (Default: ‘50m’)

  • linewidth (float) – Stroke width in points for coastlines. (Defaults: 0.2)

  • zorder (int) – Drawing layer for coastlines. Layers with higher Z-order are drawn on top of those with lower Z-order. (Default: 5)

  • kwargs (dict) – Arguments to be passed to Matplotlib text renderer for label (Default: dict())

Returns

A list of Matplotlib artists added to the map.

tracktable.render.map_decoration.geographic_decoration.draw_countries(map_axes, linewidth=0.5, zorder=4, edgecolor='#606060', resolution='10m', **kwargs)[source]

Decorate a map with countries

Parameters

map_axes (GeoAxes) – Map to decorate

Keyword Arguments
  • linewidth (float) – Width of the country borders (Default: 0.5)

  • zorder (int) – Image layer (z-order) for countries (Default: 4)

  • edgecolor (str) – Color (name or hex string) for country borders (Default: ‘#606060’)

  • resolution (str) – Detail of country borders (Default: ‘10m’)

  • kwargs (dict) – Arguments to be passed to Matplotlib text renderer for label (Default: dict())

Returns

A list of Matplotlib artists added to the figure.

tracktable.render.map_decoration.geographic_decoration.draw_largest_cities(map_axes, num_cities, label_size=10, dot_size=2, label_color='white', dot_color='white', zorder=10)[source]

Decorate a map with the N largest cities

Parameters
  • map_axes (GeoAxes) – Map to decorate

  • num_cities (int) – Draw cities with at least this large a population

Keyword Arguments
  • label_size (int) – Font size (points) for label (Default: 10)

  • dot_size (int) – Size (in points) of dot marking city location (Default: 2)

  • label_color (str) – Color (name or hex string) for city labels (Default: ‘white’)

  • dot_color (str) – Color (name or hex string) for city markers (Default: ‘white’)

  • zorder (int) – Image layer (z-order) for cities (Default: 10)

Returns

A list of artists added to the map

tracktable.render.map_decoration.geographic_decoration.draw_lonlat(map_axes, spacing=10, zorder=5, draw_labels=False, linewidth=0.25, color='#C0C0C0')[source]

Fill in lonlat

Given a GeoAxes instance, fill in the lonlat lines on a map with a specified color.

Parameters

map_axes (GeoAxes) – Map instance to render onto

Keyword Arguments
  • spacing (int) – Spacing between the lon lat lines (Default: 10)

  • zorder (int) – Image layer (z-order) for lonlat lines (Default: 5)

  • linewidth (float) – Width of the lonlat lines (Default: 0.25)

  • color (str) – Color (name or hex string) for lonlat lines (Default: ‘#C0C0C0’)

Returns

A list of Matplotlib artists added to the map.

tracktable.render.map_decoration.geographic_decoration.draw_scale(mymap, length_in_km=10, label_color='#C0C0C0', label_size=10, linewidth=1, zorder=20)[source]

Fill in map scale

Given a GeoAxes instance, fill in a scale on a map.

Parameters

map_axes (GeoAxes) – Map instance to render onto

Keyword Arguments
  • length_in_km (int) – Scale’s representative length (Default: 10)

  • label_color (str) – Color (name or hex string) for scale (Default: ‘#C0C0C0’)

  • label_size (str) – Size of the scale label (Default: 10)

  • linewidth (float) – Width of the scale (Default: 1)

  • zorder (int) – Image layer (z-order) for scale (Default: 20)

Returns

A list of Matplotlib artists added to the map.

tracktable.render.map_decoration.geographic_decoration.draw_states(map_axes, resolution='10m', linewidth=0.25, zorder=3, facecolor='#606060', edgecolor='#A0A0A0', **kwargs)[source]

Decorate a map with states

Parameters

map_axes (GeoAxes) – Map to decorate

Keyword Arguments
  • resolution (str) – Detail of state borders (Default: ‘10m’)

  • linewidth (float) – Width of the state borders (Default: 0.25)

  • zorder (int) – Image layer (z-order) for countries (Default: 3)

  • facecolor (str) – Color (name or hex string) for states (Default: ‘#606060’)

  • edgecolor (str) – Color (name or hex string) for state borders (Default: ‘#A0A0A0’)

  • kwargs (dict) – Arguments to be passed to Matplotlib text renderer for label (Default: dict())

Returns

A list of Matplotlib artists added to the figure.

tracktable.render.map_decoration.geographic_decoration.fill_background(mymap, border_color='#000000', bgcolor='#000000', linewidth=1)[source]

fill_background has not been implemented yet

tracktable.render.map_decoration.geographic_decoration.fill_lakes(map_axes, edgecolor='none', facecolor='#101020', resolution='110m', zorder=None)[source]

Fill in lakes

Given a GeoAxes instance, fill in the lakes on a map with a specified color.

Parameters

map_axes (GeoAxes) – Map instance to render onto

Keyword Arguments
  • edgecolor (str) – Color (name or hex string) for lake borders (Default: ‘none’)

  • facecolor (str) – Color (name or hex string) for lakes (Default: ‘#101020’)

  • resolution (str) – Detail of lake borders (Default: ‘110m’)

  • zorder (int) – Image layer (z-order) for lake (Default: None)

Returns

A list of Matplotlib artists added to the map.

tracktable.render.map_decoration.geographic_decoration.fill_land(map_axes, edgecolor='none', facecolor='#303030', linewidth=0.1, resolution='110m', zorder=None)[source]

Fill in land (continents and islands)

Given a GeoAxes instance, fill in the land on a map with a specified color.

Parameters

map_axes (GeoAxes) – Map instance to render onto

Keyword Arguments
  • edgecolor (str) – Color (name or hex string) for land borders (Default: ‘none’)

  • facecolor (str) – Color (name or hex string) for land (Default: ‘#303030’)

  • linewidth (float) – Width of the land borders (Default: 0.1)

  • resolution (str) – Detail of land borders (Default: ‘110m’)

  • zorder (int) – Image layer (z-order) for countries (Default: None)

Returns

A list of Matplotlib artists added to the map.

tracktable.render.map_decoration.geographic_decoration.fill_oceans(map_axes, facecolor='#101020', resolution='110m', zorder=None)[source]

Fill in oceans

Given a GeoAxes instance, fill in the oceans on a map with a specified color.

Parameters

map_axes (GeoAxes) – Map instance to render onto

Keyword Arguments
  • facecolor (str) – Color (name or hex string) for ocean (Default: ‘#101020’)

  • resolution (str) – Detail of ocean borders (Default: ‘110m’)

  • zorder (int) – Image layer (z-order) for oceans (Default: None)

Returns

A list of Matplotlib artists added to the map.