Giter VIP home page Giter VIP logo

geohash's Introduction

Geohash

Geohash is a Python module that provides functions for decoding and encoding Geohashes to and from latitude and longitude coordinates.

Example:

>>> import Geohash
>>> print 'Geohash for 42.6, -5.6:', Geohash.encode(42.6, -5.6)
Geohash for 42.6, -5.6: ezs42e44yx96

You can specify an arbitrary precision when encoding. The precision determines the number of characters in the Geohash:

>>> print 'Geohash for 42.6, -5.6:', Geohash.encode(42.6, -5.6, precision=5)
Geohash for 42.6, -5.6: ezs42

Decoding a Geohash returns a (latitude, longitude) tuple:

>>> print 'Coordinate for Geohash ezs42:', Geohash.decode('ezs42')
Coordinate for Geohash ezs42: ('42.6', '-5.6')

The Geohash module also provides exact decoding with error margin results. The decode_exactly function returns a tuple of four float values; latitude, longitude, latitude error margin, longitude error margin:

>>> print 'Exact coordinate for Geohash ezs42:\n', Geohash.decode_exactly('ezs42')
Exact coordinate for Geohash ezs42:
(42.60498046875, -5.60302734375, 0.02197265625, 0.02197265625)

The last two values are the plus/minus error margin of the latitude and longitude respectively. In this particular case the error margins happen to be the same for both the latitude and the longitude, but this is just a co-incidence due to the precision of the Geohash and thus the number of bits used for the latitude and longitude encoding, respectively.

Download

Geohash is available for download from github and from the Python Package Index.

License

Copyright (C) 2008 Leonard Norrgard <[email protected]> Copyright (C) 2015 Leonard Norrgard <[email protected]>

Geohash is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Geohash is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with Geohash. If not, see <http://www.gnu.org/licenses/>.

History

The Geohash encoding was originally described by Gustavo Niemeyer and the algorithm published in the Wikipedia Geohash article.

This implementation of Geohashes was written by Leonard Norrgard <[email protected]>.

Keywords

Geohash, GIS, latitude, longitude, encode, decode, Galileo, GPS, WGS84, coordinates, geotagging.

geohash's People

Contributors

vinsci avatar

Watchers

 avatar  avatar  avatar

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.