How to show solar direction arrows & sun path for each hour of the day using flutter

134 views Asked by At

enter image description here

I want to show something like this in my flutter app. So, basically user will search for particular location and I will get the latitude and longitude of that location.

Now based on that I want to show the direction of sun around that location as shown in the image.

This image is from the application available on google play store - https://play.google.com/store/apps/details?id=com.ajnaware.sunseeker&hl=en&gl=US

They are using AR in their application to show real time path and all and also show this kind of path (as shown in the image) by searching the location. So, anyone have idea how should I implement the same in flutter.

I just want to show basic things as in the image attached, not all the features from reference app.

2

There are 2 answers

0
Canilho On

You can build a widget that tracks the current datetime, and then you use the setState to change the direction of the light source, in whatever way you need it.

The major trick in this exercise is to map the actual location to the position of the sun. There might be some APIs that can help you with that.

You can also take a look at tools like this (SunEarthTools.com), and/or create a reference map for the "expected" sun position, and calculate more accurately the middle points, based on the user's more approximate location.

1
Randal Schwartz On

From the same fine folks that brought you Puro and Boxy comes SPA, the Sun Position Algorithm calculator. Use it with your lat/lon/time to get the location and draw your lines.