Skip to main content

Geoname Enrichment

This Python script reads placenames from CSV files and queries a custom API on top of geonames data to enrich the geoname identifier. The API and geonames database are available under Open Licenses at:

Usage via the command line

Create and activate a Python virtual environment

# Create a new Python virtual environment
python3 -m venv py-geo-env

# Activate the virtual environment
source py-geo-env/bin/activate

# Install dependencies
pip -r requirements.txt

# install the tool
pip install .

Available options

usage: geoname_enrichment.py [-h] -c CONFIG_FILE -p PLACENAME_COLUMN
                             --countryname-column COUNTRYNAME_COLUMN
                             --id-column ID_COLUMN -o OUTPUT_FILE
                             [-l LOG_FILE] [-L LOG_LEVEL]
                             inputFile

This script reads names of places, possibly in combination with countries, and
looks up the values in a local geonames-based API

positional arguments:
  inputFile             The input file containing CSV records

optional arguments:
  -h, --help            show this help message and exit
  -c CONFIG_FILE, --config-file CONFIG_FILE
                        The config file with instructions how to enrich the
                        location data
  -p PLACENAME_COLUMN, --placename-column PLACENAME_COLUMN
                        The name of the column in the input CSV that contains
                        the name of the place
  --countryname-column COUNTRYNAME_COLUMN
                        The name of the column in the input CSV that contains
                        the country name
  --id-column ID_COLUMN
                        The name of the column in the input CSV that contains
                        the row identifier
  -o OUTPUT_FILE, --output-file OUTPUT_FILE
                        The output CSV file containing descriptive keys based
                        on the key composition config
  -l LOG_FILE, --log-file LOG_FILE
                        The optional name of the logfile
  -L LOG_LEVEL, --log-level LOG_LEVEL
                        The log level, default is INFO

Metadata

Release files for geoname-enrichment 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for geoname-enrichment 0.1.0
File Size Uploaded
geoname_enrichment-0.1.0.tar.gz 6.0 kB Details

Release files / geoname_enrichment-0.1.0.tar.gz

Download URL geoname_enrichment-0.1.0.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2df60e2e5bfbb459a057b4e5a9a2f82aff46500a6ca8af1e5f31cfc7633236eb
BLAKE2b-256 checksum
How to use checksums
ab703140fe2d8699c73a28b55c8ea81645bdde22d66f98828d479539b51403db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.64.1 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page