#svg #瓦片 #兼容 #服务器 #actix-web # #性能

应用 svg-tileserver

高性能SVG Leaflet/MapLibre兼容瓦片服务器

3个版本

0.1.2 2024年5月18日
0.1.1 2024年4月27日
0.1.0 2024年4月27日

#490HTTP服务器

每月23次下载

MIT许可证

16KB
89

SVG瓦片服务器

Build Status Crates.io

一个简单、内存安全 🔥 且速度极快 🚀、Leaflet/MapLibre兼容的瓦片服务器,可从SVG图像中渲染PNG瓦片。当需要渲染高度复杂和详细的SVG时非常有用。

使用actix_webresvg项目中的crate构建。

用法

服务器端

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

客户端

import L from "leaflet";

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

L.tileLayer("https://#:8080/tile/{z}/{x}/{y}.png", {
  maxZoom: 19,
}).addTo(map);

依赖项

~18–29MB
~535K SLoC