A Web Map Service (WMS) 1.3.0 server hosted on Databricks Apps, serving Cloud Optimized GeoTIFFs (COGs) stored in Unity Catalog Volumes.
| Release | Status | Description |
|---|---|---|
| 1.0 | β Current | Local proxy architecture for OAuth bridging |
| 2.0 | π Planned | Direct QGIS-to-Databricks OAuth (no proxy) |
βββββββββββ βββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β QGIS β ββββ β Local Proxy β ββββ β Databricks App β ββββ β COGs in UC β
β ArcGIS β HTTP β (localhost) β OAuthβ (WMS Server) β API β Volumes β
βββββββββββ βββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β β β
β WMS Requests β + OAuth Token β Files API β
β (GetMap, etc) β Injection β with Bearer Token β
ββββββββββββββββββββ΄βββββββββββββββββββββββ΄βββββββββββββββββββββββββ
Databricks Apps enforces OAuth authentication at the gateway level for all external requests. This means:
- Direct PAT authentication won't work - Requests with PAT tokens get redirected to OAuth login
- OAuth tokens are required - The Databricks Apps gateway validates OAuth before requests reach the app
- Complex OAuth flow - Databricks OAuth requires specific configuration for external clients
For the initial release, a local proxy bridges the gap between QGIS and Databricks OAuth:
- User logs into Databricks via browser β gets OAuth token
- Local proxy stores the token in memory
- QGIS connects to local proxy (no auth needed)
- Proxy injects OAuth token and forwards to Databricks App
- Databricks App uses token to access COGs in UC Volumes (On-Behalf-Of)
- β Secure: OAuth tokens are short-lived and validated by Databricks
- β Per-user permissions: UC Volume access controlled by user's permissions
- β No stored credentials: No PATs in config files
- β Standard WMS: GIS clients work with standard WMS protocol
- β Audit trail: Databricks logs show who accessed what
- β Requires local proxy: Each user needs to run the proxy on their machine
- β Token expiration: OAuth tokens expire (~1 hour), requiring refresh
- β Not fully automated: Users must manually copy token from browser
- β Large files: Very large COGs (700MB+) may timeout for full-extent requests
QGIS supports OAuth authentication. The next release will enable direct QGIS-to-Databricks connection:
Planned improvements:
- π Configure QGIS OAuth to authenticate directly with Databricks
- π Eliminate the need for local proxy
- π Automatic token refresh within QGIS
- π Simplified user experience
| File | Description |
|---|---|
app.py |
FastAPI WMS server (runs on Databricks Apps) |
app.yaml |
Databricks App deployment configuration |
local_proxy.py |
Local proxy for QGIS OAuth bridging |
layers.json |
Layer configuration (auto-managed via admin UI) |
requirements.txt |
Python dependencies |
databricks apps create wms-serverdatabricks apps deploy wms-server --source-code-path /path/to/this/repoIn Databricks Workspace β Apps β Your App β Settings:
- Enable User Authorization
- This enables OAuth at the gateway level
Add scope: files.files
- This allows the app to access UC Volumes on behalf of users
Check app status:
databricks apps get wms-serverView logs:
databricks apps logs wms-serverpip install fastapi uvicorn requestspython local_proxy.pyThe proxy will:
- Start on
http://localhost:8080 - Open a browser for token setup
- Show status at the home page
- Visit
http://localhost:8080in your browser - Click the link to open Databricks App admin page
- Open browser DevTools (F12 or Cmd+Option+I)
- Go to Network tab β Refresh the page
- Click any request β Headers β find
x-forwarded-access-token - Copy the full token value
- Paste into the proxy web UI β Click "Set Token"
OAuth tokens expire after ~1 hour. To refresh:
- Clear browser cookies for Databricks
- Visit the admin page again (re-login)
- Copy new token from DevTools
- Update in proxy UI
- Local proxy running on
http://localhost:8080 - OAuth token set in proxy
- Layer β Add Layer β Add WMS/WMTS Layer
- Click New to create connection:
- Name:
Databricks WMS - URL:
http://localhost:8080/wms - Authentication: None (proxy handles it)
- Name:
- Expand Options:
- Tile size:
256(recommended for large layers)
- Tile size:
- Click OK
- Click Connect
- Select your layer(s)
- Click Add
- Zoom in first before adding large layers
- Set Tile size to 256 for better performance
- Use scale-dependent visibility to prevent full-extent requests
- Large COGs should have overviews/pyramids for best performance
The WMS server includes a web-based admin UI for managing layers:
- Start local proxy
- Visit
http://localhost:8080/admin - Add layers by specifying UC Volume paths
- Changes are saved to
layers.json
| Endpoint | Description |
|---|---|
GET /wms |
WMS endpoint (GetCapabilities, GetMap) |
GET /admin |
Layer management UI |
GET /admin/layers |
List layers (JSON) |
POST /admin/layers |
Add a layer |
POST /admin/layers/{name}/delete |
Delete a layer |
GET /layer-extent/{name} |
Get layer bounds |
GET /health |
Health check |
GET /debug |
Debug info |
Layers can be configured via:
- Admin UI (recommended) -
http://localhost:8080/admin - layers.json file - manually edit
{
"name": "my_layer",
"title": "My GeoTIFF Layer",
"path": "/Volumes/catalog/schema/volume/file.tif",
"crs": "EPSG:4326",
"bbox": [-180, -90, 180, 90],
"supported_crs": ["EPSG:4326", "EPSG:3857"],
"bands": [1, 2, 3]
}crsandbboxare auto-detected if not specifiedsupported_crsdefaults to native CRS + EPSG:4326 + EPSG:3857bandsdefaults to [1,2,3] for RGB or [1] for single-band
- β GetCapabilities
- β GetMap
- β GetFeatureInfo (not implemented)
- β PNG (with transparency)
- β JPEG
- β EPSG:4326 (WGS84)
- β EPSG:3857 (Web Mercator)
- β CRS:84 (WGS84 lon/lat order)
- β Native CRS of each layer
- β On-the-fly reprojection
- β Cloud Optimized GeoTIFFs (COGs)
- β Regular GeoTIFFs
- β Multi-band imagery
- β Single-band rasters
-
Use COGs with overviews:
gdaladdo -r average input.tif 2 4 8 16 32
-
Request smaller areas - Avoid full-extent requests
-
Use tile size 256 in QGIS connection settings
-
Zoom in before adding large layers
- Automatic overview level selection for zoomed-out views
- GDAL HTTP caching enabled
- HTTP/2 multiplexing for parallel requests
This is expected. Databricks Apps requires OAuth - use the local proxy.
Refresh your OAuth token (see "Token Refresh" section).
- Zoom into a smaller area
- Set tile size to 256 in QGIS
- Ensure COG has overviews
The server applies contrast stretching (2nd-98th percentile). If data still appears black:
- Check the layer's value range
- Try different bands
- Check proxy logs for actual tile requests
- Ensure project CRS matches layer CRS
- Try "Zoom to Layer Extent"
MIT License