PySpark bindings for H3, a hierarchical hexagonal geospatial indexing system
Project description
h3-pyspark: Uber's H3 Hexagonal Hierarchical Geospatial Indexing System in PySpark
PySpark bindings for the H3 core library.
For available functions, please see the vanilla Python binding documentation at:
Installation
From PyPI
:
pip install h3-pyspark
From conda
conda config --add channels conda-forge
conda install h3-pyspark
Usage
>>> from pyspark.sql import SparkSession, functions as F
>>> import h3_pyspark
>>>
>>> spark = SparkSession.builder.getOrCreate()
>>> df = spark.createDataFrame([{"lat": 37.769377, "lng": -122.388903, 'resolution': 9}])
>>>
>>> df = df.withColumn('h3_9', h3_pyspark.geo_to_h3('lat', 'lng', 'resolution'))
>>> df.show()
+---------+-----------+----------+---------------+
| lat| lng|resolution| h3_9|
+---------+-----------+----------+---------------+
|37.769377|-122.388903| 9|89283082e73ffff|
+---------+-----------+----------+---------------+
Publishing
- Bump version in
setup.cfg
- Publish:
python3 -m build
python3 -m twine upload --repository pypi dist/*
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
h3-pyspark-1.0.0.tar.gz
(9.6 kB
view hashes)
Built Distribution
Close
Hashes for h3_pyspark-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e14b79ec51d16e18b0d5d134f6eef8b6bef60473e43aa4ca88900e045904420 |
|
MD5 | bb2765b5e730a7310cc1fa0f31196cf7 |
|
BLAKE2b-256 | aaf86d52e011157adeae53f395fbc1277995714ce5128399fd4cababf6cb6ada |