Skip to main content
100%

Utility functions for converting from a row/column index of a raster window, to longitude/latitude or an H3 index. Useful for H3-indexing raster data read with rasterio.

✓ Published0🌍 Public
Aalpha-beta-soup
Last edited Apr 30, 2021
Created on Apr 30, 2021

This example demonstrates utility functions that convert row and column indices from a raster window into geographic coordinates or H3 hexagonal indices. It shows how raster data read with rasterio can be efficiently mapped to H3 cells for spatial analysis. The code defines two lambda functions: one that uses the window's affine transformation and a pyproj.Transformer to convert cell positions to longitude and latitude, and another that calls the h3.api.basic_int library's geo_to_h3 function to derive the corresponding H3 index at a specified resolution. The approach relies on rasterio's window transform and pyproj’s coordinate transformation APIs.

AI-generated description

Similar vizzes