Coder Social home page Coder Social logo

osm_rg's Introduction

OSM Reverse Geocoder

A Python library for offline reverse geocoding. It improves on an existing library called reverse-geocoder developed by [Ajay Thampi]

Features

  1. Besides city/town and country code, this library also returns the nearest latitude and longitude and also administrative regions 1 and 2.
  2. This library also uses a parallelised implementation of K-D trees which promises an improved performance especially for large inputs.
  3. Many extra information from OSM

The K-D tree is populated with cities that have a population > 1000. The source of the data is GeoNames.

Dependencies

  1. scipy
  2. numpy
  3. geopy
  4. pandas
  5. ast

Usage

The library supports two modes:

  1. Mode 1: Single-threaded K-D Tree (default, similar to [reverse_geocode] (https://pypi.python.org/pypi/reverse_geocode/1.0))
  2. Mode 2: Multi-threaded K-D Tree
import osm_rg as rg

city = (-33.86785, 151.20732)

results = rg.get(city) # default mode = 1, precision = 2

print results

The above code will output the following:

[{
    'town': nan,
    'village': nan,
    'country': 'Australia', 
    'city': 'Sydney', 
    'country_code': 'au', 
    'geo_id': 2147714
}]

If you'd like to use the multi-threaded K-D tree, set mode = 2 as follows:

results = rg.get(city, mode=2)

Acknowledgements

  1. Major inspiration is from Ajay Thampi's [reverse_geocoder] (https://github.com/thampiman/reverse-geocoder) library
  2. Parallelised implementation of K-D Trees is extended from this article by Sturla Molden
  3. Geocoded data is from GeoNames

osm_rg's People

Contributors

scitator avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

mashaka

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.