pyrocko.dataset.geonames

Access to the cities and population data of GeoNames.

The GeoNames geographical database covers all countries and contains over eleven million placenames.

This module provides quick access to a subset of GeoNames containing the cities with a population size exceeding 1000.

Functions

get_cities(lat, lon, radius[, minpop])

Get cities in a given circular area.

get_cities_by_name(name)

Lookup city by name.

Classes

GeoName(geonameid, name, asciiname, ...)

GeoName2(name, asciiname, lat, lon, ...)

class GeoName(geonameid, name, asciiname, alt_names, lat, lon, feature_class, feature_code, country_code, alt_country_code, admin1_code, admin2_code, admin3_code, admin4_code, population, elevation, dem, timezone, modification_date)

Bases: tuple

admin1_code

Alias for field number 10

admin2_code

Alias for field number 11

admin3_code

Alias for field number 12

admin4_code

Alias for field number 13

alt_country_code

Alias for field number 9

alt_names

Alias for field number 3

asciiname

Alias for field number 2

country_code

Alias for field number 8

dem

Alias for field number 16

elevation

Alias for field number 15

feature_class

Alias for field number 6

feature_code

Alias for field number 7

geonameid

Alias for field number 0

lat

Alias for field number 4

lon

Alias for field number 5

modification_date

Alias for field number 18

name

Alias for field number 1

population

Alias for field number 14

timezone

Alias for field number 17

class GeoName2(name, asciiname, lat, lon, population, feature_code)

Bases: tuple

asciiname

Alias for field number 1

feature_code

Alias for field number 5

lat

Alias for field number 2

lon

Alias for field number 3

name

Alias for field number 0

population

Alias for field number 4

get_cities_by_name(name)[source]

Lookup city by name.

The comparison is done case-insensitive.

Parameters:

name (str) – Name of the city to look for.

Returns:

Zero or more matching city entries.

Return type:

list of GeoName2

get_cities(lat, lon, radius, minpop=0)[source]

Get cities in a given circular area.

Parameters:
  • lat (float) – Latitude [deg].

  • lon (float) – Longitude [deg].

  • radius (float) – Search radius [m].

  • minpop (int) – Skip entries with population lower than this.

Returns:

Matching city entries.

Return type:

list of GeoName2