OpenLayers integration
Pattern
- Stack a WebGPU
<canvas>above or below OpenLayers layers (CSSposition+ identicalwidth/heightin CSS pixels). - Listen to the map
postrenderevent (or equivalent frame hook). - From
ol/MapFrameState, build the same column-major map → clip matrix you would use for OL WebGL rendering. - Pass
frameState.time(orperformance.now()) into the renderer frame struct.
Reference implementation
The repository demo (examples/demo/main.ts) wires:
ol/Viewprojection, center, resolution, rotationframeStateToClipMatrix(fs, out)compatible with WebGPU clip conventionsWebGpuPointsRenderer+ optionalTextLayer+ declutter debug overlay
Run locally:
npm run demo:dev
Performance notes
- Keep per-frame work on the main thread to matrix upload, buffer patches, and draw submission.
- Prefer worker-side parsing for large GeoJSON so parsing does not block pan/zoom.
Coordinate spaces
Use canvas backing-store pixels (device pixels) for pick queries and viewport uniforms, not CSS pixels, unless you explicitly scale.