> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kinetica.com/llms.txt
> Use this file to discover all available pages before exploring further.

# H3 Geohashing

> Copy-paste examples of H3 geohashing data with SQL

## Enrich a Point-Based Table with H3 Indexes

Create an H3 index for pickup locations in the NYC taxi data set.

<CodeGroup>
  ```sql Lat/Lon-Based Table theme={null}
  CREATE OR REPLACE TABLE example_geospatial.nyctaxi_h3 AS
  (
  	SELECT
  		pickup_latitude,
  		pickup_longitude,
  		H3_XYTOCELL(pickup_longitude, pickup_latitude, 8) AS h3_index
  	FROM example_geospatial.nyctaxi_xy
  )
  ```

  ```sql WKT-Based Table theme={null}
  CREATE OR REPLACE TABLE example_geospatial.nyctaxi_h3 AS
  (
  	SELECT
  		pickup_location,
  		H3_GEOMTOCELL(pickup_location, 8) AS h3_index
  	FROM example_geospatial.nyctaxi_wkt
  )
  ```
</CodeGroup>

## Create an Aggregated View with WKT Geometries

Use the table created above to generate an H3 grid view with the counts of
pickups within each cell.

```sql Aggregated Pick-Up Counts per H3 Cell theme={null}
SELECT
	h3_index,
	H3_CELLTOBOUNDARY(h3_index) AS h3_cell,
	COUNT(*) AS total_pickups
FROM example_geospatial.nyctaxi_h3
GROUP BY h3_index
```

The H3 grid output as a class break render:

<img src="https://mintcdn.com/kinetica/47teRgjGtbiLXAyb/content/snippets/geohash-h3/geohash-h3.png?fit=max&auto=format&n=47teRgjGtbiLXAyb&q=85&s=87c578955dfb2fcffd12c5e84bc79896" alt="geohash-h3.png" width="900" height="485" data-path="content/snippets/geohash-h3/geohash-h3.png" />
