Name | h3spark JSON |
Version |
0.0.2
JSON |
| download |
home_page | None |
Summary | Lightweight pyspark wrapper for h3-py |
upload_time | 2024-11-27 17:01:11 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.9 |
license | MIT License |
keywords |
h3
h3-py
pyspark
spark
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# h3spark
`h3spark` is a Python library that provides a set of user-defined functions (UDFs) for working with H3 geospatial indexing in PySpark. The functions in this library follow the same assumptions and rules as the native H3 functions, allowing for seamless integration and usage in PySpark data pipelines.
## Installation
You can install `h3spark` using either pip or conda.
### Using pip
```bash
pip install h3spark
```
### Using conda
```bash
conda install -c conda-forge h3spark
```
## Usage
Below is a brief overview of the available functions in `h3spark`. These functions are designed to work with PySpark DataFrames and provide H3 functionality within a distributed data processing environment.
### Functions
- `str_to_int(h3_str)`: Converts an H3 string to a decimal integer.
- `int_to_str(h3_int)`: Converts an H3 integer to a string.
- `get_num_cells(res)`: Returns the number of H3 cells for a given resolution.
- `average_hexagon_area(res, unit)`: Returns the average area of H3 hexagons at a given resolution.
- `average_hexagon_edge_length(res, unit)`: Returns the average edge length of H3 hexagons at a given resolution.
- `latlng_to_cell_decimal(lat, lng, res)`: Converts latitude and longitude to an H3 cell in decimal format.
- `latlng_to_cell(lat, lng, res)`: Converts latitude and longitude to an H3 cell in string format.
- `cell_to_latlng(cell)`: Converts an H3 cell to latitude and longitude coordinates.
- `get_resolutiuon(cell)`: Returns the resolution of an H3 cell.
- `cell_to_parent_decimal(cell, res)`: Converts an H3 cell to its parent cell at a given resolution in decimal format.
- `cell_to_parent(cell, res)`: Converts an H3 cell to its parent cell at a given resolution in string format.
- `grid_distance(cell1, cell2)`: Returns the distance between two H3 cells.
- `cell_to_boundary(cell)`: Returns the boundary of an H3 cell.
- `grid_disk_decimal(cell, k)`: Returns the H3 cells within k rings from the origin cell in decimal format.
- `grid_disk(cell, k)`: Returns the H3 cells within k rings from the origin cell in string format.
- `grid_ring_decimal(cell, k)`: Returns the H3 cells in the k-th ring from the origin cell in decimal format.
- `grid_ring(cell, k)`: Returns the H3 cells in the k-th ring from the origin cell in string format.
- `cell_to_children_size(cell, res)`: Returns the number of child cells at a given resolution for an H3 cell.
- `cell_to_children_decimal(cell, res)`: Returns the child cells of an H3 cell at a given resolution in decimal format.
- `cell_to_children(cell, res)`: Returns the child cells of an H3 cell at a given resolution in string format.
- `cell_to_child_pos(child, res_parent)`: Returns the position of a child cell relative to its parent.
- `child_pos_to_cell_decimal(parent, res_child, child_pos)`: Converts a parent cell, resolution, and child position to an H3 cell in decimal format.
- `child_pos_to_cell(parent, res_child, child_pos)`: Converts a parent cell, resolution, and child position to an H3 cell in string format.
- `compact_cells_decimal(cells)`: Compacts a list of H3 cells in decimal format.
- `compact_cells(cells)`: Compacts a list of H3 cells in string format.
- `uncompact_cells_decimal(cells, res)`: Uncompacts a list of H3 cells to a given resolution in decimal format.
- `uncompact_cells(cells, res)`: Uncompacts a list of H3 cells to a given resolution in string format.
- `h3shape_to_cells_decimal(shape, res)`: Converts an H3 shape to cells at a given resolution in decimal format.
- `h3shape_to_cells(shape, res)`: Converts an H3 shape to cells at a given resolution in string format.
- `cells_to_h3shape(cells)`: Converts a list of H3 cells to an H3 shape.
- `is_pentagon(cell)`: Checks if an H3 cell is a pentagon.
- `get_base_cell_number(cell)`: Returns the base cell number of an H3 cell.
- `are_neighbor_cells(cell1, cell2)`: Checks if two H3 cells are neighbors.
- `grid_path_cells_decimal(start, end)`: Returns the H3 cells forming a path between two cells in decimal format.
- `grid_path_cells(start, end)`: Returns the H3 cells forming a path between two cells in string format.
- `is_res_class_III(cell)`: Checks if an H3 cell is of class III resolution.
- `get_pentagons_decimal(res)`: Returns the pentagons at a given resolution in decimal format.
- `get_pentagons(res)`: Returns the pentagons at a given resolution in string format.
- `get_res0_cells_decimal()`: Returns the resolution 0 cells in decimal format.
- `get_res0_cells()`: Returns the resolution 0 cells in string format.
- `cell_to_center_child_decimal(cell, res)`: Returns the center child cell of an H3 cell at a given resolution in decimal format.
- `cell_to_center_child(cell, res)`: Returns the center child cell of an H3 cell at a given resolution in string format.
- `get_icosahedron_faces(cell)`: Returns the icosahedron faces of an H3 cell.
- `cell_to_local_ij(cell)`: Converts an H3 cell to local IJ coordinates.
- `local_ij_to_cell_decimal(origin, i, j)`: Converts local IJ coordinates to an H3 cell in decimal format.
- `local_ij_to_cell(origin, i, j)`: Converts local IJ coordinates to an H3 cell in string format.
- `cell_area(cell, unit)`: Returns the area of an H3 cell in a specified unit.
## License
This library is released under the MIT License. See the [LICENSE](LICENSE) file for more details.
## Contributing
Contributions are welcome! Please submit a pull request or open an issue to contribute to the project.
## Acknowledgments
This library is built on top of the H3 geospatial indexing library and PySpark. Special thanks to the developers of these libraries for their contributions to the open-source community.
For more information, check the [official H3 documentation](https://h3geo.org/docs/) and [PySpark documentation](https://spark.apache.org/docs/latest/api/python/index.html).
Raw data
{
"_id": null,
"home_page": null,
"name": "h3spark",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "h3, h3-py, pyspark, spark",
"author": null,
"author_email": "Joseph Chotard <h3spark@chotard.com>",
"download_url": "https://files.pythonhosted.org/packages/59/7a/70a3953381e0aaef327970dc603e9ad1ed0103adfedadd2d6e937455627a/h3spark-0.0.2.tar.gz",
"platform": null,
"description": "# h3spark\n\n`h3spark` is a Python library that provides a set of user-defined functions (UDFs) for working with H3 geospatial indexing in PySpark. The functions in this library follow the same assumptions and rules as the native H3 functions, allowing for seamless integration and usage in PySpark data pipelines.\n\n## Installation\n\nYou can install `h3spark` using either pip or conda.\n\n### Using pip\n```bash\npip install h3spark\n```\n\n### Using conda\n```bash\nconda install -c conda-forge h3spark\n```\n\n## Usage\n\nBelow is a brief overview of the available functions in `h3spark`. These functions are designed to work with PySpark DataFrames and provide H3 functionality within a distributed data processing environment.\n\n### Functions\n\n- `str_to_int(h3_str)`: Converts an H3 string to a decimal integer.\n- `int_to_str(h3_int)`: Converts an H3 integer to a string.\n- `get_num_cells(res)`: Returns the number of H3 cells for a given resolution.\n- `average_hexagon_area(res, unit)`: Returns the average area of H3 hexagons at a given resolution.\n- `average_hexagon_edge_length(res, unit)`: Returns the average edge length of H3 hexagons at a given resolution.\n- `latlng_to_cell_decimal(lat, lng, res)`: Converts latitude and longitude to an H3 cell in decimal format.\n- `latlng_to_cell(lat, lng, res)`: Converts latitude and longitude to an H3 cell in string format.\n- `cell_to_latlng(cell)`: Converts an H3 cell to latitude and longitude coordinates.\n- `get_resolutiuon(cell)`: Returns the resolution of an H3 cell.\n- `cell_to_parent_decimal(cell, res)`: Converts an H3 cell to its parent cell at a given resolution in decimal format.\n- `cell_to_parent(cell, res)`: Converts an H3 cell to its parent cell at a given resolution in string format.\n- `grid_distance(cell1, cell2)`: Returns the distance between two H3 cells.\n- `cell_to_boundary(cell)`: Returns the boundary of an H3 cell.\n- `grid_disk_decimal(cell, k)`: Returns the H3 cells within k rings from the origin cell in decimal format.\n- `grid_disk(cell, k)`: Returns the H3 cells within k rings from the origin cell in string format.\n- `grid_ring_decimal(cell, k)`: Returns the H3 cells in the k-th ring from the origin cell in decimal format.\n- `grid_ring(cell, k)`: Returns the H3 cells in the k-th ring from the origin cell in string format.\n- `cell_to_children_size(cell, res)`: Returns the number of child cells at a given resolution for an H3 cell.\n- `cell_to_children_decimal(cell, res)`: Returns the child cells of an H3 cell at a given resolution in decimal format.\n- `cell_to_children(cell, res)`: Returns the child cells of an H3 cell at a given resolution in string format.\n- `cell_to_child_pos(child, res_parent)`: Returns the position of a child cell relative to its parent.\n- `child_pos_to_cell_decimal(parent, res_child, child_pos)`: Converts a parent cell, resolution, and child position to an H3 cell in decimal format.\n- `child_pos_to_cell(parent, res_child, child_pos)`: Converts a parent cell, resolution, and child position to an H3 cell in string format.\n- `compact_cells_decimal(cells)`: Compacts a list of H3 cells in decimal format.\n- `compact_cells(cells)`: Compacts a list of H3 cells in string format.\n- `uncompact_cells_decimal(cells, res)`: Uncompacts a list of H3 cells to a given resolution in decimal format.\n- `uncompact_cells(cells, res)`: Uncompacts a list of H3 cells to a given resolution in string format.\n- `h3shape_to_cells_decimal(shape, res)`: Converts an H3 shape to cells at a given resolution in decimal format.\n- `h3shape_to_cells(shape, res)`: Converts an H3 shape to cells at a given resolution in string format.\n- `cells_to_h3shape(cells)`: Converts a list of H3 cells to an H3 shape.\n- `is_pentagon(cell)`: Checks if an H3 cell is a pentagon.\n- `get_base_cell_number(cell)`: Returns the base cell number of an H3 cell.\n- `are_neighbor_cells(cell1, cell2)`: Checks if two H3 cells are neighbors.\n- `grid_path_cells_decimal(start, end)`: Returns the H3 cells forming a path between two cells in decimal format.\n- `grid_path_cells(start, end)`: Returns the H3 cells forming a path between two cells in string format.\n- `is_res_class_III(cell)`: Checks if an H3 cell is of class III resolution.\n- `get_pentagons_decimal(res)`: Returns the pentagons at a given resolution in decimal format.\n- `get_pentagons(res)`: Returns the pentagons at a given resolution in string format.\n- `get_res0_cells_decimal()`: Returns the resolution 0 cells in decimal format.\n- `get_res0_cells()`: Returns the resolution 0 cells in string format.\n- `cell_to_center_child_decimal(cell, res)`: Returns the center child cell of an H3 cell at a given resolution in decimal format.\n- `cell_to_center_child(cell, res)`: Returns the center child cell of an H3 cell at a given resolution in string format.\n- `get_icosahedron_faces(cell)`: Returns the icosahedron faces of an H3 cell.\n- `cell_to_local_ij(cell)`: Converts an H3 cell to local IJ coordinates.\n- `local_ij_to_cell_decimal(origin, i, j)`: Converts local IJ coordinates to an H3 cell in decimal format.\n- `local_ij_to_cell(origin, i, j)`: Converts local IJ coordinates to an H3 cell in string format.\n- `cell_area(cell, unit)`: Returns the area of an H3 cell in a specified unit.\n\n## License\n\nThis library is released under the MIT License. See the [LICENSE](LICENSE) file for more details.\n\n## Contributing\n\nContributions are welcome! Please submit a pull request or open an issue to contribute to the project.\n\n## Acknowledgments\n\nThis library is built on top of the H3 geospatial indexing library and PySpark. Special thanks to the developers of these libraries for their contributions to the open-source community.\n\nFor more information, check the [official H3 documentation](https://h3geo.org/docs/) and [PySpark documentation](https://spark.apache.org/docs/latest/api/python/index.html).",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Lightweight pyspark wrapper for h3-py",
"version": "0.0.2",
"project_urls": null,
"split_keywords": [
"h3",
" h3-py",
" pyspark",
" spark"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a7cbdbc6d45d7d742838d94bc33d7ba9ba0573003004d64936102d5a520d87d3",
"md5": "dcd7ef2888c2927d627f76f091b540d9",
"sha256": "99565d303d60bd0d4a09012cc3d74eff0c80abd434c087febde315093fc84429"
},
"downloads": -1,
"filename": "h3spark-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dcd7ef2888c2927d627f76f091b540d9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 5852,
"upload_time": "2024-11-27T17:01:10",
"upload_time_iso_8601": "2024-11-27T17:01:10.483579Z",
"url": "https://files.pythonhosted.org/packages/a7/cb/dbc6d45d7d742838d94bc33d7ba9ba0573003004d64936102d5a520d87d3/h3spark-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "597a70a3953381e0aaef327970dc603e9ad1ed0103adfedadd2d6e937455627a",
"md5": "0ed9f6c8ed5666d726c007a53ee16742",
"sha256": "f33e638c92a4830d8471e82a5062ba0809ba73d6a0c39be35bcd3e2856444470"
},
"downloads": -1,
"filename": "h3spark-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "0ed9f6c8ed5666d726c007a53ee16742",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 8876,
"upload_time": "2024-11-27T17:01:11",
"upload_time_iso_8601": "2024-11-27T17:01:11.883155Z",
"url": "https://files.pythonhosted.org/packages/59/7a/70a3953381e0aaef327970dc603e9ad1ed0103adfedadd2d6e937455627a/h3spark-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-27 17:01:11",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "h3spark"
}