Top

geodata.AlternateNames module

Add alternate names for places using the Geonames.org Alternate names file

Module variables

var ALT_GEOID

var ALT_LANG

var ALT_NAME

Classes

class AlternateNames

Read in Geonames.org Alternate names V2 file and add appropriate entries to the altnames table. Each row in file contains a geoname ID, an alternative name for that entity, and the language. If the lang is in lang_list and the ID is ALREADY in our geonames dictionary, we add this as an alternative name

Ancestors (in MRO)

Static methods

def __init__(

self, directory, filename, progress_bar, geo_files, lang_list)

Read in geonames alternate names file and add to geodata database in alt_names table

Args:

directory: base directory for alternate names file
filename: filename of geonames alternate_namesV2.txt file
progress_bar: tkhelper progress bar or None
geo_files: GeodataFiles instance
lang_list: List of ISO languages we want to support, e.g. ['fr', 'es']

def add_alternate_names_to_db(

self)

Read alternate names file into database

Returns:

True if error

def cancel(

self)

User requested cancel of database build. Quit DB build. :return: None

def handle_line(

self, line_num, row)

For each line in file, add item to alternate name DB if we support that language Also add to main DB if lang is not English and item is not an ADM item :param line_num: file line number :param row: line in file to be handled :return: None

def progress(

self, msg, val)

Update progress bar if there is one

def read(

self)

Read a file and call a handler for each line. Update progress bar :return: Error

Instance variables

var lang_list

var loc

var sub_dir