tracktable.render.map_decoration.geographic_decoration module

Module contents

Render cities, coastlines, etc onto maps

tracktable.render.map_decoration.geographic_decoration.draw_airports(map_axes, airport_list=[], label_size=12, dot_size=2, label_color='white', dot_color='red', zorder=10, transform=<Projected CRS: +proj=eqc +ellps=WGS84 +a=6378137.0 +lon_0=0.0 +to ...> Name: unknown Axis Info [cartesian]: - E[east]: Easting (unknown) - N[north]: Northing (unknown) - h[up]: Ellipsoidal height (metre) Area of Use: - undefined Coordinate Operation: - name: unknown - method: Equidistant Cylindrical Datum: Unknown based on WGS 84 ellipsoid - Ellipsoid: WGS 84 - Prime Meridian: Greenwich, map_name=None, map_bbox=None, airport_bounding_box=None, draw_all_airports=False, draw_arrows=True)[source]

Decorate a map with airports

Parameters:

map_axes (GeoAxes) – Map to decorate

Keyword Arguments:
  • airport_list (list(str)) – IATA code of airports to render onto the map (Default: [])

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

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

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

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

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

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

  • map_name (str) – Name of the map to draw on (Default: None)

  • map_bbox (BoundingBox) – Bounding box of the map being decorated (Default: None)

  • airport_bounding_box (BoundingBox or tuple/list of points) – bounding box for rendering airports within. (Default: None)

  • draw_all_airports (bool) – Draw all of the airports in the bounding box (Default: False)

  • draw_arrows (bool) – Whether or not to draw arrows from airport labels to corresponding dots (Default: True)

Returns:

A list of artists added to the axes

tracktable.render.map_decoration.geographic_decoration.draw_borders(map_axes, zorder=7, map_bbox=None, border_list=[], border_color='green', border_bounding_box=None, border_resolution='low', border_level='L1', draw_all_borders=False, transform=<Projected CRS: +proj=eqc +ellps=WGS84 +a=6378137.0 +lon_0=0.0 +to ...> Name: unknown Axis Info [cartesian]: - E[east]: Easting (unknown) - N[north]: Northing (unknown) - h[up]: Ellipsoidal height (metre) Area of Use: - undefined Coordinate Operation: - name: unknown - method: Equidistant Cylindrical Datum: Unknown based on WGS 84 ellipsoid - Ellipsoid: WGS 84 - Prime Meridian: Greenwich)[source]

Decorate a map with borders

Parameters:

map_axes (GeoAxes) – Map to decorate

Keyword Arguments:
  • map_name (str) – Name of the map to draw on (Default: None)

  • map_bbox (BoundingBox) – Bounding box of the map being decorated (Default: None)

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

  • border_list (list(int)) – GSHHS index number of the border polygons to render (Default: [])

  • border_color (name of standard color as string, hex color string or matplotlib color object) – Color of the border (Default: ‘green’)

  • border_zorder (int) – Image layer for borders (Default: 7)

  • border_resolution (string) – Resolution of the shapes to pull from the shapefile. (Default: “low”)

  • border_level (string) – See the docstring for build_border_dict() for more information about levels. (Default: “L1”)

  • border_bounding_box (BoundingBox) – Bounding box for rendering borders within. (Default: None)

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

Returns:

A list of artists added to the axes

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, map_name=None, map_bbox=None, country=None, location=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_ports(map_axes, port_list=[], label_size=12, dot_size=2, label_color='white', dot_color='blue', zorder=10, transform=<Projected CRS: +proj=eqc +ellps=WGS84 +a=6378137.0 +lon_0=0.0 +to ...> Name: unknown Axis Info [cartesian]: - E[east]: Easting (unknown) - N[north]: Northing (unknown) - h[up]: Ellipsoidal height (metre) Area of Use: - undefined Coordinate Operation: - name: unknown - method: Equidistant Cylindrical Datum: Unknown based on WGS 84 ellipsoid - Ellipsoid: WGS 84 - Prime Meridian: Greenwich, map_name=None, map_bbox=None, country=None, port_country=None, port_water_body=None, port_wpi_region=None, port_bounding_box=None, port_and_country_seperate=False, draw_all_ports=False, draw_arrows=True)[source]

Decorate a map with specified number of ports

Parameters:

map_axes (GeoAxes) – Map to decorate

