Skip to main content

Wrapper over Shapely that returns the set of geohashes that form a Polygon

Project description

# polygon-geohasher
Polygon Geohasher is a Open source Python package which converts a
polygon into a set of geohashes with arbitrary precision. More
conversely, it can obtain the set of geohashes inside a polygon or
geohashes that touch (intersects) the polygon. This library uses
[python-geohash](https://pypi.python.org/pypi/Geohash/) and
[shapely](http://toblerity.org/shapely/).


## Requirements
Polygon Geohasher requires:

- Python >= 3.x.
- GEOS >= 3.3 (due to shapely).

## Installing
Linux users can get Polygon Geohasher from the Python Package Index with
pip (8+):

`todo`
`$ pip install polygon-geohasher`

## Usage
Here are some simple examples:

```python
from shapely import geometry

polygon = geometry.Polygon([(-99.1795917, 19.432134), (-99.1656847, 19.429034),
(-99.1776492, 19.414236), (-99.1795917, 19.432134)])
inner_geohashes_polygon = geohashes_to_polygon(polygon_to_geohashes(test_polygon, 7))
outer_geohashes_polygon = geohashes_to_polygon(polygon_to_geohashes(test_polygon, 7, False))
```


`geohash_to_polygon(geohash)`:

This function receives a geohash, and returns a Shapely's Polygon.

`geohashes_to_polygon(geohashes)`:

This function receives a set of geohashes, and returns a Shapely's Polygon or MultiPolygon.


`polygon_to_geohashes(polygon, precision, inner(optional))`:

This function receives a Shapely's Polygon, the precision of geohashes that
will be used to create a polygon and returns a set of geohashes
(strings) which covers the polygon. It also receives an optional
parameter `inner` that defines the way how those polygons will be created.
If inner only contained geohashes will be used, otherwise intersected will.

For instance you can see resulted geohashed polygons with both options.

![Example](./docs/images/geohashed-polygon-1.jpg)

#### Donations

If you want to make any donation you can send to:

- [BTC](bitcoin.org): 1H6VrFKCEabn3rbE9JJUSRXB7PU8Bm4SND
- [BCC](bitcoincash.org): 1CmuSwFD9qghEfJ4DdSiRWLxfvK5Srfqsg

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polygon-geohasher-0.0.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

polygon_geohasher-0.0.1-py2-none-any.whl (6.0 kB view details)

Uploaded Python 2

File details

Details for the file polygon-geohasher-0.0.1.tar.gz.

File metadata

File hashes

Hashes for polygon-geohasher-0.0.1.tar.gz
Algorithm Hash digest
SHA256 5c9f8788fa38df1606c7bd9e85fce636c8520a19a675c106ee387c0f613697ef
MD5 03e435437fb72bfc5a6a71a370999048
BLAKE2b-256 2b5551fc667ed4b660382fd77bb8c51da42fd231dda6c63e7ab7a27a7088a587

See more details on using hashes here.

File details

Details for the file polygon_geohasher-0.0.1-py2-none-any.whl.

File metadata

File hashes

Hashes for polygon_geohasher-0.0.1-py2-none-any.whl
Algorithm Hash digest
SHA256 c5072aa504705ad59c6454cee6093e8941447e83035a1903182a8eba6dc76f77
MD5 99ed25eba7b225786d9b0c437ecd8d99
BLAKE2b-256 853637e6bfedde5b7a743859b3ba1c40db85eb8a7c063aee997fa0fef6512b94

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page