diff --git a/.github/workflows/demo.yml b/.github/workflows/demo.yml new file mode 100644 index 000000000..f92ac4369 --- /dev/null +++ b/.github/workflows/demo.yml @@ -0,0 +1,25 @@ +name: Demo + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + paths: + - 'demo/**' + release: + types: [ published ] + workflow_dispatch: + +jobs: + demo: + name: Demo + runs-on: ubuntu-latest + + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - run: | + cd demo/frontend + docker-compose build diff --git a/Cargo.lock b/Cargo.lock index a16b04d8c..1b7ec3ce0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -298,30 +298,30 @@ checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +checksum = "a3a318f1f38d2418400f8209655bfd825785afd25aa30bb7ba6cc792e4596748" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.1" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" dependencies = [ "anstyle", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -963,9 +963,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" dependencies = [ "powerfmt", "serde", @@ -1145,14 +1145,14 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.22" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" +checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", - "windows-sys 0.48.0", + "redox_syscall", + "windows-sys 0.52.0", ] [[package]] @@ -1682,15 +1682,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.12.0" @@ -1854,7 +1845,7 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "martin" -version = "0.11.2" +version = "0.11.3" dependencies = [ "actix-cors", "actix-http", @@ -1907,7 +1898,7 @@ version = "0.1.5" [[package]] name = "mbtiles" -version = "0.8.1" +version = "0.8.2" dependencies = [ "actix-rt", "anyhow", @@ -2197,7 +2188,7 @@ checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.4.1", + "redox_syscall", "smallvec", "windows-targets 0.48.5", ] @@ -2650,15 +2641,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b42e27ef78c35d3998403c1d26f3efd9e135d3e5121b0a4845cc5cc27547f4f" -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.4.1" @@ -2752,9 +2734,9 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.6" +version = "0.17.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "684d5e6e18f669ccebf64a92236bb7db9a34f07be010e3627368182027180866" +checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" dependencies = [ "cc", "getrandom", @@ -2775,9 +2757,9 @@ dependencies = [ [[package]] name = "rsa" -version = "0.9.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af6c4b23d99685a1408194da11270ef8e9809aff951cc70ec9b17350b087e474" +checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" dependencies = [ "const-oid", "digest", @@ -2859,15 +2841,15 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.25" +version = "0.38.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" +checksum = "9470c4bf8246c8daf25f9598dca807fb6510347b1e1cfa55749113850c79d88a" dependencies = [ "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2877,7 +2859,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "629648aced5775d558af50b2b4c7b02983a04b312126d45eeead26e7caa498b9" dependencies = [ "log", - "ring 0.17.6", + "ring 0.17.7", "rustls-webpki", "sct", ] @@ -2909,7 +2891,7 @@ version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring 0.17.6", + "ring 0.17.7", "untrusted 0.9.0", ] @@ -2965,7 +2947,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring 0.17.6", + "ring 0.17.7", "untrusted 0.9.0", ] @@ -3269,11 +3251,11 @@ dependencies = [ [[package]] name = "sqlformat" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b7b278788e7be4d0d29c0f39497a0eef3fba6bbc8e70d8bf7fde46edeaa9e85" +checksum = "ce81b7bd7c4493975347ef60d8c7e8b742d4694f4c49f93e0a12ea263938176c" dependencies = [ - "itertools 0.11.0", + "itertools 0.12.0", "nom", "unicode_categories", ] @@ -3599,7 +3581,7 @@ checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" dependencies = [ "cfg-if", "fastrand", - "redox_syscall 0.4.1", + "redox_syscall", "rustix", "windows-sys 0.48.0", ] @@ -3676,9 +3658,9 @@ dependencies = [ [[package]] name = "tiny-skia" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b72a92a05db376db09fe6d50b7948d106011761c05a6a45e23e17ee9b556222" +checksum = "b6a067b809476893fce6a254cf285850ff69c847e6cfbade6a20b655b6c7e80d" dependencies = [ "arrayref", "arrayvec", @@ -3691,9 +3673,9 @@ dependencies = [ [[package]] name = "tiny-skia-path" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac3865b9708fc7e1961a65c3a4fa55e984272f33092d3c859929f887fceb647" +checksum = "5de35e8a90052baaaf61f171680ac2f8e925a1e43ea9d2e3a00514772250e541" dependencies = [ "arrayref", "bytemuck", @@ -4477,18 +4459,18 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" [[package]] name = "zerocopy" -version = "0.7.27" +version = "0.7.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43de342578a3a14a9314a2dab1942cbfcbe5686e1f91acdc513058063eafe18" +checksum = "5d075cf85bbb114e933343e087b92f2146bac0d55b534cbb8188becf0039948e" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.27" +version = "0.7.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1012d89e3acb79fad7a799ce96866cfb8098b74638465ea1b1533d35900ca90" +checksum = "86cd5ca076997b97ef09d3ad65efe811fa68c9e874cb636ccb211223a813b0c2" dependencies = [ "proc-macro2", "quote", diff --git a/docs/src/run-with-docker-compose.md b/docs/src/run-with-docker-compose.md index 6e5d6956a..98e79d0c2 100644 --- a/docs/src/run-with-docker-compose.md +++ b/docs/src/run-with-docker-compose.md @@ -7,7 +7,7 @@ version: '3' services: martin: - image: ghcr.io/maplibre/martin:v0.11.1 + image: ghcr.io/maplibre/martin:v0.11.2 restart: unless-stopped ports: - "3000:3000" diff --git a/martin/Cargo.toml b/martin/Cargo.toml index 2e2eae793..6b4987305 100644 --- a/martin/Cargo.toml +++ b/martin/Cargo.toml @@ -3,7 +3,7 @@ lints.workspace = true [package] name = "martin" # Once the release is published with the hash, update https://github.com/maplibre/homebrew-martin -version = "0.11.2" +version = "0.11.3" authors = ["Stepan Kuzmin ", "Yuri Astrakhan ", "MapLibre contributors"] description = "Blazing fast and lightweight tile server with PostGIS, MBTiles, and PMTiles support" keywords = ["maps", "tiles", "mbtiles", "pmtiles", "postgis"] diff --git a/martin/src/bin/martin-cp.rs b/martin/src/bin/martin-cp.rs index 18d9395cb..e05d49d64 100644 --- a/martin/src/bin/martin-cp.rs +++ b/martin/src/bin/martin-cp.rs @@ -99,6 +99,22 @@ pub struct CopyArgs { /// Skip generating a global hash for mbtiles validation. By default, `martin-cp` will compute and update `agg_tiles_hash` metadata value. #[arg(long)] pub skip_agg_tiles_hash: bool, + /// Set additional metadata values. Must be set as "key=value" pairs. Can be specified multiple times. + #[arg(long, value_name="KEY=VALUE", value_parser = parse_key_value)] + pub set_meta: Vec<(String, String)>, +} + +fn parse_key_value(s: &str) -> Result<(String, String), String> { + let mut parts = s.splitn(2, '='); + let key = parts.next().unwrap(); + let value = parts + .next() + .ok_or_else(|| format!("Invalid key=value pair: {s}"))?; + if key.is_empty() || value.is_empty() { + Err(format!("Invalid key=value pair: {s}")) + } else { + Ok((key.to_string(), value.to_string())) + } } async fn start(copy_args: CopierArgs) -> MartinCpResult<()> { @@ -336,6 +352,11 @@ async fn run_tile_copy(args: CopyArgs, state: ServerState) -> MartinCpResult<()> info!("{progress}"); + for (key, value) in args.set_meta { + info!("Setting metadata key={key} value={value}"); + mbt.set_metadata_value(&mut conn, &key, value).await?; + } + if !args.skip_agg_tiles_hash { if progress.non_empty.load(Ordering::Relaxed) == 0 { info!("No tiles were copied, skipping agg_tiles_hash computation"); diff --git a/mbtiles/Cargo.toml b/mbtiles/Cargo.toml index e8d330937..4c0665ba4 100644 --- a/mbtiles/Cargo.toml +++ b/mbtiles/Cargo.toml @@ -2,7 +2,7 @@ lints.workspace = true [package] name = "mbtiles" -version = "0.8.1" +version = "0.8.2" authors = ["Yuri Astrakhan ", "MapLibre contributors"] description = "A simple low-level MbTiles access and processing library, with some tile format detection and other relevant heuristics." keywords = ["mbtiles", "maps", "tiles", "mvt", "tilejson"] diff --git a/tests/expected/martin-cp/flat-with-hash_metadata.txt b/tests/expected/martin-cp/flat-with-hash_metadata.txt index 1be91d17c..871bb20ba 100644 --- a/tests/expected/martin-cp/flat-with-hash_metadata.txt +++ b/tests/expected/martin-cp/flat-with-hash_metadata.txt @@ -9,6 +9,6 @@ tilejson: description: public.function_zxy_query_test name: function_zxy_query_test format: mvt - generator: martin-cp v0.11.2 + generator: martin-cp v0.11.3 agg_tiles_hash: 9B931A386D6075D1DA55323BD4DBEDAE diff --git a/tests/expected/martin-cp/flat_metadata.txt b/tests/expected/martin-cp/flat_metadata.txt index f47695741..2be446cee 100644 --- a/tests/expected/martin-cp/flat_metadata.txt +++ b/tests/expected/martin-cp/flat_metadata.txt @@ -18,6 +18,6 @@ tilejson: name: table_source foo: '{"bar":"foo"}' format: mvt - generator: martin-cp v0.11.2 + generator: martin-cp v0.11.3 agg_tiles_hash: EF19FCBCE73ADE1C85E856E6BBA9B4C7 diff --git a/tests/expected/martin-cp/normalized_metadata.txt b/tests/expected/martin-cp/normalized_metadata.txt index af7de9ec5..eaa78cd9b 100644 --- a/tests/expected/martin-cp/normalized_metadata.txt +++ b/tests/expected/martin-cp/normalized_metadata.txt @@ -12,7 +12,7 @@ tilejson: - 85.0511 center: - 0.0 - - 20.0 + - 0.0 - 0 description: 'One of the example maps that comes with TileMill - a bright & colorful world map that blends retro and high-tech with its folded paper texture and interactive flag tooltips. ' legend: |- @@ -25,7 +25,7 @@ tilejson: maxzoom: 1 minzoom: 0 - name: Geography Class + name: normalized template: |- {{#__location__}}{{/__location__}}{{#__teaser__}}
@@ -35,6 +35,6 @@ tilejson:
{{/__teaser__}}{{#__full__}}{{/__full__}} version: 1.0.0 format: png - generator: martin-cp v0.11.2 + generator: martin-cp v0.11.3 agg_tiles_hash: A85C80BA1CE047E2D93DAC25C5179775 diff --git a/tests/test.sh b/tests/test.sh index 5302e3876..7b8848b64 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -392,7 +392,8 @@ if [[ "$MARTIN_CP_BIN" != "-" ]]; then --min-zoom 0 --max-zoom 6 "--bbox=-2,-1,142.84,45" test_martin_cp "normalized" "${CFG[@]}" \ --source geography-class-png --mbtiles-type normalized --concurrency 3 \ - --min-zoom 0 --max-zoom 6 "--bbox=-2,-1,142.84,45" + --min-zoom 0 --max-zoom 6 "--bbox=-2,-1,142.84,45" \ + --set-meta "name=normalized" --set-meta=center=0,0,0 unset DATABASE_URL