| Crates.io | fast-layer |
| lib.rs | fast-layer |
| version | 0.1.1 |
| created_at | 2025-11-19 03:14:13.010648+00 |
| updated_at | 2025-11-24 03:58:10.105826+00 |
| description | WIP: A fast WebAssembly-based layer for high-performance MapLibre/Mapbox |
| homepage | https://github.com/username/fast-layer |
| repository | https://github.com/username/fast-layer |
| max_upload_size | |
| id | 1939362 |
| size | 3,393,965 |
A fast WebAssembly-based layer for high-performance MapLibre/Mapbox rendering using WebGL2.
This project is currently in development and is not ready for production use. Features are being actively developed and the API may change.
Fast Layer is a WebAssembly (WASM) library written in Rust that provides high-performance map rendering capabilities by leveraging WebGL2. It's designed to integrate seamlessly with MapLibre GL JS and Mapbox GL JS, offering improved performance for complex map visualizations.
git clone https://github.com/username/fast-layer.git
cd fast-layer
chmod +x build.sh
./build.sh
The build script will:
www/pkg/www/index.html in a web browserfast-layer/
βββ src/
β βββ lib.rs # Main WASM library implementation
β βββ main.rs # Test/development binary
βββ www/
β βββ index.html # Demo webpage
β βββ map.js # MapLibre integration
β βββ pkg/ # Generated WASM package (after build)
βββ build.sh # Build script
βββ Cargo.toml # Rust dependencies and configuration
βββ README.md # This file
#[wasm_bindgen]
pub struct FastLayer {
canvas_id: String,
context: WebGl2RenderingContext,
program: Option<WebGlProgram>,
}
new(canvas_id: &str) -> FastLayer: Creates a new FastLayer instancecompile(&mut self): Compiles the WebGL2 shaders and links the programdraw(&self, matrix: &[f64]): Renders the layer using the provided transformation matriximport { FastLayer } from "./pkg/fast_layer.js";
// Initialize the WASM module
await init();
// Create a new FastLayer instance
const fastLayer = new FastLayer("canvas-id");
// Compile shaders
fastLayer.compile();
// Draw with transformation matrix
const matrix = [1.0, 0.0, 0.0, 1.0];
fastLayer.draw(matrix);
# Install wasm-pack if not already installed
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
# Build the project
wasm-pack build --target web --out-dir www/pkg
cargo test
For development, you can serve the www/ directory with any static file server:
# Using Python
python -m http.server 8000
# Using Node.js (if you have serve installed)
npx serve www
# Using PHP
php -S localhost:8000 -t www/
Then open http://localhost:8000 in your browser.
Fast Layer is designed to provide superior performance compared to JavaScript-based map layers by:
This project is in early development. Contributions are welcome!
git checkout -b feature-nameThis project is licensed under the MIT License - see the LICENSE.txt file for details.
Sebastian Oscar Lopez - sebastianoscarlopez@gmail.com
For questions, issues, or contributions, please visit the GitHub repository or contact the author directly.
Note: This is a work-in-progress project. APIs and functionality may change significantly before the first stable release.