tracktable.info.cities module

Module contents

cities.py - Locations and population values for many cities of the world

class tracktable.info.cities.CityInfo[source]

Bases: object

Brief information about a city.

country_code

2-character abbreviation for country

Type

str

name

City name

Type

str

population

Estimated population

Type

int

location

location of city

Type

TerrestrialBasePoint

tracktable.info.cities.cities_in_bbox(bbox_min=(- 180, - 90), bbox_max=(180, 90), minimum_population=0)[source]

Return all the cities in a bounding box.

Keyword Arguments
  • bbox_min (TrajectoryPoint) – Southwest corner of bounding box, (Default: (-180, -90))

  • bbox_max (TrajectoryPoint) – Northeast corner of bounding box, (Default: (180, 90))

  • minimum_population (int) – Cities with lower population than this will not be returned. (Default: 0).

Returns

List of CityInfo objects.

tracktable.info.cities.get_city(name, country=None, location=None)[source]
Returns a city that most closely matches the input data.

In the case that multiple cities with the same name are found, the closest to the given location will be used. In the case that multiple cities are found and location is not used, the city with the largest population will be returned.

Valid:

London, UK Springfield, US, with one of the many valid lats or longs Springfield, None, with one of the many valid lats or longs Qandahar (there’s only one Qandahar in the world)

Parameters

name (str) – City name to search for

Keyword Arguments
  • country (str) – two character country code. (Default: None).

  • location (tuple, TrajectoryPoint, BasePoint) – location to search near (Default: None).

Returns

A CityInfo object or None if no records are found.

tracktable.info.cities.largest_cities_in_bbox(bbox_min=(- 180, - 90), bbox_max=(180, 90), count=10)[source]

Return the largest N cities in a bounding box.

A city’s size is measured by its population.

Keyword Arguments
  • bbox_min (TrajectoryPoint) – Southwest corner of bounding box. (Default: to (-180, -90)).

  • bbox_max (TrajectoryPoint) – Northeast corner of bounding box. (Default: to (180, 90)).

  • count (int) – How many cities to return. (Default: 10).

Returns

A list of CityInfo objects.