# Vector Tile Builder
A web application for generating vector tiles (.pbf / .pmtiles(In Progress)) in the browser
## ๐ฏ Overview
A completely client-side vector tile generation tool.
Upload GeoJSON and convert it to tiles directly in your browser for download.
## ๐ Technology Stack
- **Rust + WebAssembly**: Core tile generation processing
- **React + TypeScript + Vite**: Frontend UI
## ๐ฆ Project Structure
```
web-vector-tile-maker/
โโ core/ # Rust (Wasm core)
โ โโ Cargo.toml
โ โโ build.rs
โ โโ proto/ # Protocol Buffer definitions
โ โโ src/
โ โโ lib.rs # Main library
โ โโ geojson_parser.rs # GeoJSON parsing
โ โโ projection.rs # Coordinate projection
โ โโ tiler.rs # Tile assignment
โ โโ mvt_encoder.rs # MVT encoder
โ โโ bin/
โ โโ cli.rs # CLI tool (for testing)
โโ frontend/ # React app
โ โโ package.json
โ โโ vite.config.ts
โ โโ src/
โ โโ main.tsx
โ โโ App.tsx
โ โโ worker.ts # WebWorker
โโ test_data/ # Test data
โ โโ points.geojson
โโ .github/
โโ workflows/
โโ deploy.yml # GitHub Actions CI/CD
```
## ๐ Setup
### 1. Install Rust
```bash
# Install rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Add to PATH
source $HOME/.cargo/env
# Add WebAssembly target
rustup target add wasm32-unknown-unknown
# Install wasm-bindgen-cli
cargo install wasm-bindgen-cli
```
### 2. Install Node.js
Node.js 18 or higher is required.
```bash
# Using Homebrew (macOS)
brew install node
# Or download from official website
# https://nodejs.org/
```
## ๐งช Phase 1: Testing with Rust CLI
### Build
```bash
cd core
cargo build --release
```
### Run CLI Tool
```bash
# Usage
cargo run --bin cli [layer_name]
# Example: Generate zoom level 0-5 tiles from test_data/points.geojson
cargo run --bin cli ../test_data/points.geojson ../test_output 0 5 cities
# Results are saved in test_output/ directory
# test_output/0/0/0.pbf
# test_output/1/0/0.pbf
# ...
```
### Run Tests
```bash
cd core
cargo test
```
## ๐ Phase 2: Wasm + Web App
### Local Development
```bash
# 1. Build Wasm
cd core
wasm-pack build --target web --out-dir ../frontend/src/wasm
# 2. Start frontend
cd ../frontend
npm install
npm run dev
```
Open http://localhost:5173 in your browser
### Production Build
```bash
# Build Wasm
cd core
wasm-pack build --target web --out-dir ../frontend/src/wasm
# Build frontend
cd ../frontend
npm run build
# Output is in frontend/dist/
```
## ๐ Supported GeoJSON Format
- **Input**: FeatureCollection
- **Geometry Types**:
- โ
Point
- โ
LineString
- โ
Polygon
- โณ MultiPoint / MultiLineString / MultiPolygon (In Progress)
## ๐ Output Formats
- **MVT (.pbf)**: Directory structure `{z}/{x}/{y}.pbf`
- **PMTiles**: Single file (In Progress)
## ๐ Supported Zoom Levels
- ZL 0 ~ 15
## ๐ง Development Status
### ๐ Future Plans
- [ ] PMTiles format support
- [ ] Drag & drop file upload
- [ ] npm support
## ๐ License
MIT License
## ๐ค Contributing
Issues and Pull Requests are welcome!