Inspiration
Movies. In films, a character touches an old place and suddenly sees it as it was years ago. I wanted that feeling for real streets: stand on a street today, then look at the same spot in an earlier year.
What it does
Street View Time Machine is a headset app (Meta Quest, in the browser) that shows the past of a street in 3D.
- A flat map lies on a table in front of you.
- You pick a place and dive into a full 360° view of that street.
- A round glass "lens" appears on your hand. Through it you see the same street in an earlier year.
- You turn a dial on your wrist to change the year, then push through the lens to go there.
It also works on a normal computer: drag to look around, and the lens follows the mouse.
How I built it
- Imagery: Mapillary gives us free 360° street photos with the date each one was taken. For "the same spot in other years" I search a small circle (50 m) around a point and group the photos by year.
- Map: MapLibre with OpenFreeMap tiles, drawn into a canvas that I use as a texture on the table.
- XR: IWSDK (Meta's WebXR toolkit) with TypeScript and Three.js. It runs in the browser, so there is nothing to install.
- Testing without a headset: I tested with the IWER emulator in the browser, including emulated hands, gaze, and the Meta VR Glasses view.
Challenges
No headset. I could not test on a real Quest. I built a test loop with the emulator and kept a list of everything that is still unproven on a real device .
Memory. A 360° photo is huge (7680×3840 pixels).
Tap or drag
What new I learned
- Free, open data (Mapillary, OpenStreetMap, OpenFreeMap) is enough to build something that feels magical.
- devlopment for vr
The math behind it
1. Photo to sphere. A 360° photo is a flat rectangle. For a look direction (dx, dy, dz), the pixel shown is:
$$\alpha = \mathrm{atan2}(d_x, -d_z)$$
$$u = \frac{1}{2} + \frac{\alpha - \psi}{2\pi}$$
$$v = \frac{1}{2} - \frac{\arcsin(d_y)}{\pi}$$
α is the compass angle you look toward, ψ is the photo's compass heading, and (u, v) is the position in the image.
2. Same spot, other years. Distance between two GPS points (haversine). φ = latitude, λ = longitude, R = 6371 km. I keep a photo only if d ≤ 50 m.
$$h = \sin^2\left(\frac{\Delta\varphi}{2}\right) + \cos\varphi_1 \cos\varphi_2 \sin^2\left(\frac{\Delta\lambda}{2}\right)$$
$$d = 2R \arcsin\left(\sqrt{h}\right)$$
3. Lining up two years. Each photo uses its own heading ψ in formula 1, so a building stays in the same place through the lens, even if the two cameras faced different ways.
4. Map projection. Latitude and longitude become map pixels at zoom z (Web Mercator):
$$W = 512 \times 2^{z}$$
$$x = \frac{\lambda + 180}{360} \times W$$
$$y = \left(\frac{1}{2} - \frac{\ln\left(\tan\left(\frac{\pi}{4} + \frac{\varphi}{2}\right)\right)}{2\pi}\right) \times W$$
Each zoom doubles W, so more tiles are needed. That is why the 50,000 tiles/day limit matters.
5. Tap or drag? A hand shakes a little. If the hand moves less than 17 mm between press and release, it is a tap (pick the street). Otherwise it is a drag (move the map).
$$\lVert p_{release} - p_{press} \rVert < 17$$
Credits
Imagery © Mapillary and its contributors. Map data © OpenStreetMap contributors.
Built With
- html5
- iwsdk
- javascript
- mapillary
- maplibre-gl
- meta-quest
- openfreemap
- openstreetmap
- three.js
- typescript
- vite
- vitest
- webgl
- webxr