A python library for interacting with geohash
Project description
Geohash Lite
GeohashLite is a Python package for dealing with GeoHash code. It support also conversion between GeoJSON and a list of GeoHash.
Installation
Clone this repository
git clone https://github.com/qxzzxq/python-geohash.git
Then install with python
cd python-geohash
python setup.py install
Dependencies
Usage
Coordinates encoding
import geohashlite
geohashlite.encode(48.86913, 2.32275, 7)
Geohash decoding
geohashlite.decode('u09whb7')
Conversion between GeoJSON and GeoHash
# GeoHash to GeoJSON
converter_1 = geohashlite.GeoJsonHasher()
x = ['u09k', 'u095', 'u08g', 'u09h', 'u09e', 'u097']
converter_1.geohash_codes = x
converter_1.decode_geohash(multipolygon=True)
print(converter_1.geojson)
# GeoJSON to GeoHash
converter_2 = geohashlite.GeoJsonHasher()
fc = {
"type": "FeatureCollection",
"features": [
"GeoJSON_Feature",
]
}
converter_2.geojson = fc
converter_2.encode_geojson(precision=4)
print(converter_2.geohash_codes)
Convert a geohash list to geojson (deprecated)
geohashlite.geohash_2_geojson(['u09whb7'])
Convert geojson to a geohash list (deprecated)
fc = {
"type": "FeatureCollection",
"features": [
"a_GeoJSON_Feature"
]
}
geohashlite.geojson_2_geohash(fc, precision=7)
Acknowledgement
Thanks Hiroaki Kawai and Jerry Xu.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
geohashlite-0.3.1.tar.gz
(14.8 kB
view hashes)
Built Distribution
Close
Hashes for geohashlite-0.3.1-cp37-cp37m-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1469eb0f6ea3200172b23a92f19c38e81b650945d9dda1d5ecc370f4cb20feb7 |
|
MD5 | b4ac17815e7e6c2edcde593ba16c1f78 |
|
BLAKE2b-256 | 1bc4321ef16cc69e51d600dae17f04eb10740f6446a09e1a32d490818f3f8f73 |