90 lines
2.2 KiB
Markdown
90 lines
2.2 KiB
Markdown
# 🗺️ Rust Vector Map
|
|
|
|
A high-performance, GPU-accelerated vector map renderer built with **Rust**, **WebAssembly**, and **ScyllaDB**.
|
|
|
|
## 🚀 Features
|
|
|
|
- **GPU Rendering**: Uses `wgpu` to render millions of vertices (buildings, roads, parks) directly on the GPU.
|
|
- **WebAssembly**: Core logic runs in Wasm for near-native performance in the browser.
|
|
- **Scalable Backend**: Powered by **ScyllaDB** to handle massive OpenStreetMap datasets with low latency.
|
|
- **Custom Vector Tiles**: Efficient binary format for fast network transfer and parsing.
|
|
- **Interactive**: Smooth zooming, panning, and dynamic level-of-detail.
|
|
|
|
## 🏗️ Architecture
|
|
|
|
- **Frontend**: Rust (`winit`, `wgpu`, `wasm-bindgen`) compiled to WebAssembly.
|
|
- **Backend**: Rust (`Axum`) REST API serving tile data.
|
|
- **Database**: ScyllaDB (Cassandra-compatible) storing processed OSM data.
|
|
- **Importer**: Custom Rust tool (`osmpbf`) to ingest `.osm.pbf` files.
|
|
|
|
## 🛠️ Getting Started
|
|
|
|
### Prerequisites
|
|
|
|
- [Rust](https://rustup.rs/) (latest stable)
|
|
- [Docker](https://www.docker.com/) & Docker Compose
|
|
- `wasm-pack`: `cargo install wasm-pack`
|
|
|
|
### 1. Start the Database
|
|
|
|
Start ScyllaDB in a container:
|
|
|
|
```bash
|
|
docker compose up -d scylla
|
|
```
|
|
|
|
### 2. Import Data
|
|
|
|
1. Download an OpenStreetMap PBF file (e.g., from [Geofabrik](https://download.geofabrik.de/)).
|
|
2. Save it as `sample.osm.pbf` in the project root.
|
|
3. Run the importer:
|
|
|
|
```bash
|
|
cargo run --bin importer
|
|
```
|
|
|
|
*Note: This process may take a few minutes depending on the size of the PBF file.*
|
|
|
|
### 3. Run the Application
|
|
|
|
**Option A: Docker (Recommended)**
|
|
|
|
Build and run the entire stack:
|
|
|
|
```bash
|
|
docker compose up --build
|
|
```
|
|
|
|
**Option B: Manual (Development)**
|
|
|
|
1. **Build Frontend**:
|
|
```bash
|
|
cd frontend
|
|
wasm-pack build --target web --out-name wasm --out-dir ../backend/static
|
|
cd ..
|
|
```
|
|
|
|
2. **Run Backend**:
|
|
```bash
|
|
cargo run --bin backend
|
|
```
|
|
|
|
### 4. View the Map
|
|
|
|
Open your browser and navigate to:
|
|
|
|
```
|
|
http://localhost:3000
|
|
```
|
|
|
|
## 📂 Project Structure
|
|
|
|
- `/backend`: Axum server and database logic.
|
|
- `/frontend`: Rust Wasm application and rendering engine.
|
|
- `/importer`: Tool for parsing and ingesting OSM data.
|
|
- `docker-compose.yml`: Service orchestration.
|
|
|
|
## 📜 License
|
|
|
|
MIT License
|