This is a serverless web application to fetch and show you astronomical daylight vs topographical daylight at any place on earth. In short, it shows you how much less sun you will get than your weather forecast for your area predicts.
It shows sunrise and sunset differences on any day of the year, using the topographical layout of the surrounding land. You can get a monthly report and export a video for every day of the year to view the differences.
- Open
index.htmlorpeakylight.htmlin your web browser.
This project consists of static HTML files. To view them, you can open the .html files directly in your browser. However, for a more realistic development and testing environment, it's recommended to use a local web server.
You can view the website at https://tonym128.github.io/peakylight/ which would be the same as hosting this yourself.
This project is static and is best served with a small static server during development. We recommend the Node.js serve package:
- Install
serveglobally (or as a dev dependency):
npm install -g serve- Run the server from the project root:
serveserve will print a URL to open in your browser (commonly http://localhost:3000). It handles correct MIME types and caching headers which makes it a better development experience than opening files directly.
You can run serve on a specific port (for example 8000) like this:
serve -l 8000If you don't want to install serve globally, you can run it with npx:
npx serve -l 8000- Clone the repository.
- Install dependencies:
npm install - Make changes to the code.
- Run the tests:
npx playwright test
The PeakyLight application utilizes several external data sources and libraries to provide its functionality:
-
Mapping & Geocoding:
- LeafletJS: An open-source JavaScript library for mobile-friendly interactive maps.
- OpenTopoMap: Provides topographic map tiles.
- Nominatim: Provides geocoding services from OpenStreetMap data.
-
3D Visualization & Sun Position:
- Three.js: A cross-browser JavaScript library and API used to create and display animated 3D computer graphics in a web browser.
- SunCalc: A tiny JavaScript library for calculating sun position, sunlight phases (times for sunrise, sunset, dusk, etc.), and lunar position and phases.
-
Elevation Data:
- Amazon Web Services (AWS) Terrain Tiles: Provides elevation data for rendering the 3D terrain.
-
PDF Generation:
- jsPDF & jsPDF-AutoTable: Libraries used to generate and export reports as PDF documents.
This project is licensed under the Apache License 2.0. See the LICENSE file for details.