Helios — Distributed Tiling to PMTiles
A four-notebook series that takes one San Francisco bounding box and turns it into self-contained PMTiles archives, one per data modality. It then shows how to shard a layer into a multi-archive mosaic for web-scale delivery. The series uses GeoBrix on Databricks.
The notebooks follow a solar site-selection narrative. First, they identify candidate rooftops (vector, NB01) and overlay an aerial basemap for visual validation (raster, NB02). Then they layer terrain-derived slope, aspect, and hillshade to score each candidate by sun exposure (elevation, NB03). A final notebook re-publishes the vector layer as a distributed, sharded PMTiles mosaic — many archives plus a catalog and manifest — for web-scale delivery (NB04). The single-archive outputs feed a single plot_pmtiles / plot_cog viewer, giving a single-browser-tab deliverable with no tile server.
This series is an on-ramp to Databricks-native spatial. NB01 uses the built-in st_area / st_centroid and h3_longlatash3 functions directly on the WKB column for roof metrics and H3 density. NB03 bins slope and aspect into H3 cells via gbx_rst_h3_rastertogridavg. It joins them with native Databricks SQL to produce a solar_score. No format conversion is required at any step.
examples/notebooks/helios — download the folder and import config_nb.ipynb and the four numbered notebooks into your Databricks workspace to run.
The series uses the rasterx and vectorx Python API plus the geobrix[stac,vizx] env6 wheel (with the Overture CLI as a separate step), installed by config_nb. It runs on Serverless with no JAR. Visualization helpers come from databricks.labs.gbx.vizx. The same code runs on a dedicated cluster. Add the GeoBrix JAR beside the env wheel as a cluster library, or use the GeoBrix DCS image. See Choose an install path. Spark-conf tuning is routed through a set_conf_safe() helper that no-ops on Serverless (where runtime config mutation is disallowed) and applies on classic clusters. See Surfaces & Levels.
plot_pmtiles (from gbx.vizx) renders a .pmtiles archive directly in the notebook by embedding the archive as base64 in a self-contained MapLibre GL JS page (FileSource). In a Databricks notebook, an archive over ~4–5 MB falls back to a static thumbnail. The cell-output cap and displayHTML's ~2–3× inflation set this limit. plot_cog renders a Cloud-Optimized GeoTIFF over a contextily basemap as a static matplotlib figure. See the PMTiles function reference for the archive aggregator and writer.
The notebooks ship with INTERACTIVE_PLOTS = False so the committed .ipynb renders fast, GitHub-compatible static maps. Set INTERACTIVE_PLOTS = True in config_nb or in a cell right after %run ./config_nb for interactive MapLibre multi-layer maps.
Notebooks at a glance
01 — Vector Engine (MVT)

- Distributed MVT encoding —
gbx_st_asmvt+gbx_st_asmvt_pyramidfans out tile generation across the cluster in parallel, producing a full zoom-range MVT pyramid without driver-side loops or single-node bottlenecks. - Databricks-native spatial composition — built-in
st_area/st_centroidcompute per-building roof area and centroid directly on the WKB column;h3_longlatash3bins centroids into H3 cells for roof-density scoring. These native functions compose cleanly with GeoBrix MVT encoding — no format conversion required. - Single-archive delivery —
gbx_pmtiles_aggmerges the distributed tile output into onesf_buildings.pmtilesarchive on the Volume;plot_pmtiles(fromgbx.vizx) renders it inline.
02 — Visual Basemap (XYZ)

- Distributed Web Mercator reprojection —
gbx_rst_to_webmercatorreprojects each NAIP scene across the cluster to the standard slippy-map CRS. It scales linearly with tile count rather than running serially on the driver. - Full-resolution XYZ pyramid —
gbx_rst_xyzpyramidgenerates all zoom levels in a single distributed pass, matching the zoom range of the vector layer in NB01. - Raster PMTiles —
gbx_pmtiles_aggwrites the XYZ tile set intosf_naip.pmtiles;plot_pmtilesrenders it inline. WithINTERACTIVE_PLOTS = True,plot_interactivelayers the aerial basemap under the NB01 building footprints in a single MapLibre map (buildings layer degrades gracefully if NB01 has not run).
03 — Analytical Core (COG + STAC)

