76 lines
2.9 KiB
Markdown
76 lines
2.9 KiB
Markdown
# Polisplexity Digital Twin Viewer
|
||
|
||
This application is a Django-based 3D digital twin city renderer using A-Frame and real-world OpenStreetMap (OSM) data. It allows visualization of buildings, fiber paths, cell towers, and other urban infrastructure in a simulated, interactive WebVR environment.
|
||
|
||
## ✨ Features
|
||
|
||
- 🔲 **Building extrusion from OSM**: Downloads building footprints with geometry and height/levels metadata and extrudes them into 3D blocks.
|
||
- 🛰️ **Street network rendering**: Downloads local driving network and represents it visually as 3D fiber links.
|
||
- 🏙️ **Recentered city layout**: All elements are normalized to a `(0,0)` coordinate center and scaled down to allow a bird’s-eye view or giant-perspective simulation.
|
||
- 📡 **A-Frame-based environment**: Uses `aframe-environment-component` for sky, lighting, ground, and interactions.
|
||
- 🎯 **Status gauges**: Each building displays a status gauge with a rotating ring and transparent glass core, labeled with mock status data.
|
||
- 🧠 **Per-entity click interaction**: Clicking on a gauge changes its color and toggles the status (mocked).
|
||
- 🌐 **Dynamic generation by coordinates**: Any city view can be created dynamically via URL parameters like `lat`, `long`, and `scale`.
|
||
|
||
## 🏗️ Stack
|
||
|
||
| Component | Technology |
|
||
|--------------------|-----------------------------|
|
||
| Backend | Django 5.x |
|
||
| Mapping API | `osmnx`, `shapely`, `geopandas` |
|
||
| Frontend (3D) | A-Frame 1.7.0 |
|
||
| Visualization Libs | `aframe-environment-component` |
|
||
| Deployment Ready? | Yes, via Docker + Gunicorn |
|
||
|
||
## 🔌 Example Usage
|
||
|
||
To load a city block from Centro Histórico, Mexico City:
|
||
|
||
```
|
||
|
||
[http://localhost:8001/city/digital/twin/osm\_city/?lat=19.391097\&long=-99.157815\&scale=0.1](http://localhost:8001/city/digital/twin/osm_city/?lat=19.391097&long=-99.157815&scale=0.1)
|
||
|
||
````
|
||
|
||
## 🧪 Directory Highlights
|
||
|
||
- `pxy_city_digital_twins/views.py`: Request handler that decides which generator to use (`osm_city`, `random_city`, etc.)
|
||
- `services/osm_city.py`: Main generator for real-world urban geometry based on lat/lon.
|
||
- `templates/pxy_city_digital_twins/city_digital_twin.html`: A-Frame scene renderer.
|
||
- `templates/pxy_city_digital_twins/_status_gauge.html`: UI fragment for interactive gauges on city elements.
|
||
|
||
## 📦 Dependencies
|
||
|
||
Add these to `requirements.txt`:
|
||
|
||
```txt
|
||
osmnx>=1.9.3
|
||
shapely
|
||
geopandas
|
||
````
|
||
|
||
Optional (for better performance in prod):
|
||
|
||
```txt
|
||
gunicorn
|
||
dj-database-url
|
||
```
|
||
|
||
## 🚧 To-Do
|
||
|
||
* [ ] Load `status` from a real database or agent simulation
|
||
* [ ] Add 3D models (e.g., trees, street furniture)
|
||
* [ ] Support texture-mapped facades
|
||
* [ ] Add time-based simulation / animation
|
||
* [ ] Integrate sensor/IoT mock data stream
|
||
|
||
## 👀 Screenshot
|
||
|
||
> *Coming soon* — consider generating A-Frame scene screenshots automatically using headless browser tools.
|
||
|
||
---
|
||
|
||
**Maintained by [Hadox Research Labs](https://hadox.org)**
|
||
|
||
|