incertitude is a simple project for quickly throwing together a geocoding service using public sources (GeoNames, in the example) and ElasticSearch.
Basic example loads data from GeoNames:
-
Download any of the city/place files from GeoNames
XX.zip allCountries.zip cities1000.zip cities5000.zip cities15000.zip
-
Install and fire up ElasticSearch. It should be running locally on port 9200.
-
Install the dependences with
pip install -r requirements.txt
-
Run
incertitude.py
python incertitude.py <mapping_file.json> <geonames_file_path> <settings_file.json>
-
Give a whirl [in your browser](http://localhost:9200/geocode/place/_search?q=Greater Seattle Area)
The mapping file is entirely customizable and is standard ElasticSearch syntax. Simple tweaks can significantly change how queries are analyzed and the scoring of the results.
Further, the incertitude.py
script is exceedingly simple - standard csv
parsing and use of the elasticsearch
library. This could be easily extended to extracting from an existing relational database with SQLAlchemy or other data stores.