Skip to content

geohierarchy.maps.folium.h3_slow

H3J/H3T tile generation - SLOW, for backward compatibility only.

These formats are NOT recommended for new code. Use PMTiles with WKB geometry instead. H3J/H3T creates many files and doesn't scale well for large datasets.

Use fast_tiles.py (PMTiles) for all new development.

generate_h3j_from_h3_indices(pl_df, output_path, h3_index_col='h3_cell', property_cols=None, resolution=None, **kwargs)

Generate H3J file from Polars DataFrame with H3 indices.

H3J stores only the H3 indices and properties - NO geometry. Client-side rendering generates hexagon polygons from indices.

WARNING: This format is SLOW and doesn't scale well for large datasets. Use generate_pmtiles_from_geoparquet() with WKB geometry instead.

Parameters:

Name Type Description Default
pl_df

Polars DataFrame with H3 index column

required
output_path Union[str, Path]

Output .h3j file path

required
h3_index_col str

Name of the H3 index column

'h3_cell'
property_cols Optional[Sequence[str]]

Properties to include (default: all except h3_index_col)

None
resolution Optional[int]

H3 resolution (for metadata)

None
**kwargs Any

Additional metadata

{}

Returns:

Type Description
Path

Path to the generated .h3j file

Example

generate_h3j_from_h3_indices( pl_df, "h3_data.h3j", h3_index_col="h3_cell", property_cols=["population", "access_score"] )

generate_h3t_tiles_from_h3_indices(pl_df, output_dir, h3_index_col='h3_cell', property_cols=None, min_zoom=0, max_zoom=15, resolution=None, buffer_tiles=1)

Generate H3T tiled format from H3 indices using Polars.

H3T is the tiled version of H3J - each tile file contains only the H3 cells that intersect that tile.

WARNING: This format is SLOW and creates MANY files (doesn't scale well). Use generate_pmtiles_from_geoparquet() with WKB geometry instead.

Parameters:

Name Type Description Default
pl_df

Polars DataFrame with H3 index column

required
output_dir Union[str, Path]

Directory for {z}/{x}/{y}.h3t files

required
h3_index_col str

Name of the H3 index column

'h3_cell'
property_cols Optional[Sequence[str]]

Properties to include

None
min_zoom int

Minimum tile zoom

0
max_zoom int

Maximum tile zoom

15
resolution Optional[int]

H3 resolution

None
buffer_tiles int

Number of buffer tiles around each H3 cell

1

Returns:

Type Description
Path

Path to the output directory