220 comments

[ 3.9 ms ] story [ 268 ms ] thread
Congratulations! The idea and execution made me smile.

This must be an epitome of a hobby project!

This would work for trains as well right? Overground trains i mean
It seems they route along roads between bus stops, so you won't get train routes that follow the tracks. But in principle the solution should be very similar.
I need this for flights, not for the sun, but I somehow always have fomo when having to choose between left and right side of the plane on the seat selection screen
It would have to predict the model numbers of the planes though: some newer ones I have been to (A350s) seem to have automagic dimming windows. Getting on flights with such windows is better even if you have to sit in the sun!
Boeings 787 also have this. There isn't even a lid to close/open the window. And in some situations you can't "undim" it. Kind of annoying when it's midnight and you want to take a look at the moon and stars.
You can usually predict the plane quite well if you know the airline and their fleet and they show you the exact seating plan.
I hate those windows, when fully dimmed they let through a lot of blue light, and blue light is bad for sleep.

On the other hand though I detest window seat passengers who insist on having the windows closed for take-off and landing. I'd like to know when to expect a thud, thanks. The electric shades are nice in that aspect because they are never fully opaque.

Don’t you have to have the blinds up for take off and landing? You definitely do in Europe.
I don't know, it would make sense for the US FAA to require that but I don't have the authority to ask that of the window seat passenger, and most flight attendants don't care.

They're more concerned that my seat back is not pushed back by the 3mm that they move.

They are equally strict about the window blinds in Europe.

I don't travel enough on other airlines to make generalisations.

I have a beta version for flight at https://dev.sitinshade.com/flight

Search based on the destination and departure airport. Please note that it is still in beta, so there may be some issues.

Currently, manual entry of flight duration is required.

Working on flight duration estimation, scenic side, and movie recommendations based on flight duration : - )

This is amazing! My kids get sick on train rides and I think a lot has to do with the sun strobing through the trees. I’ll try this next time to at least not be on the sunny side.
Strobing lights can trigger migraines, which can cause nausea.
More and more, I really appreciate great efforts that make a small but meaningful improvement in some under-noticed aspect of living. It seems zen-like.

Bravo. :) What a great project and execution!

I recently took a bus over the Andes and was congratulating myself on choosing a seat on the shady side. Then I realized that in the southern hemisphere the sun is in the north and I had outsmarted myself.
Yes. There are is mnemonic phrase in german to tell where the sun is in morning/noon/evening which contains "sun is never seen in the north" - which just not work on the southern hemisphere.
Interesting because the sun rises and sets from the north (NE, NW) during the summer in the northern hemisphere. The effect is more pronounced the farther north of the equator you are and Germany is quite far north.
> Then I realized that in the southern hemisphere the sun is in the north

That's not exactly true.

South of the tropic of capricorn, the sun is in the north at noon.

Between the equator and the tropic of capricorn the sun could be slightly towards the north or south or directly overhead at noon depending on the season.

As for sunrise and sunset the sun could be just about anywhere if you go south enough and the season is right.

At the south pole in summer, the sun just runs 360 degrees around, floating slightly above the horizon, and daylight is 24 hours long. If you are standing 1km from the south pole, you will see the sun in the south direction at midnight and in the north direction at noon.

And if you go just further from the south pole, e.g. to Patagonia in summer (i.e. now) the sun rises and sets close to the south and goes around to the north at mid-day. Daylight is close to 20 hours long. It's similar to the south pole situation except when the sun gets close to exact south it dips below the horizon for a few hours and you have a short-lived few hours of darkness. But you do see the sun in the southeast at sunrise and southwest at sunset.

Yep, my bedroom has windows to the south and east, which means here in New Zealand I should not expect any afternoon & evening sun that room. However, currently in summer when the sun is close to setting I get a few minutes of evening sun through the southern window, due to sun setting slightly southwest.
When I travelled to Brazil, I was confused as the North Star (Polaris) had disappeared.
It is funny in my language as we have the same word for both noon and south.
Is it French (midi)?
South in French is sud, while noon is indeed midi. However, the two words are the same in Latin (meridies, lit. midday, as in p.m. = post meridiem, etc.), so probably in some of the other Romance languages they do match?
The south of France is known colloquially as "Le Midi".
I imagine he's talking about południe in Polish.
Also in Italian. "Mezzogiorno" both means noon and south.
Nice! This would be cool to integrate with "shademap", to visualize the shade/sun during the journey.

[1] https://shademap.app/@37.75153,-119.53737,12.65679z,16416003...

Thanks for this link - I'm amazed to see it even has an approximation for my city based on buildings (Detroit.)

