Vector Tile Builder

March 15, 2026 ยท View on GitHub

A web application for generating vector tiles (.pbf / .pmtiles(In Progress)) in the browser

Image

๐ŸŽฏ 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

# 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.

# Using Homebrew (macOS)
brew install node

# Or download from official website
# https://nodejs.org/

๐Ÿงช Phase 1: Testing with Rust CLI

Build

cd core
cargo build --release

Run CLI Tool

# Usage
cargo run --bin cli <geojson_file> <output_dir> <min_zoom> <max_zoom> [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

cd core
cargo test

๐ŸŒ Phase 2: Wasm + Web App

Local Development

# 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

# 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!