# Work with geography

Model / geo

geocode, spatial operations on geometry, grid cells, routing

Page: <https://meridian.online/operations/work-with-geography>

## Status

Runs as a SQL step.

arcform carries it as a `sql:` step today, with the `h3` extension.

## The DuckDB step

hexagonal cell for a point

It reads the `customers` table the proofs share. Create it first:

```sql
CREATE TABLE customers AS SELECT * FROM (VALUES
  ('Alice Ng',    'retail',    DATE '2025-06-01', 52.52, 13.40),
  ('Bob Okafor',  'wholesale', DATE '2025-09-15', 48.85,  2.35),
  ('Carla Diaz',  'retail',    DATE '2025-11-30', 40.42, -3.70),
  ('Frank Moore', 'retail',    DATE '2026-01-01', 51.51, -0.13)
) t(customer, segment, joined, lat, lon);
```

Then run the statement:

```sql
INSTALL h3 FROM community; LOAD h3;
CREATE TEMP TABLE result AS
SELECT customer, h3_latlng_to_cell_string(lat, lon, 5) AS cell, h3_get_resolution(h3_latlng_to_cell(lat, lon, 5)) AS resolution,
       h3_latlng_to_cell_string(lat + 0.0001, lon, 5) AS cell_nearby FROM customers;
SELECT * FROM result;
SELECT CASE WHEN ((SELECT count(DISTINCT cell) = 4 AND min(resolution) = 5 AND max(resolution) = 5 AND count(*) FILTER (WHERE cell = cell_nearby) = 4 FROM result)) THEN 'as expected' ELSE error('four cities did not fall in four cells at resolution 5, or a point ten metres away fell in another cell') END AS verdict;
```

It needs the `h3` extension.

## Variants