This is really useful tool for photography. On Android, I also use Sun Surveyor to determine when the sun is hitting the right side of a building, but it doesn't show the shadows cast by other buildings!

Love it! Always wanted to build something like this. Glad you made it first though!

Drop your Twitter in your profile. Would love to give you a follow :)

I entirely expect your motives to be non-commercial but I reckon there will be bus or train ticket sites who would pay for this. Which would also allow more people to benefit from it. Well done on a great job
That would have seem to be something trivial to think about for anyone with a modicum of sense of orientation.

I guess most people don't have that.

Not all routes are a straight line. The time of day also matters…
Congratulations on your superior sense of orientation.
Your comment comes across as arrogant and (embarrassingly for you) you’re wrong. There are more variables - the direction the roads go in. The changing position of the sun during the journey. The date and time. It’s nothing like as clear cut as you make out.

Try “London to Edinburgh” at this time of year and you’ll see what I mean - there’s only 10% difference in sun exposure between the two sides of the bus.

The sun doesn't rise in the East and set in the West though. And a random short route I put in had about 30 turns and all kinds of angles. Not everywhere is a US grid city :-).
gosh, I've been thinking about making this for years, now I have to generalize for planes
Twenty-three years ago, during my daily trips to the university campus, I had the exact same idea. However, I became distracted by calculating the position of the sun and delved into astronomical algorithms, which led me to never complete it. Kudos to you, that's really impressive!
Getting lost on the 0.1% edge cases or improvements is why I never finish side projects, either.
I don't always manage to adhere to my own advise here. But talking to "customers" really solves this.

Half these customers can't be bothered by the edge cases that I've been poring over for nights. The other half puts forward edge cases that I've never been aware of. Some of which are critical to their work-flow. Many are implemented in mere minutes. "Wow. That saves us 30 minutes typing over prices, every day!".

As an engineer I love to find solutions. But as an entrepeneur I really must understand the problem and scope. that 0.1% edge cases is hardly ever part of the success.

Thanks for posting this, honestly the 0.1% scare me sometimes on technical project. I think you're right, just gotta talk to my customers directly if they even care about it.
Writing the level editor for my raycaster is why I never wrote my raycaster
I don't think getting the position of the sun is an edge case, it's a fundamental capability for the product to work at all
I believe they meant edge cases when dealing with sun position calculations or maybe other things, not that the sun position is an edge case.
You could probably make a lookup table that works "well enough" in like a few hours.
You could probably make it in a few minutes - the direction of the sun is, to a first approximation, 15 degrees times the number of hours it is after midnight. This leads to a trick for using an analog watch as a compass:

https://www.citizenwatch-global.com/support/exterior/directi...

https://www.watchaffinity.co.uk/blog/how-to-use-your-watch-a...

