Crates.io | geonamestools |
lib.rs | geonamestools |
version | 0.1.0 |
source | src |
created_at | 2019-08-25 21:22:51.56679 |
updated_at | 2019-08-25 21:22:51.56679 |
description | Library and CLI tool to use data from GeoNames.org |
homepage | https://github.com/davidedelpapa/geonamestools |
repository | https://github.com/davidedelpapa/geonamestools |
max_upload_size | |
id | 159611 |
size | 34,261 |
Library and CLI tool to use data from GeoNames.org
For now it can process in a simple way the cities data(for example cities-1000) and transfer data to a sqlite DB.
More features to come!
Example Usage:
cargo run ./test_data/test_cities.txt test.db
The line above transfers the data in the test_file present in test_cities.txt to the database test.db (creating it, if it does not exist).
For now it has the two components
geonames::parser;
geonames::sqlitewriter::write_sqlite;
Example:
extern crate geonames;
use geonames::parser;
use geonames::sqlitewriter::write_sqlite;
let input: std::path::PathBuf = "./test_data/test_cities.txt";
let output: std::path::PathBuf = "output.db";
let mut parser = parser::Parser::new(); // Creates the new parser
parser.parse(input).expect("Failure to parse"); // Feeds the test data to the parser
write_sqlite(parser, output).expect("Failure to write"); // Writes the read data to the SQLite DB
MIT or Apache-2.0