Skip to main content

Build Status python 2.7|3.4|3.5|3.6|3.7Downloads

Geolib

A python library for geohash encoding, decoding and finding neighbour cells. This is a python port of Chris Veness' javascript implementation.

Wikipedia reference

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

Metadata

Release files for geolib 1.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for geolib 1.0.7
File Size Uploaded Provenance Actions
geolib-1.0.7.tar.gz 4.2 kB Without provenance Details for geolib-1.0.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for geolib 1.0.7
File Interpreter ABI Platform Actions
geolib-1.0.7-py3-none-any.whl Python 3 none any Details for geolib-1.0.7-py3-none-any.whl

Total release size: 9.8 kB

Release files / geolib-1.0.7.tar.gz

Download URL geolib-1.0.7.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5d617fafbf337d333dc65b893b1893a664ca0383e3e4143932009761cf25962f
BLAKE2b-256 checksum
How to use checksums
c6df0d7bac8eadd310b9ea92b8bdb0b9b879a8567370859bf42e15a6b435ec31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

Release files / geolib-1.0.7-py3-none-any.whl

Download URL geolib-1.0.7-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
88a6b70dbcae49c51aa417e50d07e871d09e342c6bd060d88a76c921fcb34a75
BLAKE2b-256 checksum
How to use checksums
f246e08d831615af9670819432f84f63e30f65fdd4b9976faa093998e0af43ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

Security for geolib 1.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page