- [Draw an area around each shape](https://meridian.online/operations/work-with-geography/draw-an-area-around-each-shape): Grow or shrink each geometry by a distance or drive time to make a buffer or trade area.
- [Build geometry from coordinates](https://meridian.online/operations/work-with-geography/build-geometry-from-coordinates): Make a point, line or polygon column from X and Y values or from text or binary geometry.
- [Measure distance between places](https://meridian.online/operations/work-with-geography/measure-distance-between-places): Compute the distance between two points or geometries, planar, great-circle or by road.
- [Geocode addresses](https://meridian.online/operations/work-with-geography/geocode-addresses): Turn street addresses or postcodes into coordinates, or coordinates back into an address.
- Bin points into grid cells: Assign points to geohash or grid cells, or build a grid or density surface over an area.
- Spatial function libraries: Families of spatial functions and extensions that cover many of these tasks at once.
- [Locate IP addresses](https://meridian.online/operations/work-with-geography/locate-ip-addresses): Look up the country, city and coordinates of IP addresses in a geolocation database.
- [Measure area and length](https://meridian.online/operations/work-with-geography/measure-area-and-length): Compute the area, length or perimeter of each geometry.
- [Combine or cut shapes](https://meridian.online/operations/work-with-geography/combine-or-cut-shapes): Take the intersection, difference or union of geometries, or clip one layer by another.
- Read parts of a geometry: Extract coordinates, points, sub-geometries, bounding boxes, type or text and binary forms of a geometry.
- Test how shapes relate: Return true or false for whether two geometries intersect, contain, touch or lie within a distance of each other.
- Change or set the coordinate system: Reproject geometry into another coordinate reference system, assign one, or swap X and Y.
- Simplify, smooth or repair shapes: Reduce, round off or fix the vertices of a geometry without changing what it represents.

## What other tools call it

Meridian's classification; an independent blind rating agreed on 86.2% of 312 rows (exact class, version 2).

- Alteryx Designer: [`Buffer`](https://help.alteryx.com/current/en/designer/tools/spatial/buffer-tool.html) (read 2026-09-27)
- Alteryx Designer: [`Create Points`](https://help.alteryx.com/current/en/designer/tools/spatial/create-points-tool.html) (read 2026-09-27)
- Alteryx Designer: [`Distance`](https://help.alteryx.com/current/en/designer/tools/spatial/distance-tool.html) (read 2026-09-27)
- Alteryx Designer: [`Generalize`](https://help.alteryx.com/current/en/designer/tools/spatial/generalize-tool.html) (read 2026-09-27)
- Alteryx Designer: [`Heat Map`](https://help.alteryx.com/current/en/designer/tools/spatial/heat-map-tool.html) (read 2026-09-27)
- Alteryx Designer: [`Make Grid`](https://help.alteryx.com/current/en/designer/tools/spatial/make-grid-tool.html) (read 2026-09-27)
- Alteryx Designer: [`Non Overlap Drivetime`](https://help.alteryx.com/current/en/designer/tools/spatial/non-overlapping-drivetime-tool.html) (read 2026-09-27)
- Alteryx Designer: [`Poly-Build`](https://help.alteryx.com/current/en/designer/tools/spatial/poly-build-tool.html) (read 2026-09-27)
- Alteryx Designer: [`Poly-Split`](https://help.alteryx.com/current/en/designer/tools/spatial/poly-split-tool.html) (read 2026-09-27)
- Alteryx Designer: [`Reverse Geocoder`](https://help.alteryx.com/current/en/designer/tools/address/reverse-geocoder-tool.html) (read 2026-09-27)
- Alteryx Designer: [`Smooth`](https://help.alteryx.com/current/en/designer/tools/spatial/smooth-tool.html) (read 2026-09-27)
- Alteryx Designer: [`Spatial Info`](https://help.alteryx.com/current/en/designer/tools/spatial/spatial-info-tool.html) (read 2026-09-27)
- Alteryx Designer: [`Spatial Process`](https://help.alteryx.com/current/en/designer/tools/spatial/spatial-process-tool.html) (read 2026-09-27)
- Alteryx Designer: [`Street Geocoder`](https://help.alteryx.com/current/en/designer/tools/address/street-geocoder-tool.html) (read 2026-09-27)
- Alteryx Designer: [`Trade Area`](https://help.alteryx.com/current/en/designer/tools/spatial/trade-area-tool.html) (read 2026-09-27)
- Alteryx Designer: [`US Geocoder`](https://help.alteryx.com/current/en/designer/tools/address/us-geocoder-tool.html) (read 2026-09-27)
- Alteryx Designer: [`US ZIP9 Coder`](https://help.alteryx.com/current/en/designer/tools/address/us-zip9-coder-tool.html) (read 2026-09-27)
- Bruin: [`bruin.haversine_distance(lat1, lon1, lat2, lon2, unit='mi')`](https://getbruin.com/docs/bruin/assets/templating/macros.html) (read 2026-09-27)
- dbt-utils: [`haversine_distance`](https://raw.githubusercontent.com/dbt-labs/dbt-utils/main/README.md) (read 2026-09-27)
- DuckDB: [`Geometry Functions (family)`](https://duckdb.org/docs/current/sql/functions/geometry) (read 2026-09-27)
- Duckle: [`Clip Geometry`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/frontend/src/workflow-ui/palette-data.ts) (read 2026-09-25)
- Duckle: [`Create Geometry`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/frontend/src/workflow-ui/palette-data.ts) (read 2026-09-25)
- Duckle: [`Define Projection`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/frontend/src/workflow-ui/palette-data.ts) (read 2026-09-25)
- Duckle: [`Erase Geometry`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/frontend/src/workflow-ui/palette-data.ts) (read 2026-09-25)
- Duckle: [`Flip Coordinates`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/frontend/src/workflow-ui/palette-data.ts) (read 2026-09-25)
- Duckle: [`Repair Geometry`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/frontend/src/workflow-ui/palette-data.ts) (read 2026-09-25)
- Duckle: [`Reproject Geometry`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/frontend/src/workflow-ui/palette-data.ts) (read 2026-09-25)
- Duckle: [`Spatial Area`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/frontend/src/workflow-ui/palette-data.ts) (read 2026-09-25)
- Duckle: [`Spatial Buffer`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/website/docs/components.html) (read 2026-09-25)
- Duckle: [`Spatial Distance`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/website/docs/components.html) (read 2026-09-25)
- Duckle: [`Spatial Intersects`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/website/docs/components.html) (read 2026-09-25)
- Duckle: [`Spatial Length`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/frontend/src/workflow-ui/palette-data.ts) (read 2026-09-25)
- Duckle: [`Spatial Perimeter`](https://github.com/slothflowlabs/duckle/blob/f85f8960edfb6efbf4cb89d58a7b32e16df0e867/frontend/src/workflow-ui/palette-data.ts) (read 2026-09-25)
- Ibis: [`GeoArea`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoAsBinary`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoAsEWKB`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoAsEWKT`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoAsText`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoAzimuth`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoBuffer`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoCentroid`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoContains`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoContainsProperly`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoConvert`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoCoveredBy`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoCovers`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoCrosses`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoDFullyWithin`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoDWithin`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoDifference`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoDisjoint`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoDistance`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoEndPoint`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoEnvelope`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoEquals`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoFlipCoordinates`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoGeometryN`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoGeometryType`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoIntersection`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoIntersects`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoIsValid`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoLength`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoLineLocatePoint`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoLineMerge`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoLineSubstring`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoMaxDistance`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoNPoints`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoNRings`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoOrderingEquals`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoOverlaps`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoPerimeter`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoPoint`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoPointN`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoSRID`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoSetSRID`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoSimplify`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoStartPoint`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoTouches`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoTransform`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoUnaryUnion`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoUnion`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoWithin`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoX`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoXMax`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoXMin`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoY`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoYMax`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- Ibis: [`GeoYMin`](https://github.com/ibis-project/ibis/blob/05d2b293344e86cb41c1a426071734f7e270335a/ibis/expr/operations/geospatial.py) (read 2026-09-27)
- KNIME Analytics Platform: [`Google Earth Engine Extension for KNIME (extension)`](https://api.hub.knime.com/extensions/sdl.harvard.features.gee) (read 2026-09-27)
- KNIME Analytics Platform: [`KNIME Open Street Map Integration (extension)`](https://api.hub.knime.com/extensions/org.knime.features.ext.osm) (read 2026-09-27)
- Apache NiFi: [`GeoEnrichIP`](https://nifi.apache.org/components/org.apache.nifi.processors.GeoEnrichIP/) (read 2026-09-27)
- Apache NiFi: [`GeoEnrichIPRecord`](https://nifi.apache.org/components/org.apache.nifi.processors.GeoEnrichIPRecord/) (read 2026-09-27)
- Apache NiFi: [`GeohashRecord`](https://nifi.apache.org/components/org.apache.nifi.processors.geohash.GeohashRecord/) (read 2026-09-27)
- Pentaho Data Integration: [`MaxMind GeoIP Lookup`](https://docs.pentaho.com/pdia-data-integration/9.3-data-integration/pdi-transformation-steps-reference-overview) (read 2026-09-27)
- SQLMesh: [`@HAVERSINE_DISTANCE`](https://github.com/SQLMesh/sqlmesh/blob/23b237cea7218cc8f338b89c14f0957394a0003b/docs/concepts/macros/sqlmesh_macros.md) (read 2026-09-27)
- Tableau Prep: [`Spatial functions (group)`](https://help.tableau.com/current/prep/en-us/prep_spatial_calculations_and_joins.htm) (read 2026-09-27)
- Talend: [`tAddLocationFromIP`](https://help.qlik.com/talend/en-US/components/8.0/taddlocationfromip/taddlocationfromip-component) (read 2026-09-27)
- Talend: [`tGoogleAddressRow`](https://help.qlik.com/talend/en-US/components/8.0/google-address-standardization/google-address-standardization-component) (read 2026-09-27)
- Talend: [`tGoogleGeocoder`](https://help.qlik.com/talend/en-US/components/8.0/google-address-standardization/google-address-standardization-component) (read 2026-09-27)
- Talend: [`tGoogleMapLookup`](https://help.qlik.com/talend/en-US/components/8.0/google-address-standardization/google-address-standardization-component) (read 2026-09-27)
- VisiData: [`addcol-geocode`](https://github.com/saulpw/visidata/blob/7609212ec2febafa9caba7183cbebfaf49627909/plugins/geocoding.py#L42) (read 2026-09-23)
