All Projects → uber → H3 Py

uber / H3 Py

Licence: apache-2.0
Python bindings for H3, a hierarchical hexagonal geospatial indexing system

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to H3 Py

actinia core
Actinia Core is an open source REST API for scalable, distributed, high performance processing of geographical data that uses mainly GRASS GIS for computational tasks (DOI: https://doi.org/10.5281/zenodo.5879231)
Stars: ✭ 41 (-88.42%)
Mutual labels:  geospatial, gis
geowarp
Super Low-Level Raster Reprojection and Resampling Library
Stars: ✭ 20 (-94.35%)
Mutual labels:  geospatial, gis
GeoJSON.jl
Utilities for working with GeoJSON data in Julia
Stars: ✭ 46 (-87.01%)
Mutual labels:  geospatial, gis
rafagas
Daily geospatial links curated by Raf Roset
Stars: ✭ 17 (-95.2%)
Mutual labels:  geospatial, gis
Cga.js
CGA 3D 计算几何算法库 | 3D Compute Geometry Algorithm Library webgl three.js babylon.js等任何库都可以使用
Stars: ✭ 313 (-11.58%)
Mutual labels:  gis, geospatial
carto-spatial-extension
A set of UDFs and Procedures to extend BigQuery, Snowflake, Redshift and Postgres with Spatial Analytics capabilities
Stars: ✭ 131 (-62.99%)
Mutual labels:  geospatial, gis
NodeMICMAC
A Lightweight REST API to Access MICMAC Photogrammetry and SFM Engine.
Stars: ✭ 54 (-84.75%)
Mutual labels:  geospatial, gis
mapmint
Fast and easy webmapping.
Stars: ✭ 51 (-85.59%)
Mutual labels:  geospatial, gis
Grass
GRASS GIS - free and open source Geographic Information System (GIS)
Stars: ✭ 281 (-20.62%)
Mutual labels:  gis, geospatial
Osmnx
OSMnx: Python for street networks. Retrieve, model, analyze, and visualize street networks and other spatial data from OpenStreetMap.
Stars: ✭ 3,357 (+848.31%)
Mutual labels:  gis, geospatial
pygeoif
Basic implementation of the __geo_interface__
Stars: ✭ 44 (-87.57%)
Mutual labels:  geospatial, gis
Solaris
CosmiQ Works Geospatial Machine Learning Analysis Toolkit
Stars: ✭ 290 (-18.08%)
Mutual labels:  gis, geospatial
lonlat bng
A multithreaded Rust library with FFI for converting WGS84 longitude and latitude coordinates into BNG (OSGB36) Eastings and Northings and vice versa (using OSTN15)
Stars: ✭ 20 (-94.35%)
Mutual labels:  geospatial, gis
echomap
Preview map files in the terminal
Stars: ✭ 12 (-96.61%)
Mutual labels:  geospatial, gis
earthengine-py-examples
A collection of 300+ examples for using Earth Engine and the geemap Python package
Stars: ✭ 76 (-78.53%)
Mutual labels:  geospatial, gis
geoos
A library provides spatial data and geometric algorithms
Stars: ✭ 504 (+42.37%)
Mutual labels:  geospatial, gis
go-kml
Package kml provides convenience methods for creating and writing KML documents.
Stars: ✭ 67 (-81.07%)
Mutual labels:  geospatial, gis
opentopodata
Open alternative to the Google Elevation API!
Stars: ✭ 163 (-53.95%)
Mutual labels:  geospatial, gis
hereR
R package that provides an interface to the HERE REST APIs: Geocoder API, Routing API, Traffic API, Public Transit API and Destination Weather API. Locations and routes are returned as 'sf' objects.
Stars: ✭ 72 (-79.66%)
Mutual labels:  geocoding, gis
Geospatial Machine Learning
A curated list of resources focused on Machine Learning in Geospatial Data Science.
Stars: ✭ 289 (-18.36%)
Mutual labels:  gis, geospatial
H3 Logo

h3-py

PyPI version PyPI downloads conda version version

Tests codecov

Python bindings for the H3 Core Library.

For API reference, see the H3 Documentation.

Installation

From PyPI:

pip install h3

From conda:

conda config --add channels conda-forge
conda install h3-py

New since v3.6.1: We upload pre-built Python Wheels to PyPI for Linux/Mac/Windows, which should avoid many previous installation issues.

Usage

>>> import h3
>>> lat, lng = 0, 0
>>> resolution = 0
>>> h3.geo_to_h3(lat, lng, resolution)
'8075fffffffffff'

Example gallery

Browse a collection of example notebooks, and if you have examples or visualizations of your own, please feel free to contribute!

We also have a simple walkthrough of the API. For more information, please see the H3 Documentation.

APIs

We provide multiple APIs in h3-py. All APIs have the same set of functions, but differ in their input/output formats.

h3.api.basic_str

H3 indexes are represented as Python strs, using list and set for collections.

This is the default API provided when you import h3. That is, import h3.api.basic_str as h3 and import h3 are basically equivalent.

>>> import h3
>>> h = h3.geo_to_h3(0, 0, 0)
>>> h
'8075fffffffffff'

>>> h3.hex_ring(h, 1)
{'8055fffffffffff',
 '8059fffffffffff',
 '807dfffffffffff',
 '8083fffffffffff',
 '8099fffffffffff'}

h3.api.basic_int

H3 indexes are represented as Python ints, using list and set for collections.

>>> import h3.api.basic_int as h3
>>> h = h3.geo_to_h3(0, 0, 0)
>>> h
578536630256664575

>>> h3.hex_ring(h, 1)
{577973680303243263,
 578044049047420927,
 578677367745019903,
 578782920861286399,
 579169948954263551}

h3.api.numpy_int

H3 indexes are represented as uint64s, using numpy.ndarray for collections.

The intention is for this API to be faster and more memory-efficient by not requiring int to str conversion and by using no-copy numpy arrays instead of Python lists and sets.

>>> import h3.api.numpy_int as h3
>>> h = h3.geo_to_h3(0, 0, 0)
>>> h
578536630256664575

>>> h3.hex_ring(h, 1)
array([578782920861286399, 578044049047420927, 577973680303243263,
       578677367745019903, 579169948954263551], dtype=uint64)

Note that h3 has no runtime dependencies on other libraries, so a standard pip install will install no additional libraries. However, h3.api.numpy_int requires numpy. To have numpy installed (if it isn't already) along with h3, run pip install h3[numpy].

h3.api.memview_int

H3 indexes are represented as uint64s, using Python memoryview objects for collections.

This API has the same benefits as numpy_int, except it uses (the less well-known but dependency-free) memoryview.

>>> import h3.api.memview_int as h3
>>> h = h3.geo_to_h3(0, 0, 0)
>>> h
578536630256664575

>>> mv = h3.hex_ring(h, 1)
>>> mv
<MemoryView of 'array' at 0x11188c710>

>>> mv[0]
578782920861286399

>>> list(mv)
[578782920861286399,
 578044049047420927,
 577973680303243263,
 578677367745019903,
 579169948954263551]

When using this API with numpy, note that numpy.array creates a copy of the data, while numpy.asarray does not create a copy and the result points to the same memory location as the memoryview object.

Continuing from the example above,

>>> mv = h3.hex_ring(h, 1)
>>> a = np.array(mv)
>>> mv[0] = 0
>>> a
array([578782920861286399, 578044049047420927, 577973680303243263,
       578677367745019903, 579169948954263551], dtype=uint64)

>>> mv = h3.hex_ring(h, 1)
>>> a = np.asarray(mv)
>>> mv[0] = 0
>>> a
array([                 0, 578044049047420927, 577973680303243263,
       578677367745019903, 579169948954263551], dtype=uint64)

Versioning

h3-py wraps the H3 Core Library, which is written in C. Both projects employ semantic versioning, with versions taking the form X.Y.Z.

h3-py will match the C library in major and minor numbers (X.Y), but may be different on the patch (Z) number.

Use h3.versions() to see the version numbers for both h3-py and the C library. For example,

>>> import h3
>>> h3.versions()
{'c': '3.6.3', 'python': '3.6.1'}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].