Commit Graph

22 Commits

Author SHA1 Message Date
Yuri Astrakhan
8ec040665f
Optimize produced release binaries (#1385)
Minor optimization to create a slightly more compact code (should be the
same performance, or possibly even faster)
2024-06-26 20:31:41 -04:00
Yuri Astrakhan
ccd550a2cf
Add binary diff for mbtiles (#1358)
* `mbtiles diff` now has an additional `--patch-type` param with
`whole`, `bin-diff-raw` and `bin-diff-gz` values:
* `whole` stores different tiles as before - as whole tiles in the
`tiles` table
* `bin-diff-raw` computes binary difference between tiles, and stores
them as brotli-encoded value in a `bsdiffraw` table, together with a
`xxh3_64` hash of the tile as it will be stored after patching
* `bin-diff-gz` same as `bin-diff-raw`, but assumes the tiles are
gzip-compressed, so it uncompresses them before comparing. The `xxh3_64`
stores the hash of the uncompressed tile. The data will be stored in the
`bsdiffrawgz` table (identical structure with above)

* `mbtiles copy --apply-patch` will automatically detect if
`bsdiffrawgz` or `bsdiffraw` tables exist, and will use binary patching.
* `mbtiles apply-patch` does not support binary patching yet
* `mbtiles copy --diff-with-file ... --patch-type ...` is an alias to
`mbtiles diff --patch-type ...`
2024-06-25 19:34:14 +00:00
Kian-Meng Ang
4b32ae072b
Fix typos (#1225)
Found via `typos --hidden --format brief`
2024-03-03 02:54:01 -05:00
Yuri Astrakhan
3dc54d7f9e
Implement tile caching (#1105)
Add a top level config parameter -- the size of cache memory (in MB) to
use for caching tiles and PMT directories, defaulting to 512, and 0 to
disable. This also removes the `pmtiles.dir_cache_size_mb` parameter (it
will be ignored, but will give a warning)

```
cache_size_mb: 512
```

The new cache will contain all tiles as provided by the source. So if
PostgreSQL returns a non-compressed tile, the cache will contain the
uncompressed variant, and will be compressed for each response. This
will be fixed in the later releases.

Note that fonts and sprites are not cached at this time, and are still a
TODO.
2023-12-30 22:48:23 -05:00
Yuri Astrakhan
2def6288f1
PMTiles cache, refactor file configs, modularize (#1094)
* Make it possible to have configuration specific to the file-based
config sections: pmtiles, mbtiles, and sprites.
* Implement PMTiles directory cache shared between all pmtiles (both
http and local), with configurable max cache size (in MB), or 0 to
disable. Defaults to 32MB (?)
* PMTiles now share web client instance, which optimizes connection
reuse in case multiple pmtiles reside on the same host
* Major refactoring to allow modular reuse, enabling the following build
features:
    * **postgres** - enable PostgreSQL/PostGIS tile sources
    * **pmtiles** - enable PMTile tile sources
    * **mbtiles** - enable MBTile tile sources
    * **fonts** - enable font sources
    * **sprites** - enable sprite sources
* Use justfile in the CI

Fixes #1093
2023-12-25 05:52:04 +00:00
Yuri Astrakhan
24819bdb45
Multiple mbtiles and martin-cp fixes (#1083)
* BREAKING: `martin-cp` will now set `format=pbf` instead of `mvt`. This
is what QGIS and possibly others expect, and this is what tools like
tilelive generates.
* `martin-cp` sets `minzoom` and `maxzoom` metadata values based on the
zoom parameters
* Add `mbtiles meta-update` command to refresh zoom levels based on the
present tiles.

Partially addresses items in #1081
2023-12-18 23:19:36 -05:00
Yuri Astrakhan
fc15e0da5e Preparing release, version bump 2023-12-18 20:24:43 -05:00
Lucas
f21119d548
Fix bbox_to_xyz (#1070)
Figure out and fix the bug with `tile-grid` crate or remove the crate
and implement it ourself.

---------

Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
2023-12-18 00:02:49 -05:00
Yuri Astrakhan
886358e93f
Fix bbox to xyz roundtrip computation (#1059)
Add `tile-grid` as a dependency to use its webmercator tile math.

---------

Co-authored-by: sharkAndshark <zhangyijunmetro@hotmail.com>
2023-12-15 06:11:31 +00:00
Yuri Astrakhan
b97f1ccdbe Move utils to v0.2, MAX_ZOOM 2023-12-09 10:19:49 -05:00
Yuri Astrakhan
280dbe162f
Move math utils to martin-tile-utils (#1056)
Mathematics should be consolidated in the utils crate. Eventually, I
hope we will move it to [tile-grid](https://crates.io/crates/tile-grid)
or [utiles](https://crates.io/crates/utiles) crates and consolidate our
efforts there.

Also, modify earth circumference by a few centimeters (to match various
other implementations): from `.7` to `.685_578_5`. This modified a few
unit tests.
2023-12-09 04:38:15 +00:00
Yuri Astrakhan
999179029b Prepare for release 2023-11-20 01:51:08 -05:00
Yuri Astrakhan
d8e386fb0c
Use Rust's 1.74 cargo lint section (#1006)
https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html
2023-11-17 08:29:25 +08:00
Yuri Astrakhan
bfbe52d032 Add crate categories 2023-10-30 18:52:47 -04:00
Yuri Astrakhan
0cf57a6a6a bump versions 2023-10-01 23:29:56 -04:00
Yuri Astrakhan
4664d5ad8a update lock, minor toml sort cleanup 2023-07-05 20:56:23 -04:00
Yuri Astrakhan
a419d77fca Bump versions for release 2023-06-04 15:04:42 -04:00
Yuri Astrakhan
36eab5f6bb bump martin-tile-utils version to v0.1.1 2023-06-03 23:26:44 -04:00
Yuri Astrakhan
18770664e1
Consolidate all crate dependencies (#694)
This moves all dependency version management to one location
2023-06-01 09:05:06 -04:00
Yuri Astrakhan
0ffd712927 bump versions, update lock 2023-03-25 14:41:52 -04:00
Yuri Astrakhan
9cd71476db
Prepare for sub-crate publish, detection bug fix (#615)
* tile format detection would crash on a rare edge case
* add some formatting and info about utils and mbtiles crates
2023-03-25 18:37:42 +00:00
Yuri Astrakhan
66b7fdc4ea
Multi-source support, new path structure (#456)
Partial implementation of the #430

* New endpoint structure:
  * `GET /` -- a placeholder for the future home page
* `GET /catalog` -- get a list of available sources, as a list of json
blobs.
* `[{id, name, description, attribution, vector_layer}, ...]` (some
fields might be missing)
* `GET /<id>` -- get tilejson for the given source, or a combination of
sources. No `.json` extension
  * `GET /<id>/<z>/<x>/<y>` -- get a tile. No format extension.
  * `GET /health` -- healthcheck
* Introduce a new tile format support crate (using code from the
maplibre/mbtileserve project)
* Removed the `/rpc/...` routes - all source IDs are accessed in the
same way
* Can print auto-generated configuration or save it to a file
* Refactored to support multiple sources from multiple backends, with a
proper naming conflict resolution

TODO:
* benchmarks need to be rewritten - they were relying on some internal
structures that are no longer there. This might be done as a separate PR
due to a very different internal architecture - might need to rethink
benchmarking approaches.
2022-11-26 04:46:40 -05:00