svg-tileserver

Crates.iosvg-tileserver
lib.rssvg-tileserver
version0.1.2
sourcesrc
created_at2024-04-27 11:50:48.544568
updated_at2024-05-18 13:38:03.583886
descriptionA high performance SVG Leaflet/MapLibre compatible tile server
homepage
repositoryhttps://github.com/GaspardCulis/svg-tileserver
max_upload_size
id1222563
size52,358
Gaspard Culis (GaspardCulis)

documentation

README

SVG TileServer

Build Status Crates.io

A simple, memory-safe 🔥 and blazingly fast 🚀 Leaflet/MapLibre compatile tile-server that serves PNG tiles rasterized from an SVG image. This can be useful when needing to render highly complex and detailed SVGs.

Built using actix_web and crates from the resvg project.

Usage

Server side

A high performance SVG Leaflet/MapLibre compatible tile server

Usage: svg-tileserver [OPTIONS] <SVG_PATH>

Arguments:
  <SVG_PATH>  The path of the SVG that should be served

Options:
  -t, --tile-size <TILE_SIZE>        The size in pixels of a PNG tile [default: 256]
  -p, --port <PORT>                  The port to start the server on [default: 8080]
  -b, --bind-address <BIND_ADDRESS>  The address to bind the server on [default: 127.0.0.1]
  -h, --help                         Print help
  -V, --version                      Print version

Client side

import L from "leaflet";

const map = new L.Map("#map", {
  crs: L.CRS.Simple,
  center: [0, 0],
  zoom: 0,
});

L.tileLayer("http://localhost:8080/tile/{z}/{x}/{y}.png", {
  maxZoom: 19,
}).addTo(map);
Commit count: 56

cargo fmt