https://github.com/infra-plan/bim-tile-overlay

We manage infrastructure using BIM models in Autodesk Viewer. We needed to show aerial imagery and street maps underneath the 3D models, synced to the camera in real-time, so that we can give some context to the shown infrastructure.

The hard part: coordinate transforms. A Revit model's internal coordinates are in feet, rotated, translated, and offset from a local CRS projection, which itself needs to be converted from WGS84. The library ray-casts the camera frustum onto a ground plane, converts the hit points to lon/lat, determines which XYZ tiles to fetch, stitches them into a canvas, and maps the result onto a THREE.js plane, all updating on camera change. ~500 lines of JavaScript, MIT license, one peer dependency (proj4).

We would love to hear community feedback! The reason we decided to open-source is quite common: we couldn't find something similar to this that would not require a significant change to our workflow.

Hope others will find benefit from this library.