-
Olivier Maury authoredOlivier Maury authored
Tiles Proxy
TilesProxy: a cache proxy for tiles.
The aim of this little server is to act as a proxy for geographic tiles servers in order to limit calls to their services from our web applications.
Supported standards for tiles:
- OGC WMTS: OpenGIS Web Map Tile Service
- XYZ (aka Slippy Map Tilenames): the de facto OpenStreetMap standard
Configuration of origin tiles servers is done in a TOML file.
See tiles-proxy.toml
for example.
To enable browser caching, HTTP headers are added: ETag and Cache-Control. CORS headers are also added to enable canvas export (eg.: in OpenLayers) from browser.
Getting started
Install Rust
Tiles Proxy uses the web framework for Rust: Rocket. Because of this, we'll need a recent release of Rust to run Rocket applications. If you already have a working installation of the latest Rust compiler, feel free to skip to the next section.
First, install rustup
.
# install rustup, Proceed with standard installation
curl https://sh.rustup.rs -sSf | sh
# read the output to configure your shell
Once rustup
is installed, ensure the latest toolchain is installed by running the command:
rustup default stable
Add pkg-config to compile openssl-sys
sudo apt install pkg-config
Development
Format code with
cargo fmt --
Test with
cargo test
Use a linter with
cargo clippy
Commits
Commit messages must follow the Conventional Commits specification, a lightweight convention to write the commit message text.
Configure VSCodium / VS Code
Recommended extensions:
- Even Better TOML (
ext install tamasfe.even-better-toml
): Fully-featured TOML support https://marketplace.visualstudio.com/items?itemName=tamasfe.even-better-toml - rust-analyzer (
ext install rust-lang.rust-analyzer
): Rust language support for Visual Studio Code https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer - Conventional Commits (
ext install vivaxy.vscode-conventional-commits
) Conventional Commits for VSCode https://marketplace.visualstudio.com/items?itemName=vivaxy.vscode-conventional-commits
Build
cargo build --release
Binary is at target/release/tiles-proxy
.
Run
cargo run tiles-proxy.toml
or
tiles-proxy tiles-proxy.toml