This is a Python based utility for geocoding csv files using various online geocoding service.
Installation
Installation using pip
pip install giokoda
Installation from source
Download the source code from github, Example
git clone https://github.com/WorldBank-Transport/giokoda.git
Install the module and its dependancies
cd giokoda python setup.py install
Usage
This utility can be used as a Python module or as an executable script.
Using as python module
Basic example:
import giokoda
giokoda.geocode_csv('input.csv')
The above code will try to goecode the provided ‘input.csv’ file and write its output to ‘input.csv-geocoded.csv’
A geocode_csv function can geocode entities from a provided input csv file and write results to a csv file.
It also returns a dictionary containing error, success and total count of geocoded rows.
General syntax:
geocode_csv('input/file.csv', **kwargs)
Required parameter
- infile, (filepath/str)
path to a csv file to geocode.
Optional keyword arguments (**kwargs)
- outfile, (filepath/str)
path to file to write output csv
- service, (str), default: ‘nominatim’.
Name of a geocoding service to use. This can be a name of any geocoding service that is supported by geopy.
- query_column, (str), default: ‘name’
Name of a column containg text to geocode.
query_columns (list): default: []. A list of a columns to be combined in order to produce a text to geocode.
- service_kwargs, (dict)
Optional keyword arguments for initialization of geocoding service.
delimiter (str): default: ‘,’, A one-character string used to separate fields.
quotechar (str): default: ‘”’, A one-character string used to quote fields containing special characters in a csv file, such as the delimiter or quotechar, or which contain new-line characters.
Return
geocode_csv() returns a dictionary of success, error and total count:
{
'total': 0,
'success': 0,
'error': 0
}
Using an executable script
Run geocode_csv via command line interface.
Example:
geocode_csv /input/file.csv
or including a api key:
geocode_csv --service <SERVICE-NAME> --params '{"api_key": "<YOUR-API-KEY>"}' /input/file.csv
General usage:
geocode_csv [-h] [-o OUTPUT] [-s SERVICE] [-c COLUMN] [-p PARAMS] input
Required argument
- input
Full path to csv file to geocode
Optional arguments
- -h, –help
show this help message and exit
- -o OUTPUT, –output OUTPUT
Full path to output file
- -s SERVICE, –service SERVICE
Geocoding service name, example arcgis, baidu, google, googlev3, geocoderdotus, geonames, yahoo, placefinder, opencage, openmapquest, mapquest, liveaddress, navidata, nominatim, geocodefarm, what3words, yandex and ignfrance
- -c [COLUMN [COLUMN …]], –column [COLUMN [COLUMN …]]
Name(s) for column(s) containing text content to geocode. Multiple column names should be separated by white space.
- -p PARAMS, –params PARAMS
Keyword arguments for geocoding service initialization presented as json object
- -d DELIMITER, –delimiter DELIMITER
A one-character string used to separate fields in a csv file
- -q QUOTECHAR, –quotechar QUOTECHAR
A one-character string used to quote fields containing special characters in a csv file, such as the delimiter or quotechar, or which contain new-line characters.
Metadata
Release files for giokoda 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| giokoda-0.1.2.tar.gz | 5.6 kB | Without provenance | Details for giokoda-0.1.2.tar.gz |
Release files / giokoda-0.1.2.tar.gz
| Download URL | giokoda-0.1.2.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6c4721bb1967983bfde85c1f90d2516fe5d376722b532d2c34382019489eed55
|
|
BLAKE2b-256 checksum How to use checksums |
ba9d578d7f0153a216c4e4846fb4f5803a03b67626e8e97825128dd9fcf91b0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for giokoda 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.