Giter VIP home page Giter VIP logo

closestgeoname's Introduction

closestgeoname

This program was written to avoid harrassing the API of a poor online server when requesting countless amount of place name geolocation requests in an application.

The program downloads a placename database from GeoNames and generates an SQLite database. SQLite's SpatiaLite addon is then used to generate a spatial index for extremely fast querying to return the closest place name for a given latitude and longitude

Setup

Dependencies can be installed by either pip or conda

pip

pip install -r requirements.txt

conda

conda install --file requirements.txt

Usage

On first run, if there is no geonames.sqlite file in the directory, it will prompt you to download from a choice of hardcoded links to the GeoNames server.

Beware of the file sizes and your RAM when choosing your desired database, the complete allCountries.txt (1.4 GB) file will consume about 1.9 GB after generating the SQLite DB with spatial index. On downloading and building, it will require double this and need about 8-10 GB of RAM.

The script's primary purpose is to offer functionality to other python programs, but can be used from the command line as seen in the examples below.

Examples

On first run:

image-20200107200335395

Acceptable arguments:

image-20200107200409764

Querying coordinates:

image-20200107200652018

License

MIT

closestgeoname's People

Contributors

evanjt avatar

Stargazers

ThumbGen avatar Christian W. avatar eth4 avatar

Watchers

James Cloos avatar  avatar

Forkers

eth4io

closestgeoname's Issues

Possible crash in reporthook

Hi

excellent library, thanks a lot for providing it!

I had nevertheless to apply a small fix, for reporthook

duration = time.time() - start_time

the duration might be 0 and will cause a crash later when calculating speed.

a very naive:
duration = time.time() - start_time + 1
fixed it

Maybe you find a better way to fix this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.