mapbox / mapbox-gl-js

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL
https://docs.mapbox.com/mapbox-gl-js/
Other
11.06k stars 2.21k forks source link

set light direction from datetime and map location #12860

Open andrewharvey opened 1 year ago

andrewharvey commented 1 year ago

mapbox-gl-js version: 3.0.0-beta.1

Question

Are there plans to integrate suncalc or equivalent into the library so a directional light may be set based on datetime (and have location determined from the map view) along side the existing option based on azimuthal angle and polar angle?

Or will this always be left to the user, or possibility a 3rd party control?

mourner commented 1 year ago

Currently it's up to the user, but maybe we should indeed provide an easy API for this. The actual code for getting sun position from lng/lat/date is quite short, I "golfed" it some time ago here: https://observablehq.com/@mourner/sun-position-in-900-bytes