DemDownloader→ COG + STAC Delta catalog — thegbx.sampleDemDownloaderstages a 3DEP DEM (windowed to the AOI). Thengbx_rst_cog_convertconverts it to a Cloud-Optimized GeoTIFF in a distributed pass. The notebook writes the resulting COG paths to a managed STAC Delta table for incremental updates and downstream notebook access.- Terrain analytics at scale —
gbx_rst_slope,gbx_rst_aspect, andgbx_rst_hillshadederive terrain layers in parallel across all DEM tiles;gbx_rst_xyzpyramid+gbx_pmtiles_aggpackage the hillshade intosf_hillshade.pmtiles. WithINTERACTIVE_PLOTS = True,plot_interactivelayers the hillshade and the NB01 building footprints as PMTiles and the H3solar_scoreas a grid layer — all in one MapLibre map. - Databricks-native solar scoring —
gbx_rst_h3_rastertogridavgbins slope and aspect rasters into H3 cells. Native Databricks SQL expressions join and score the resulting per-cell values to produce asolar_scorecolumn. Theh3_centeraswkbfunction reconstructs geometry for map rendering. All of this happens without leaving the warehouse.
04 — Distributed Sharding & Mosaic

- Spatial sharding into parallel work units — the notebook assigns each pyramid tile to a coarse parent tile (z11) via
shiftright(x, z-11). ThengroupBy(shard).agg(gbx_pmtiles_agg(...))fans archive packing out across the cluster, with one.pmtilesper shard instead of one monolithic file. The SF AOI spans four z11 parent tiles. Only the three containing buildings produce an archive (the SW tile is open water). Shards form only where there is data. - Shard catalog + mosaic manifest — a
sf_building_shardsDelta table maps each shard key to its archive path and bounds (pmtiles_info). Amosaic.jsonmanifest lets a client discover and assemble the shards with no tile server. - Web-scale delivery pattern — buffering the source query while keeping output tiles non-overlapping across shards keeps boundaries clean. It also avoids double-rendering. The mosaic pattern scales a single AOI into the per-file size range that object stores and CDNs serve efficiently.
Files
| File | Purpose |
|---|---|
config_nb.ipynb | Shared setup (%run ./config_nb from every main notebook). Installs the geobrix[stac,vizx] env6 wheel (with the Overture CLI as a separate step), registers the functions and the readers and writers with gbx.register(spark), imports visualization helpers (plot_pmtiles, plot_cog, pmtiles_info), sets catalog_name / schema_name, creates the /Volumes/<cat>/<schema>/data/helios ETL tree, instantiates OvertureClient, and exposes FORCE_REBUILD and INTERACTIVE_PLOTS toggles. |
01. Vector Engine (MVT).ipynb | Loads SF building footprints via OvertureClient, computes roof area and H3 roof density with Databricks built-in ST/H3 functions, encodes MVT tiles with gbx_st_asmvt + gbx_st_asmvt_pyramid, and packages the result into sf_buildings.pmtiles with gbx_pmtiles_agg. |
02. Visual Basemap (XYZ).ipynb | Downloads NAIP aerial imagery for the SF AOI via NaipDownloader, reprojects to Web Mercator with gbx_rst_to_webmercator, generates an XYZ tile pyramid with gbx_rst_xyzpyramid, and writes sf_naip.pmtiles with gbx_pmtiles_agg. |
03. Analytical Core (COG + STAC).ipynb | Downloads a 3DEP DEM via DemDownloader, converts it to a COG with gbx_rst_cog_convert, builds a STAC Delta catalog, derives slope/aspect/hillshade, packages sf_hillshade.pmtiles, and computes a per-H3-cell solar_score with gbx_rst_h3_rastertogridavg + native Databricks SQL. |
04. Distributed Sharding & Mosaic.ipynb | Re-publishes the SF buildings vector layer as a multi-archive PMTiles mosaic: assigns each pyramid tile to a coarse parent shard (z11), packs one .pmtiles per shard with groupBy(shard).agg(gbx_pmtiles_agg), and writes a sf_building_shards Delta catalog + mosaic.json manifest (bounds via pmtiles_info) for client-side mosaic assembly. |
Prerequisites
- Databricks Runtime 17.3 LTS / 18 LTS, or Serverless (Scala 2.13 / Spark 4 / Python 3.12). The default runs at the Python level on Serverless (set Environment to version 6). The JVM level needs a dedicated cluster. Install the env wheel and the GeoBrix JAR as cluster libraries, or use the GeoBrix DCS image on DBR 19.
- GeoBrix 0.6.0.
config_nb.ipynb%pip-installsgeobrix[stac,vizx](the env6 wheel, with the Overture CLI as a separate step) from the v0.6.0 GitHub release (other installs: Installation). To use the JVM engine too, run on a dedicated cluster with the JAR installed (see Choose an install path). - Unity Catalog. Edit
config_nb.ipynbto setcatalog_nameandschema_name. A Volume nameddatamust already exist under<catalog>/<schema>— the notebooks create sub-directories inside it but will not create the Volume itself. - Network access. NB01 reads Overture Maps via
OvertureClient; NB02 fetches NAIP viaNaipDownloaderand NB03 fetches 3DEP viaDemDownloader, both from Planetary Computer STAC (online-only — no offline fallback). Classic cluster outbound internet is sufficient; Serverless has it by default.
Run order
- Open
config_nb.ipynb, setcatalog_name/schema_name, and verify the Volume exists. - Run notebooks in numeric order: 01 → 02 → 03 → 04. Each notebook starts with
%run ./config_nbso the shared state is re-established every time. NB04 reuses the building footprints from NB01, so run NB01 first (ifoverture_buildings_metais absent, NB04 re-fetches them from Overture).
Each notebook is safe to re-run — outputs are written with skip-guards so already-built files are not re-downloaded or re-tiled. Set FORCE_REBUILD = True in a cell right after %run ./config_nb to force a full rebuild of that notebook's outputs.
Data flow
San Francisco AOI (one bbox, reused across the series)
│
┌─────┴───────────────┬─────────────────────────────┐
▼ ▼ ▼
Overture buildings NAIP aerial (helper) USGS 3DEP DEM (helper)
(OvertureClient) │ │
│ ▼ gbx_rst_to_webmercator ▼ gbx_rst_cog_convert
▼ gbx_st_asmvt │ │ → COGs + STAC Delta
+ st_asmvt_pyramid ▼ gbx_rst_xyzpyramid ▼ slope/aspect/hillshade
│ │ ▼ gbx_rst_xyzpyramid
▼ gbx_pmtiles_agg ▼ gbx_pmtiles_agg ▼ gbx_pmtiles_agg
sf_buildings.pmtiles sf_naip.pmtiles sf_hillshade.pmtiles
│ │ │
└─────────────────────┴──────────────┬──────────────┘
▼
plot_pmtiles / plot_cog (inline)
→ solar site-selection view
Key GeoBrix / Databricks functions shown
- GeoBrix VectorX (
vectorx/ SQL):gbx_st_asmvt,gbx_st_asmvt_pyramid— distributed MVT tile generation and pyramid fan-out. - GeoBrix RasterX (
rasterx/ SQL):gbx_rst_to_webmercator,gbx_rst_xyzpyramid,gbx_rst_cog_convert,gbx_rst_slope,gbx_rst_aspect,gbx_rst_hillshade,gbx_rst_h3_rastertogridavg. - GeoBrix PMTiles (
rasterx/vectorx/ SQL):gbx_pmtiles_agg— aggregate tile bytes into a single archive. Group asgroupBy(shard).agg(gbx_pmtiles_agg)for a sharded multi-archive mosaic (NB04);pmtiles_info— per-archive bounds for the shard catalog; PMTiles Writer (.write.format("pmtiles_gbx")) — for larger pyramids. - GeoBrix sample downloaders (the
stacextra;overturemapsis a separate install):OvertureClient.discover/download/read(building footprints, NB01);NaipDownloader(NAIP, NB02) andDemDownloader(3DEP, NB03), both wrappingStacClient(distributed STAC search / download / repair). - GeoBrix VizX:
plot_pmtiles,plot_cog,pmtiles_info— inline PMTiles / COG rendering without a tile server. - Databricks built-in ST / H3 (on-ramp to native):
st_area,st_centroid(roof metrics, NB01);h3_longlatash3(roof density, NB01);h3_centeraswkb(H3 solar-score geometry, NB03).
Gotchas
- PMTiles is driver-side only.
gbx_pmtiles_aggproduces the archive via a distributed reduce but the final file lands on the driver Volume path — it cannot be read back viaspark.read. Usepmtiles_info/plot_pmtilesfor inspection. plot_pmtilesbase64 size guard. The notebook cell-output cap bounds the inline embed (~10 MB default, 20 MB max).displayHTMLinflates the payload ~2–3×. An archive over ~4–5 MB therefore falls back to a static thumbnail. Scope the AOI/zoom range, useinteractive_fit="downzoom", or stream from anhttps://URL if the archive exceeds the ceiling.- Overture cloud-path vs. HTTP-href.
OvertureClientfirst tries a direct cloud-storage path; if that is not reachable from the cluster network it falls back to an HTTP href. Classic clusters with S3 VPC endpoints reach the cloud path; Serverless always reaches the HTTP href. - NAIP and 3DEP network reachability. Both sources require outbound internet access via Planetary Computer and have no offline fallback — NB02 (
NaipDownloader) and NB03 (DemDownloader) skip or error if the endpoint is unreachable. - Repartition by column on Serverless. A number-only
repartition(N)is AQE-coalesced on Serverless. Always repartition by a data column (e.g.,repartition(N, "tile_x")) before distributed UDF calls. - Wheel install is one line.
config_nbinstallsgeobrix[stac,vizx](the env6 wheel, with the Overture CLI as a separate step) from the v0.6.0 GitHub release. Without the extras, the STAC and plotting imports fail withModuleNotFoundError. For a staged Volume wheel, see Installation.