Skip to content

Add example: Enter a 360° photosphere (#4428)#7942

Open
clement-igonet wants to merge 14 commits into
maplibre:mainfrom
clement-igonet:example/street-view-photosphere-4428
Open

Add example: Enter a 360° photosphere (#4428)#7942
clement-igonet wants to merge 14 commits into
maplibre:mainfrom
clement-igonet:example/street-view-photosphere-4428

Conversation

@clement-igonet

@clement-igonet clement-igonet commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Fixes #4428 with a documentation example: click a marker to "enter" a 360° photosphere at that location. A custom layer ray-casts each screen pixel into panorama UV space; entering animates a real fly-in with parallax (ray-sphere intersection until the eye reaches the center). Photo: Alexandre Duret-Lutz, CC BY-SA 2.0.

Launch Checklist

  • Confirm your changes do not include backports from Mapbox projects
  • Link to related issues
  • Include before/after visuals (gallery thumbnail)
  • Confirm you have read our AI policy

Assisted-By: Claude Sonnet 5 (claude-sonnet-5)

Prototypes street-view-style navigation for maplibre#4428: click a marker to
smoothly enter an immersive 360° photosphere at a fixed real-world point
(Pont de Bir-Hakeim, Paris), blended with the live map during the
transition, then exit back to normal navigation.

The panorama layer is deliberately shaped like a real style-spec layer
(https://maplibre.org/maplibre-style-spec/layers/) - a `type` and a `paint`
object of hyphenated properties - sketching what a native "panorama" layer
type could look like, while being implemented today as a
CustomLayerInterface (no core changes needed).

Panorama photo: "Paris s'éveille" by Alexandre Duret-Lutz, CC BY-SA 2.0,
resized/recompressed from the original for a lighter page load.
@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.38%. Comparing base (14dfbcf) to head (9c12057).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7942      +/-   ##
==========================================
- Coverage   93.39%   93.38%   -0.01%     
==========================================
  Files         290      290              
  Lines       24579    24579              
  Branches     6471     6471              
==========================================
- Hits        22955    22953       -2     
- Misses       1624     1626       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@clement-igonet
clement-igonet marked this pull request as ready for review July 14, 2026 22:45
…ontraction

Adds Duret, Hakeim, s'éveille/éveille (photo credit/place names),
equirectangular and Parameteri (real technical terms) to the cspell
word list, and rewords "doesn't" to "does not" to sidestep the same
contraction-splitting issue already whitelisted elsewhere (didn, hasn).
Rewords comments to avoid the rest; keeps only the WebGL API name
fragment (Parameteri) and the photo author's name (Duret, CC BY-SA
attribution). Source link now uses the numeric page id.

@CommanderStorm CommanderStorm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very buggy and too much code for me to debug.
Also does not work correctly, since the photosphere does never show:

Image

@CommanderStorm
CommanderStorm marked this pull request as draft July 19, 2026 11:03
@clement-igonet

Copy link
Copy Markdown
Contributor Author

Found two causes for the photosphere never showing and fixed both:

  1. The example used the openfreemap liberty style, which crashes the map in some environments (symbol placement errors), so the marker click never worked. The basemap is now plain OpenStreetMap raster tiles.
  2. The Map lacked centerClampedToGround: false, so the eye-height elevation passed during the enter/exit animations was re-clamped to the ground.

Verified end to end (marker click, panorama shown, drag to look around, exit) and regenerated the thumbnail.

Switch the basemap from the crash-prone liberty style to plain
OpenStreetMap raster tiles, add centerClampedToGround: false so the
eye-height elevation in the enter/exit animations really applies,
deduplicate the enter/exit transition into one animateTransition(),
drop the FOV keyboard controls, and regenerate the thumbnail.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@clement-igonet
clement-igonet force-pushed the example/street-view-photosphere-4428 branch from 96fc72a to 361f667 Compare July 19, 2026 16:46
@clement-igonet
clement-igonet marked this pull request as ready for review July 19, 2026 16:48
@CommanderStorm

Copy link
Copy Markdown
Member

So, I read over #4428 what you said is the problem and what you are now adding is a bit different.
In that isue, you asked for an simple way to add photospheres, so a plugin, but here you are adding an custom layer..

I think this should be a plugin and the example should show how to use said plugin.
This way, we can properly test it in the plugin and not have the issues here.
Examples should be relatively simple imo, otherwise it is very hard to understand.
At 500 lines, I think this is a bit too complex for an example.

Per review, the photosphere implementation moved to a plugin where it
can be tested properly; this example only shows plugin usage. 470 to
135 lines. The unpkg import resolves once the package is published.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@clement-igonet

Copy link
Copy Markdown
Contributor Author

Agreed, moved the implementation to a plugin: the Photosphere class (shaders, enter/exit transitions, look controls) now lives in a maplibre-gl-photosphere package with its own unit tests, and this example is down to 135 lines of plugin usage. Converting back to draft until the package is published on npm so the unpkg import in the example resolves.

@clement-igonet
clement-igonet marked this pull request as draft July 19, 2026 21:35
Comment thread test/examples/enter-a-360-photosphere.html
@clement-igonet
clement-igonet marked this pull request as ready for review July 20, 2026 21:04

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be in assets, but not inside the examples folder. this folder is kept for the examples "thumbnail" image.

@HarelM

HarelM commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

I think this looks fine now.
I've added a small comment regarding moving a file to a different place, otherwise looks good.

@CommanderStorm CommanderStorm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assuming Harels move is done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Street view camera

3 participants