A Python script to enrich placenames in a CSV file with geoname data from a custom API.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file geoname_enrichment-0.1.0.tar.gz.
File metadata
- Download URL: geoname_enrichment-0.1.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2df60e2e5bfbb459a057b4e5a9a2f82aff46500a6ca8af1e5f31cfc7633236eb
|
|
| MD5 |
06994f4636243735fc0b6cce2ea6a711
|
|
| BLAKE2b-256 |
ab703140fe2d8699c73a28b55c8ea81645bdde22d66f98828d479539b51403db
|