3D Light Pollution Visualization using Raylib and Earth Engine
This project is a Python project focused on fetching, processing, and visualizing global light pollution data in a 3D environment. It utilizes the Google Earth Engine API to retrieve night light data and the raylib graphics library to render the data points on a 3D spherical representation of Earth. It has been created to explore 3D data visualization, spherical coordinates, and Earth Engine integration.
graph TD
%% Styles
classDef data fill:#BBDEFB,stroke:#1565C0,stroke-width:2px,color:black;
classDef process fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px,color:black;
classDef graphics fill:#FFF9C4,stroke:#FBC02D,stroke-width:2px,color:black;
classDef app fill:#E1BEE7,stroke:#6A1B9A,stroke-width:2px,color:black;
%% Nodes
App["PlanetApp<br/>Main Entry Point<br/>(sservant)"]:::app
Data["EarthEngineDataProvider<br/>Fetch Data<br/>(sservant)"]:::data
Processor["LightMapProcessor<br/>3D Projection<br/>(sservant)"]:::process
Visualizer["PlanetVisualizer<br/>3D Rendering<br/>(sservant)"]:::graphics
%% Connections
App -->|1. Request data| Data
App -->|2. Generate points| Processor
App -->|3. Render planet| Visualizer
Data -->|Image path| Processor
Processor -->|3D Point Cloud| Visualizer
The Prometheus visualizer can be run using standard Python tools. Dependencies are managed via pyproject.toml.
pip install .Or using uv (recommended):
uv pip install -e .from src.app import PlanetApp
# Initialize and run the application
app = PlanetApp()
app.run()Run the application directly:
python -m srcThe project implements several key components for processing and rendering geographic data:
- Data Acquisition: Interfacing with the Earth Engine API to download global night lights composite imagery.
- Spherical Projection: Converting 2D equirectangular map coordinates from the image into 3D Cartesian coordinates (x, y, z) to map the light pollution points onto a sphere.
- Point Cloud Optimization: Processing large image datasets and converting pixel intensities into scaled point sizes and colors for efficient 3D rendering.
The algorithm considers:
- Fetching data from Earth Engine
- Parsing and thresholding the 2D image array using pandas and matplotlib
- Calculating spherical coordinates to map data accurately on a sphere of radius 10.0
- Interactive 3D rendering using raylib
│ pyproject.toml # Project configuration and dependencies
│ README.md # Project documentation
└ src/
├── __main__.py # Main entry point
├── app.py # Core application logic
├── data.py # Earth Engine data provider
├── processor.py # Image to 3D point processor
└── visualizer.py # Raylib 3D graphics engine
- Raylib — Graphics library for 3D visualization
- Google Earth Engine — Global geospatial data platform
- Spherical Coordinate System — Mathematics for 3D mapping
- Gemini — Documentation assistance
- Do not copy this code for assessed work in 42 or other courses.
- Use this repository for study and reference only.
If you have feedback, open an issue or contact the author.
