Skip to content

VgridPandas

VgridPands - Integrates Vgrid DGGS with GeoPandas and Pandas, inspired by H3-Pandas

VgridPandas supports a wide range of popular geodesic DGGS including H3, S2, A5, rHEALPix, Open-EAGGR ISEA4T, EASE-DGGS, QTM, as well as graticule-based systems such as OLC, Geohash, MGRS, GEOREF, TileCode, Quadkey, Maidenhead, and GARS.

logo

image image Binder PyPI version image image

Installation

pip

image

1
pip install vgridpandas --upgrade

Key Features

  • Latlong to DGGS: Convert latitude and longitude coordinates into DGGS cell IDs.
  • DGGS to geo boundary: Convert DGGS cell IDs into their corresponding geographic boundaries.
  • (Multi)Linestring/ (Multi)Polygon to DGGS: Convert (Multi)Linestring/ (Multi)Polygon to DGGS, supporting compact option.
  • DGGS point binning: Aggregate points into DGGS cells, supporting common statistics like count, min, max, and category-based groups.

Usage examples

Latlong to DGGS

1
2
3
4
# Prepare data
>>> import pandas as pd
>>> from vgridpandas import h3pandas
>>> df = pd.DataFrame({'lat': [10, 11], 'lon': [106, 107]})
1
2
3
4
5
6
7
8
>>> resolution = 10
>>> df = df.h3.latlon2h3(resolution)
>>> df

| h3_10           |   lat |   lon |
|:----------------|------:|------:|
| 8a65a212199ffff |    10 |   106 |
| 8a65b0b68237fff |    11 |   107 |

DGGS to geo boundary

1
2
3
4
5
6
7
>>> df = df.h3.h32geo()
>>> df

| h3_10           |   lat |   lon | geometry        |
|:----------------|------:|------:|:----------------|
| 8a65a212199ffff |    10 |   106 | POLYGON ((...)) |
| 8a65b0b68237fff |    11 |   107 | POLYGON ((...)) |

Further examples

For more examples, see the example notebooks.