Keyword Arguments:
  • port_list (list(str)) – Name or WPI index number of ports to render onto the map (Default: [])

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

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

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

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

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

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

  • map_name (str) – Name of the map to draw on (Default: None)

  • map_bbox (BoundingBox) – Bounding box of the map being decorated (Default: None)

  • country (str) – Name of the country the port is located in (Default: None)

  • port_country (str) – Name of country to render ports in. (Default: None)

  • port_water_body (str) – Name of body of water to render ports on. (Default: None)

  • port_wpi_region (str) – Name of WPI region to render ports in. (Default: None)

  • port_bounding_box (BoundingBox or tuple/list of points) – bounding box for rendering ports within. (Default: None)

  • port_and_country_seperate (bool) – Bool for searching the ports database for a port and not considering it’s country to see if it’s rendered. i.e. You want to render a port in the U.K. while rendering all ports in Japan. (Default: False) draw_arrows (bool): Whether or not to draw arrows from airport labels to corresponding dots (Default: True)

Returns:

A list of artists added to the axes

tracktable.render.map_decoration.geographic_decoration.draw_rivers(map_axes, zorder=7, map_bbox=None, river_list=[], river_color='blue', river_bounding_box=None, river_resolution='low', river_level='L01', draw_all_rivers=False, transform=<Projected CRS: +proj=eqc +ellps=WGS84 +a=6378137.0 +lon_0=0.0 +to ...> Name: unknown Axis Info [cartesian]: - E[east]: Easting (unknown) - N[north]: Northing (unknown) - h[up]: Ellipsoidal height (metre) Area of Use: - undefined Coordinate Operation: - name: unknown - method: Equidistant Cylindrical Datum: Unknown based on WGS 84 ellipsoid - Ellipsoid: WGS 84 - Prime Meridian: Greenwich)[source]

Decorate a map with rivers

Parameters:

map_axes (GeoAxes) – Map to decorate

Keyword Arguments:
  • map_name (str) – Name of the map to draw on (Default: None)

  • map_bbox (BoundingBox) – Bounding box of the map being decorated (Default: None)

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

  • river_list (list(int)) – GSHHS index number of the river polygons to render (Default: [])

  • river_color (name of standard color as string, hex color string or matplotlib color object) – Color of the river (Default: ‘blue’)

  • river_zorder (int) – Image layer for rivers (Default: 7)

  • river_resolution (string) – Resolution of the shapes to pull from the shapefile. (Default: “low”)

  • river_level (string) – See the docstring for build_river_dict() for more information about levels. (Default: “L1”)

  • river_bounding_box (BoundingBox) – Bounding box for rendering rivers within. (Default: None)

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

Returns:

A list of artists added to the axes

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_shorelines(map_axes, zorder=7, map_bbox=None, shoreline_list=[], shoreline_color='red', shoreline_fill_polygon=True, shoreline_fill_color='red', shoreline_bounding_box=None, shoreline_resolution='low', shoreline_level='L1', draw_all_shorelines=False, transform=<Projected CRS: +proj=eqc +ellps=WGS84 +a=6378137.0 +lon_0=0.0 +to ...> Name: unknown Axis Info [cartesian]: - E[east]: Easting (unknown) - N[north]: Northing (unknown) - h[up]: Ellipsoidal height (metre) Area of Use: - undefined Coordinate Operation: - name: unknown - method: Equidistant Cylindrical Datum: Unknown based on WGS 84 ellipsoid - Ellipsoid: WGS 84 - Prime Meridian: Greenwich)[source]

Decorate a map with shorelines

Parameters:

map_axes (GeoAxes) – Map to decorate

Keyword Arguments:
  • map_name (str) – Name of the map to draw on (Default: None)

  • map_bbox (BoundingBox) – Bounding box of the map being decorated (Default: None)

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

  • shoreline_list (list(int)) – GSHHS index number of the shoreline polygons to render (Default: [])

  • shoreline_color (name of standard color as string, hex color string or matplotlib color object) – Color of the shoreline (Default: ‘red’)

  • shoreline_zorder (int) – Image layer for shorelines (Default: 7)

  • shoreline_resolution (string) – Resolution of the shapes to pull from the shapefile. (Default: “low”)

  • shoreline_level (string) – See the docstring for build_shoreline_dict() for more information about levels. (Default: “L1”)

  • shoreline_bounding_box (BoundingBox) – Bounding box for rendering shorelines within. (Default: None)

  • shoreline_fill_polygon (bool) – Whether or not to fill in the inside of the shoreline polygon (Default: True)

  • or (shoreline_fill_color (name of standard color as string, hex color string) – matplotlib color object): Fill color of the shoreline (Default: ‘red’)

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

Returns:

A list of artists added to the axes

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.