geolib


Namegeolib JSON
Version 1.0.7 PyPI version JSON
download
home_pagehttps://github.com/joyanujoy/geolib
SummaryA library for geohash encoding, decoding and associated functions
upload_time2019-05-04 22:20:18
maintainer
docs_urlNone
authorAnu Joy
requires_python>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*
license
keywords
VCS
bugtrack_url
requirements future
Travis-CI
coveralls test coverage No coveralls.
            [![Build Status](https://travis-ci.org/joyanujoy/geolib.svg?branch=master)](https://travis-ci.org/joyanujoy/geolib) ![python 2.7|3.4|3.5|3.6|3.7](https://img.shields.io/badge/python-2.7|3.4|3.5|3.6|3.7-blue.svg)[![Downloads](https://pepy.tech/badge/geolib)](https://pepy.tech/project/geolib)

# Geolib
A python library for geohash encoding, decoding and finding neighbour cells. This is a python port of [Chris Veness' javascript implementation](https://www.movable-type.co.uk/scripts/geohash.html).

[Wikipedia reference](http://en.wikipedia.org/wiki/Geohash)
## Installation
```pipenv install geolib```
or
```pip install geolib```
## Usage

    from geolib import geohash
   ### Encode a latitude, longtiude to geohash
    geohash.encode(latitude, longitude, precision)
    >>> geohash.encode('70.2995', '-27.9993', 7)
    >>> gkkpfve

   ### Decode a geohash to latitude, longitude
    geohash.decode(geohash), returns latitude, longitude as tuple of decimals
    >>> geohash.decode('gkkpfve')
    >>> (70.2995, -27.9993)

   ### Find neighbouring cells of a geohash
    geohash.neighbours(geohash) 
    retuns a namedtuple (n, ne, e, se, s, sw, w, nw)    

    >>> neighbours = geohash.neighbours('gcpuyph')
    >>> neighbours
    >>> ('gcpuypk', 'gcpuypm', 'gcpuypj', 'gcpuynv', 'gcpuynu', 'gcpuyng', 'gcpuyp5', 'gcpuyp7')
    >>> neighbours.ne
    >>> gcpuypm

   ### Find adjacent cell in a given direction
    geohash.adjacent(geohash, direction)
    >>> geohash.adjacent('gcpuyph', 'n')
    >>> gcpuypk

   ### Find SW/NE latitude/longitude bounds of a geohash
    geohash.bounds(geohash)
    returns a namedtuple ((sw_lat, sw_lon), ((ne_lat, ne_lon))
    >>> bounds = geohash.bounds('ezs42')
    >>> bounds
    >>> ((42.583, -5.625), (42.627, -5.58)))
    >>> bounds.sw.lat 
    >>> 42.583

## Documentation
   [Geolib readthedocs](https://geolib.readthedocs.io/en/latest/)



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/joyanujoy/geolib",
    "name": "geolib",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*",
    "maintainer_email": "",
    "keywords": "",
    "author": "Anu Joy",
    "author_email": "oss@cartographix.org",
    "download_url": "https://files.pythonhosted.org/packages/c6/df/0d7bac8eadd310b9ea92b8bdb0b9b879a8567370859bf42e15a6b435ec31/geolib-1.0.7.tar.gz",
    "platform": "",
    "description": "[![Build Status](https://travis-ci.org/joyanujoy/geolib.svg?branch=master)](https://travis-ci.org/joyanujoy/geolib) ![python 2.7|3.4|3.5|3.6|3.7](https://img.shields.io/badge/python-2.7|3.4|3.5|3.6|3.7-blue.svg)[![Downloads](https://pepy.tech/badge/geolib)](https://pepy.tech/project/geolib)\n\n# Geolib\nA python library for geohash encoding, decoding and finding neighbour cells. This is a python port of [Chris Veness' javascript implementation](https://www.movable-type.co.uk/scripts/geohash.html).\n\n[Wikipedia reference](http://en.wikipedia.org/wiki/Geohash)\n## Installation\n```pipenv install geolib```\nor\n```pip install geolib```\n## Usage\n\n    from geolib import geohash\n   ### Encode a latitude, longtiude to geohash\n    geohash.encode(latitude, longitude, precision)\n    >>> geohash.encode('70.2995', '-27.9993', 7)\n    >>> gkkpfve\n\n   ### Decode a geohash to latitude, longitude\n    geohash.decode(geohash), returns latitude, longitude as tuple of decimals\n    >>> geohash.decode('gkkpfve')\n    >>> (70.2995, -27.9993)\n\n   ### Find neighbouring cells of a geohash\n    geohash.neighbours(geohash) \n    retuns a namedtuple (n, ne, e, se, s, sw, w, nw)    \n\n    >>> neighbours = geohash.neighbours('gcpuyph')\n    >>> neighbours\n    >>> ('gcpuypk', 'gcpuypm', 'gcpuypj', 'gcpuynv', 'gcpuynu', 'gcpuyng', 'gcpuyp5', 'gcpuyp7')\n    >>> neighbours.ne\n    >>> gcpuypm\n\n   ### Find adjacent cell in a given direction\n    geohash.adjacent(geohash, direction)\n    >>> geohash.adjacent('gcpuyph', 'n')\n    >>> gcpuypk\n\n   ### Find SW/NE latitude/longitude bounds of a geohash\n    geohash.bounds(geohash)\n    returns a namedtuple ((sw_lat, sw_lon), ((ne_lat, ne_lon))\n    >>> bounds = geohash.bounds('ezs42')\n    >>> bounds\n    >>> ((42.583, -5.625), (42.627, -5.58)))\n    >>> bounds.sw.lat \n    >>> 42.583\n\n## Documentation\n   [Geolib readthedocs](https://geolib.readthedocs.io/en/latest/)\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A library for geohash encoding, decoding and associated functions",
    "version": "1.0.7",
    "project_urls": {
        "Homepage": "https://github.com/joyanujoy/geolib"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f246e08d831615af9670819432f84f63e30f65fdd4b9976faa093998e0af43ad",
                "md5": "5af0d7ff81d015fe68a59b3fff5b09db",
                "sha256": "88a6b70dbcae49c51aa417e50d07e871d09e342c6bd060d88a76c921fcb34a75"
            },
            "downloads": -1,
            "filename": "geolib-1.0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5af0d7ff81d015fe68a59b3fff5b09db",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*",
            "size": 5538,
            "upload_time": "2019-05-04T22:20:17",
            "upload_time_iso_8601": "2019-05-04T22:20:17.370688Z",
            "url": "https://files.pythonhosted.org/packages/f2/46/e08d831615af9670819432f84f63e30f65fdd4b9976faa093998e0af43ad/geolib-1.0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c6df0d7bac8eadd310b9ea92b8bdb0b9b879a8567370859bf42e15a6b435ec31",
                "md5": "082d8d4aa5ad1ce055ec6750e689e352",
                "sha256": "5d617fafbf337d333dc65b893b1893a664ca0383e3e4143932009761cf25962f"
            },
            "downloads": -1,
            "filename": "geolib-1.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "082d8d4aa5ad1ce055ec6750e689e352",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*",
            "size": 4228,
            "upload_time": "2019-05-04T22:20:18",
            "upload_time_iso_8601": "2019-05-04T22:20:18.892213Z",
            "url": "https://files.pythonhosted.org/packages/c6/df/0d7bac8eadd310b9ea92b8bdb0b9b879a8567370859bf42e15a6b435ec31/geolib-1.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2019-05-04 22:20:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "joyanujoy",
    "github_project": "geolib",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "future",
            "specs": [
                [
                    ">=",
                    "0.16.0"
                ]
            ]
        }
    ],
    "lcname": "geolib"
}
        
Elapsed time: 0.19314s