This is more prone to errors closer to the equator and in the summer (https://possiblywrong.wordpress.com/2012/01/25/using-a-watch...) but should be good enough for picking a side of the bus.

(This is all in the northern hemisphere; in the southern hemisphere the sun goes the other way, so change the sign on everything.)

The equation of time gets in there too if I recall correctly - https://en.wikipedia.org/wiki/Equation_of_time

> The equation of time describes the discrepancy between two kinds of solar time. The word equation is used in the medieval sense of "reconciliation of a difference". The two times that differ are the apparent solar time, which directly tracks the diurnal motion of the Sun, and mean solar time, which tracks a theoretical mean Sun with uniform motion along the celestial equator. Apparent solar time can be obtained by measurement of the current position (hour angle) of the Sun, as indicated (with limited accuracy) by a sundial. Mean solar time, for the same place, would be the time indicated by a steady clock set so that over the year its differences from apparent solar time would have a mean of zero.

And this gets into a neat part of the Clock of the Long Now and a cam needed to keep track of that over 10,000 years. https://longnow.org/ideas/the-equation-of-time-cam-keeping-g...

The equation of time would be in there! But the largest that gets is about 16 minutes, corresponding to a 4-degree error in position, and there are much bigger sources of error. But thanks for the link to the Clock of the Long Now!
The hard part was obtaining information such as solar azimuth, altitude, declination, hour angle, etc without using external APIs. Spent around 5 days implementing backend.
Way too late now, but to help others this fancy Excel sheet provided by NOAA is awesome! It implements all of these equations in Excel and is pretty easily portable to your programming language of choice. https://gml.noaa.gov/grad/solcalc/calcdetails.html

P.S. Using this has made it clear to me how bad most sunrise/sunset calculators actually are.

> P.S. Using this has made it clear to me how bad most sunrise/sunset calculators actually are.

That may just be a function of how you define "sunrise" and "sunset". It is never as simple as "when the sun hits the horizon", but something about some number of arc minutes from something something.

Dependent on the refractive index, which depends on air density and temperature and humidity too; and we have to integrate over the region between the horizon and the upper atmosphere (diagonally, of course)…
Haha, thanks ,yep. I learned all this when I lived in the Yukon and sunset takes about 2 hours...
To be clear I was complaining that basically everyone calculates “sunrise” and “sunset” differently. If you check half a dozen different “sunset” calculators you will get a surprisingly wide variation in the times they provide. At least where I live the error seems to average 5-10 minutes.
> At least where I live the error seems to average 5-10 minutes

And what I meant was you are not seeing "error", it's just a difference in definition.

For anyone wanting to do this calculation yourself, this site is really good: https://www.aa.quae.nl/en/reken/zonpositie.html

I've previously used the formulas on this site to calculate the altitude/azimuth of the Sun and all the planets from a given lat/long/time on Earth.

When I travel, Before I pick a seat, I will think about the direction of the bus or plane to decide which side(left or right) seat I should select. Sometimes I like the sun while traveling, sometimes I'm not. The method is simple, it needs three factors, 1. The direction of this transportation tool way to your destination; 2. The time range; 3. The direction of the sun in the time range. So if I create this site, I need these variables first: 1. Tell me where are you going(such as From, To). I can confirm the direction of the transportation tool on Google Maps. 2. Tell me the time, I can calculate the direction of the sun based on the time range. After that, I can know which side seat you should choose.
Is it much more complicated than to prefer the predominantly northwest side in the morning and northeast side in the afternoon (for northern hemisphere)?
Do you live in a city with a grid based road system? In a country with more organic road networks, that wouldn't work
A glance at the driving route on Google Maps should show you the typical vehicle orientation.
This just doesn't seem very POSH.
Cool project. Where does it get worldwide bus route info? Does OSM have an API for it?
Yes,OpenStreetMap has
Thank you for not having region based restrictions. It works for any place and destination.
If Google had made this, it would be US only.
Love that this is a web page and not another app taking up space on my phone.
(comment deleted)
Shady side is comfy but remember that 120 min of daily indirect or direct exposure to UVB can protect your eyesight health.

Just 120 min a day under a tree during childhood.

Dolgin, Elie. 2015. The myopia boom. Nature 519: 276.

Williams, Katie M., & al. 2017. Association Between Myopia, Ultraviolet B Radiation Exposure, Serum Vitamin D Concentrations, and Genetic Polymorphisms in Vitamin D Metabolic Pathways in a Multicountry European Study. JAMA Ophthalmology 135: 47-53. doi: 10.1001/jamaophthalmol.2016.4752. https://doi.org/10.1001/jamaophthalmol.2016.4752

Does the glass block lots of UV?
Glass blocks 100% of UVB and 25% of UVA. So while you wont burn, light through glass will still cause skin damage.
Thanks - I learned something today.

Looks like some bus companies treat their windows to block the UVA as well. Eg https://www.valleymetro.org/blog/2022/07/how-valley-metro-ke...

So travelling for hours on the sunny side of the bus won't do anything to protect our kids’ eyesight?
Given the uniqueness of this idea, I'm curious about the technical challenges you faced while developing "SitInShade."
It's not working for me :(

I'm trying a trip from the north of France (Paris) to the south (Lyon) in the morning while the sun rises. So the sun is mainly on the East (so left of the bus) and the app tells me to sit on the left side of the bus.

At this time of year, during daylight, the sun is mostly in the south in France. The journey is south-easterly and takes 5 hours, so the right side is sunny for most of the journey!
The idea is nice, the problem is that the route the app uses (it uses for example a highway) isn't the one the bus would use.
Hmm, shouldn't the more shady side be the same in practical scenarios (like not going the other way around the globe, etc)?
There are quite a few bus routes that wind back and forth, especially in urban and mountainous areas potentially offering a lot of shade from buildings and cliff edges for parts of the route anyway.

Whether these journeys involve long enough in direct sun to matter is another question.

Yes, but I believe that the diff of sun(RIGHT_SIDE) and sun(LEFT_SIDE) is the same, no?

Like the bus cannot get to the same destination by taking a route where the sun shines on the other side more. (Ignoring some fringe theoretical routes where you do a massive detour over equator.)

edit: I was too fast with my reply to read yours properly. Sorry.

> a lot of shade from buildings and cliff edges for parts of the route

I don't believe sitinshade.com handles those anyway.