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
python3 -m build
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-0.0.1.tar.gz
(9.5 kB
view hashes)
Built Distribution
Close
Hashes for h3_pyspark-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e46b35224fa9a16018260a98fbe2477c58e0c535cd54b5b9bd79847a85be70c |
|
MD5 | b0185710c8172e5121df85a4f3aa60df |
|
BLAKE2b-256 | cb99bad32a22cb5605601112e674563f8d87c8d45a59738f8bda300610c1579f |