Lattice Grid Buy a licence

blog

Lattice Grid 1.73: shapes in a column, and maps that ask the engine

Building…
Loading a live grid…

A table of sites, routes or regions never had anywhere to put the shape itself. A postcode area was a code, a delivery zone was a name, and finding “what falls inside this box” meant pulling every row into the browser and testing each one by hand. This release gives a column somewhere to put the shape, and gives the engine underneath the grid the job of answering with it.

A column can hold a shape

Import the geometry module and a column reads type: 'geometry'. Give it a point, a line or a polygon, in WKT, WKB or GeoJSON, and the cell reads back as a plain sentence: “Point 51.5074°N 0.1278°W”, “Polygon, 14 vertices, 2.31 km²”. Sort it and it orders by location. Filter it and four new operators are on offer alongside the ones every column already has: within a box, within a polygon, intersecting another shape, or within a distance of a point.

grid.filters.set({ col: 'site', op: 'withinBbox', value: [-4, 50, 2, 56] });

GeoParquet, read straight into DuckDB in the browser

Point the DuckDB adapter at a GeoParquet file with spatial: true and every one of those four filters runs inside DuckDB rather than in the browser. A box drawn on a map, a polygon traced around a territory, a radius around a point: DuckDB’s own spatial extension answers it, over a file that never leaves your bucket and a browser that never has to load more than the page in front of the reader.

A choropleth, filled straight from the column

Give a choropleth chart a geometry column and it draws each row’s own boundary, filled by a measure, with no separate map file to load and join by code. A point on the same column draws as a marker, so one dataset can mix named sites and shaded territories on the one map.

The map’s own pan and zoom, now a filter

Turn on viewportFilter and panning or zooming a map writes one condition back onto the grid it reads from: whatever is on screen is what the grid, and every other chart or tile reading the same grid, now shows. Set a matching filter from somewhere else, a saved view, a sibling panel, and the map pans to match it instead of fighting it.

Maps and tiles that ask the engine, not the page

A map or a KPI tile beside a grid holding one page of a much larger relation used to describe that page: the total in view, not the true total. Both now ask the engine for the whole matching set, over any pushdown source, and say so. A sum tile reads engine; a map’s own reading reports how many rows it drew against how many actually matched. Panning a live map over ten thousand sites, or narrowing a tile over a hundred-thousand-row Parquet file, now answers with the real figure rather than the fraction that happened to have loaded.

See it running

A value filled straight into each country’s own boundary, panning a map to narrow the grid beside it, and a spatial filter pushed into DuckDB from a GeoParquet file are all running on this site. The geospatial guide covers the column type, the operators and the map options in full.

The full list is in the changelog.

Read next

All posts RSS