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.
If the routing is done with an internal database (rather than some roads-only API) it might be straightforward to use the railway lines from Open Street Map [1]. Or even the public transport routes recorded in OSM [2].
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.
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.
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.
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.
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.
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.
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?
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!
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
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 :-).
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!
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.
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:
> 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.
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)…
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.
I'm not sure what you mean by external APIs but is there a reason you're not using SunCalc[1] on the client to process the route after it's returned from the routing engine?
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)?
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
We need a little UVB everyday to maintain melanin (skin pigment) and skin thickness. If you work inside M-F and then go hard on the weekends outdoors, you will receive disproportionate damage from sunlight.
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!
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.
220 comments
[ 3.9 ms ] story [ 268 ms ] threadThis must be an epitome of a hobby project!
[1] https://openrailwaymap.org/
[2] https://www.openstreetmap.org/#layers=O
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.
They're more concerned that my seat back is not pushed back by the 3mm that they move.
I don't travel enough on other airlines to make generalisations.
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 : - )
Bravo. :) What a great project and execution!
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.
https://en.wikipedia.org/wiki/Southern_France
[1] https://shademap.app/@37.75153,-119.53737,12.65679z,16416003...
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!
Drop your Twitter in your profile. Would love to give you a follow :)
I guess most people don't have that.
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.
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.
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 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...
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.
And what I meant was you are not seeing "error", it's just a difference in definition.
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.
[1] https://www.npmjs.com/package/suncalc
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
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...
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3427189/
https://www.who.int/news-room/questions-and-answers/item/rad...
If you are blocking UVB, you should be blocking UVA as well. The bus folks are doing some good thinking.
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.
Whether these journeys involve long enough in direct sun to matter is another question.
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.