Apartment listings say "bright" and "south facing". They almost never say the tower across the street takes the sun at 3 pm in winter. Sun path charts show where the sun is but don't know what stands between you and it. So I built Shadecast, a free map that answers the question for one street, terrace or balcony.
What it does
You open the page, pick a city and drag the clock. Shadows move over 3D buildings and terrain. Click a spot and you get the hours of direct sun on that date, the time intervals, and a bar for every day of the year. A sun hours view colors the whole 1.4 km square for a day, a month or a year. The address holds place, date, time and mode, so a link shares exactly what you see.
How it works
Solar position is a TypeScript port of the NREL SPA. Its tables are generated from pvlib, and the test suite compares 320 reference cases within 0.005 degrees.
Buildings come from OpenFreeMap vector tiles and ground height from Terrarium tiles. Both are rasterized into one height field around the map centre. A fragment shader marches a ray from every cell toward the sun in half cell steps. If the surface rises above the ray, the cell is in shade. Sun hours add up one pass per sun position into a 16 bit counter texture.
The same rule exists as plain TypeScript in src/engine/shadow.ts. A browser test runs both on a synthetic city for eight sun positions, and none of the 524,288 compared cells differ.
What is rough
- Trees are not modeled, so a street shaded by a tree all summer reads as sunny.
- Many OpenStreetMap buildings have no height tag. They arrive as 5 m.
- Shadows stop at 512 cells, about 700 m at the default grid.
- Resolution changes the answer. A corner near Taipei 101 reads 1.5 h on 21 December at 1.4 m cells and 3.0 h at 2.7 m cells.
- I only tested Chrome.
Try it
Live demo: https://arthur031221.github.io/Shadecast/
Code and docs: https://github.com/Arthur031221/Shadecast
The interface comes in nine languages and the translations are plain JSON files. If you know the real sun at a spot, I'd like to hear how far off the numbers are.
