Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

ClickHouse 29 min read Deep dive mediumAdept

State of Geospatial in ClickHouse in March 2026

ClickHouse's geospatial support has grown from early distance functions to over 90 functions, grid indexes (geohash, H3, S2), and geometry types (Point, Ring, LineString, MultiLineString, Polygon, MultiPolygon) implemented as aliases over Tuple and Array. The new Geometry type (v25.11) is a Variant that holds mixed geometries in one column, and WKT/WKB import and export enable interchange with PostGIS and GeoParquet. Direct parsing of mixed-geometry GeoParquet arrives in 26.3, and a readWKB workaround covers earlier versions. A recurring pitfall is coordinate order: functions expect (longitude, latitude), and flipCoordinates fixes data supplied as lat/lon.

Assumes: SQL basicsWKT/WKB geometry formatsClickHouse basics

Related posts

  • ClickHouse Release 25.5

    ClickHouse mediumAdept

    ClickHouse 25.5 ships 15 new features, 23 performance optimizations and 64 bug fixes. The headline change is the HNSW vector similarity index moving from experimental to beta, with pre- and post-filtering for hybrid search. Other additions include Hive metastore catalog support for querying Iceberg tables, an implicit `table` in clickhouse-local so SELECT/FROM can be omitted for stdin input, an `introduced_in` field in system.functions, and correct parsing of Geo types from Parquet. Each feature comes with a runnable SQL example.

  • pg_clickhouse & chdb updates: Encoding, nesting, and types

    ClickHouse mediumAdept

    pg_clickhouse v0.11.0 and the chdb extension v0.1.2 improve Postgres–ClickHouse type compatibility. A new `check_encoding` option (fail, remove, replace, truncate) handles invalidly encoded text, and ClickHouse Interval types now import as Postgres `interval` with pushdown of expressions like `start_at + duration`. Parameterized JSON columns map to jsonb so `ORDER BY` on a property pushes down correctly, and unflattened Nested columns map to 2-D text arrays or to matching composite-type arrays. The release also adds mappings for large integers, geo and time types, pushes down the sha*/digest functions, removes `clickhouse_raw_query()` and drops PostgreSQL 13 support.

  • ClickHouse Newsletter July 2022: Geo queries for railway enthusiasts

    ClickHouse mediumAdept

    ClickHouse's July 2022 newsletter lists upcoming meetups in London, Silicon Valley and Munich plus the v22.7 release webinar, and recaps the 22.6 release: ARM performance work and stack traces, non-constant patterns for LIKE and MATCH, parameters for external UDFs, showCertificate(), and writes to system.zookeeper. Its query of the month loads the England and Wales public transport stops CSV, reduces it to one row per London Underground station, sorts by Lat*Lon, and uses lagInFrame window functions with geoDistance to find adjacent stations. The closest pair turns out to be two entries for the same Heathrow station 4 meters apart, followed by Queensway and Bayswater. A reading list links to user stories and integrations.

  • Visualizing Foursquare places with ClickHouse

    ClickHouse mediumAdept

    The Foursquare open places dataset (about 100 million records) loads straight from S3 Parquet into ClickHouse in 42 seconds and 11 GB. The table stores Web Mercator coordinates as materialized UInt32 columns, is ordered by a Morton (Z-order) space-filling curve, and has minmax indices so map tiles can be queried fast. The existing adsb.exposed air-traffic visualizer was reused with a 48-line change to render pixel-level tiles in the browser. Compared with Foursquare Studio's H3 hexagons, Kepler.gl and DuckDB-based maps, it gives higher resolution and smoother interactivity, but does not correct point density for latitude.

  • pg_clickhouse 0.11.1: Now with pgvector, UPDATE, DELETE pushdown

    ClickHouse mediumAdept

    pg_clickhouse 0.11.1 maps pgvector's vector type to ClickHouse Array(Float32/Float64) columns. It pushes pgvector distance operators down to ClickHouse functions such as L2Distance and cosineDistance, and reports in EXPLAIN whether a ClickHouse vector_similarity HNSW index applies. It also pushes UPDATE and DELETE down as ClickHouse lightweight updates and deletes on MergeTree tables, along with TRUNCATE; lightweight updates need block number/offset settings enabled and suit changes to under about 10% of a table. Other changes include regr_* aggregate pushdown, OrNull aggregates that match Postgres NULL semantics, JSONB subscript pushdown, session timezone alignment, and Decimal(76,38) for unconstrained numeric.

The quest for software engineering knowledge.

Look:
Layout: