Skip to main content

VgridPandas

VgridPandas - Integrates Vgrid DGGS with GeoPandas and Pandas, inspired by H3-Pandas by Daniel Jahn.

VgridPandas supports a wide range of DGGSs, including H3, S2, A5, rHEALPix, DGGAL, DGGRID, OpenEAGGR ISEA4T, ISEA3H, EASE-DGGS, QTM, OLC, Geohash, GEOREF, MGRS, TileCode, Quadkey, Maidenhead, and GARS.

logo

image image image image PyPI version image image

Full VgridPandas DGGS documentation is available at vgridpandas document.

To work with Vgrid in Python or CLI, use vgrid package. Full Vgrid DGGS documentation is available at vgrid document.

To work with Vgrid DGGS in QGIS, install the Vgrid Plugin.

To visualize DGGS in Maplibre GL JS, try the vgrid-maplibre library.

For an interactive demo, visit the Vgrid Homepage.

Installation

pip

image

pip install vgridpandas --upgrade

Key Features

  • Latlon 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 via linetrace and (Multi)Polygon via polyfill, supporting compact option.
  • DGGS binning: Aggregate points into DGGS cells, supporting common aggregations (count, min, max, etc.) and category-based groups.

Usage examples

Latlon to DGGS

import pandas as pd
from vgridpandas import h3pandas
df = pd.DataFrame({'lat': [10, 11], 'lon': [106, 107]})
resolution = 10
df = df.h3.latlon2h3(resolution, lat_col = 'lat', lat_col = 'lon')
df

| h3              |   lat |   lon |
|-----------------|-------|-------|
| 8a65a212199ffff |    10 |   106 |
| 8a65b0b68237fff |    11 |   107 |

DGGS to geo

df = df.h3.h32geo()
df

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

(Multi)Linestring/ (Multi)Polygon to DGGS

import geopandas as gpd
from vgridpandas import s2pandas

gdf = gpd.read_file('https://raw.githubusercontent.com/opengeoshub/vopendata/main/shape/polygon.geojson')
resolution = 18
gdf_polyfill = gdf.s2.polyfill(resolution, compact = True, predicate = "intersects")
gdf_polyfill.head()
gdf_polyfill = gdf_polyfill.s2.s22geo("s2")
gdf_polyfill.plot(edgecolor = "white")

DGGS Binning

import pandas as pd

resolution = 4
df = pd.read_csv('https://raw.githubusercontent.com/opengeoshub/vopendata/main/csv/dist1_pois.csv')
agg = 'count'
df_bin = df.a5.a5bin(resolution=resolution,
                    lat_col='lat',
                    lon_col='lon',
                    agg=agg,
                    # numeric_col=numeric_col,
                    # category_col= category_col,
                    )
df_bin.plot(
    column=f'{numeric_col}_{agg}',
    cmap='Spectral_r',
    legend=True,
    linewidth=0.2,
)

Further examples

For more examples, see the example notebooks.

Metadata

Release files for vgridpandas 1.0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vgridpandas 1.0.11
File Size Uploaded Provenance Actions
vgridpandas-1.0.11.tar.gz 2.9 MB Without provenance Details for vgridpandas-1.0.11.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vgridpandas 1.0.11
File Interpreter ABI Platform Actions
vgridpandas-1.0.11-py3-none-any.whl Python 3 none any Details for vgridpandas-1.0.11-py3-none-any.whl

Total release size: 3.0 MB

Release files / vgridpandas-1.0.11.tar.gz

Download URL vgridpandas-1.0.11.tar.gz
Size 2.9 MB
Tags Source
SHA-256 checksum
How to use checksums
1f696a8a70877cc0ff0a6e943439019eca9762d870a85cb7df50ae89e65b57bb
BLAKE2b-256 checksum
How to use checksums
ec6608132ded0de44882746816c6dec972af3d28f76d59b27c7d960401c562a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / vgridpandas-1.0.11-py3-none-any.whl

Download URL vgridpandas-1.0.11-py3-none-any.whl
Size 51.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
44cdbf2b86112ccd45667df89642358393a045b2dc56aa19e3692f7882e2e03e
BLAKE2b-256 checksum
How to use checksums
0b3ef16ab46fe05c8633d84edec8fc7f85d08a8a9ee5428989f23a7d04cebd3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for vgridpandas 1.0.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page