Commit Graph

105 Commits

Author SHA1 Message Date
Frank Elsinga
2cc5175b35
fix docs typo (#1597) 2024-11-25 12:21:11 -05:00
Frank Elsinga
b134cb2bc6
Add sdf sprite support with /sdf_sprite/... endpoint (#1492)
Given a set of SVGs as a sprite source X, Martin will now generate two endpoints: `/sprite/X` and `/sdf_sprite/X`, with the second endpoint serving [signed distance field](https://en.wikipedia.org/wiki/Signed_distance_function) images.

Closes #1075
2024-10-22 12:49:36 -04:00
Frank Elsinga
554ee0f0c7
docs: better differentiation between image_id and sprite_ids (#1491)
made sure that the differences between image and sprite ids is clearer

The rationale is that I got stuck here for a bit and got quite confused.
After reading the sourcecode, this was much clear.

I am a bit too explicite on purpose, feel free to (ask to)
revert/reduce/rewrite as you see fit. Docs are never written alone ^^
2024-08-29 22:55:55 -04:00
Frank Elsinga
387f0f3ae1
chore(docs): tried to document the --base-path option better (#1420)
As noted, the option could likely be more explicite in what it does

Resolves https://github.com/maplibre/martin/issues/1415
2024-07-15 11:24:28 -04:00
paigewilliams
7f18b6bbf2
add web UI placeholder (#1395)
Add an optional web UI interface for Martin, including docker-based cross-compilation support.  The UI itself is a placeholder with a logo, but will grow in subsequent PRs.

This was branched off of https://github.com/maplibre/martin/pull/1142 to
address the PR feedback from @nyurik .

---------

Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
Co-authored-by: Tomer Ronen <tomer207@gmail.com>
Co-authored-by: tomeronen <45331634+tomeronen@users.noreply.github.com>
2024-07-14 13:39:29 -04:00
Yuri Astrakhan
7446f54bc1
Minor lints (#1412) 2024-07-11 10:04:58 -04:00
Kacper Golinski
1a2e381043
add HEALTHCHECK instruction to the Dockerfile (#1397)
Since Martin gives us `/health` endpoint we could use it by default in
the Dockerfile.

I've added extra info to the doc about
https://github.com/willfarrell/docker-autoheal but not sure if that's
ok. I can remove it.
2024-07-03 17:35:57 -04:00
Mat_
d270e8fb42
Create run-with-apache.md (#1394)
I've created a page as simple as I could. Feel free to tell me if you
want me to change anything.

---------

Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
2024-07-02 18:59:04 -04:00
Yuri Astrakhan
3e7c7e52d8 Fix sample data download links 2024-06-29 13:52:36 -04:00
Teebo
b814ac0f96
fix curl url for linux mbtiles demo (#1387)
Co-authored-by: tbo47 <thibaut@edwardscongroup.com>
Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
2024-06-29 13:49:49 -04:00
Josh Lee
e939b388b8
Typo fix (#1388)
I'm torn between "Run this bash script to create this file" and "The
file should look like this" and open to ideas for clarity, but I think
adding the backslash is more likely to be noticed by someone who creates
the file without using the heredoc than the other way around.

Fixes #1335
2024-06-28 11:51:58 -04:00
Lucas
9b55f92634
Update quick-start-qgis.md (#1382) 2024-06-25 12:43:44 -04:00
Oquile
374525f8ef
Update quick-start-linux.md (#1380)
Curl fails to follow redirects by default. 
Adding `-L` instructs it to follow them and allows Marlin to be
downloaded.
2024-06-25 02:43:54 -04:00
Yuri Astrakhan
fbb1a86b24 fix docs download link2 2024-05-26 07:43:36 -04:00
Yuri Astrakhan
15a5402e55 fix docs download link 2024-05-26 07:40:52 -04:00
Lucas
a9cb0c972f
Adjust readme and martin book (#1253)
Fixes #1245

Large book and README refactoring, adding quick started section, list of available features to the README, and moving most of the content from README to the book.

---------

Co-authored-by: Yuri Astrakhan <YuriAstrakhan@gmail.com>
2024-05-26 07:06:28 -04:00
Yuri Astrakhan
81f4d4cd03
Switch default encoding to gzip for now (#1260)
GZip is significantly faster, so for now lets use that until brotli
project gains some performance, and until we get proper
after-compression caching.
2024-05-25 05:51:04 +00:00
Hidde Wieringa
a9d8edc76d
Update documentation for running with Docker Compose (#1283)
Some small changes to make the Docker compose documentation up to date:
- Update dependency versions of PostGIS and Martin
- Use the bundled `docker compose` extension, not `docker-compose`. (see
https://docs.docker.com/compose/migrate/#docker-compose-vs-docker-compose)
- Remove `version` from the Docker Compose file (see
https://docs.docker.com/compose/compose-file/04-version-and-name/)
2024-03-30 17:11:47 +00:00
Yuri Astrakhan
7107db5887
Fix apply-patch documentation (#1261) 2024-03-18 09:17:30 +08:00
Yuri Astrakhan
51d52ba236
fix broken links, reformat markdown (#1257)
Fixes #1252
2024-03-16 18:32:20 -04:00
Yuri Astrakhan
60ae6cf168
chore: rename agg_tiles_hash_in_diff to agg_tiles_hash_after_apply (#1243)
This is just a documentation change - the actual value stored in the
mbtiles was always `agg_tiles_hash_after_apply`, but accidentally the
constant in the code was not renamed, nor were the docs updated.
2024-03-11 04:29:50 -04:00
Lucas
99cd99eb51
Add --base-path CLI option to override the URL path in the tilejson (#1205)
Override URL path in the tilejson's `tiles` field when used behind a proxy that is not setting `X-Rewrite-URL` header

Fixes #1185
2024-02-27 16:10:29 +00:00
Yuri Astrakhan
16a54e1c33
Use --locked with cargo install (#1216)
This will prevent installation issues in case dependencies break semver
promise

Fixes #1211
2024-02-27 15:40:20 +08:00
Lucas
3e30c438bb
Add --preferred-encoding (gzip|brotli) to use when tile is not pre-encoded by source (#1189)
Try to fix #1178 

- [x] Add optional `--preferred-encoding` to cli, `br` `brotli` and
`gzip` are allowed
- [x] Add optional `preferred-encoding` to config, `br` `brotli` and
`gzip` are allowed
- [x] Add test
- [x] Update doc
2024-02-19 19:21:37 +08:00
Yuri Astrakhan
7421a99c83
feature: improve diff cmd with copy opts (#1183)
* add most of the `mbtiles copy` options to the `mbtiles diff` command
* reworked the book
2024-02-08 00:35:31 -05:00
Lucas
79a89125ed
Add mbtiles diff command (#1068)
Implement `mbtiles diff a.mbtiles b.mbtiles diff.mbtiles` command

This should behave exactly the same as `mbtiles copy a.mbtiles
--diff-with-file b.mbtiles diff.mbtiles`.

---------

Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
2024-02-08 03:08:47 +00:00
Lucas
04e53a7577
Update mbtiles-copy.md (#1181)
Update `apply-diff` to  `apply-patch` in `mbtiles-copy.md`
2024-02-07 03:00:51 -05:00
Yuri Astrakhan
bdce8bb592 Update AWS Lambda docs 2024-02-02 00:52:06 -05:00
Josh Lee
9f9f18163c
Add AWS Lambda support (#1127)
This adds the lambda-web crate to adapt the actix App to speak to Lambda
by way of the lambda_runtime crate.

AWS Lambda has native support for scripting languages to
execute a function directly; compiled languages must embed a runtime to
fetch incoming events from Lambda and post the responses. This detects
the environment variables to start up in Lambda mode instead of the
normal HTTP server, and is added as an optional feature.

Lambda has five (!) distinct ways of routing HTTP requests to a
function; this supports some of them. (Specifically, the most obvious
way to do this is with a Function URL, which is newest and simplest, and
perhaps with CloudFront, which speaks to the Function URL and not Lambda
directly.)

The error handling could probably be refined, I was just trying to get
this to compile.

(Supported: API Gateway HTTP API with payload format version 2.0; API
Gateway REST API; Lambda function URLs / Not supported: API Gateway HTTP
API with payload format version 1.0; Application Load Balancer)

Necessary for #1102 to be able to run the released packages directly,
and only having to configure the appropriate environment.

---------

Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
2024-02-01 18:56:40 +00:00
Lucas
72a0a5dfbb
Add using-with-openlayers document (#1150)
Try to help #1132

---------

Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
2024-01-24 16:49:58 -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
4f7487b448
Deprecate few things, lock and lints (#1111)
* Remove `CA_ROOT_FILE` env var support (has been deprecated for a
while)
* Remove `WATCH_MODE` env var warning - has not been in use since a long
time ago
* minor lints/clippy suggestions, lock update
2023-12-30 12:47:23 -05:00
Yuri Astrakhan
61d3286815
Lots of small refactorings (#1107)
* Use `Option<&T>` instead of `&Option<T>` in function arguments.
* Cleaner var names
* Slight optimization of `get_tile` with query params
* Split up srv/server.rs into fonts, sprites, tiles, and tiles_info
files
* better error reporting in tests
2023-12-26 07:43:47 +00:00
Yuri Astrakhan
4bf206bd7f doc links 2023-12-25 01:49:39 -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
1a8e7c89a4
Implement http pmtiles (#991)
PMTiles is a web-optimized format, allowing the actual file to be read
with HTTP range requests. Supporting this use case instantly allows
Martin to function as a lambda executable accessing PMTiles, but without
any significant investment into devops or hosting large file.

PMTiles config now also allows `http` and `https` protocol.

```
# Publish PMTiles files
pmtiles:
  paths:
    # specific pmtiles file will be published as mypmtiles source
    # (use last portion of the URL without extension)
    - http://example.org/path/to/mypmtiles.pmtiles
  sources:
    # named source matching source name to a single file
    pm-src1: https://example.org/path/to/some_pmtiles.pmtiles
 ```

fixes #884

---------

Co-authored-by: Kyle Slugg-Urbino <35903887+kyleslugg@users.noreply.github.com>
2023-12-22 06:01:50 +00:00
Yuri Astrakhan
f88db05582
Fix SQL comments when func or table is pre-configured (#1045)
When a SQL comment is set on a table or a function to customize
tilejson, and that tbl/func is pre-configured as part of the config
file, the comment was silently ignored. Now both table and function
cases are handled correctly.

Also, update docs to not include function parameters - makes SQL example
a bit simpler.

Thanks @jjcfrancisco for reporting!

Fixes: #1044
2023-12-07 07:24:51 +00:00
Yuri Astrakhan
afc0fb8977 update doc version 2023-12-05 23:47:04 -05:00
Lucas
4814d3369c
Add Markdown linting and url check to CI and justfile (#1030)
Fix #979 with
[markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) and
[markdown-link-check](https://github.com/actions-marketplace-validations/gaurav-nelson_github-action-markdown-link-check)

## Link check
- [x] Add link check to just clippy
- [x] Add relative links check with
[markdown-link-check](https://github.com/actions-marketplace-validations/gaurav-nelson_github-action-markdown-link-check)
- [x] Ignore `CHANGELOG.md`
- [x] Ignore `localhost` and `127.0.0.1`
- [x] Ignore `http://opensource.org`
- [x] Add to justfile

## Lintting

- [x] Add markdown linting
- [x] Add markdown lint to just fmt
- [x] Ignore `CHANGELOG.md`?
- [x] Ignore [Line
Length](https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md013.md)
- [x] Ignore [First line in a file should be a top-level
heading](https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md041.md)
- [x] Ignore [Inline
HTML](https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md033.md)
- [x] Ignore [Images should have alternate
text](https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md045.md)
- [x] Ignore [Heading levels should only increment by one level at a
time](https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md001.md)
- [x] Rename lint config file.
- [x] Add to justfile

---------

Co-authored-by: Yuri Astrakhan <YuriAstrakhan@gmail.com>
2023-12-04 22:11:03 +00:00
Yuri Astrakhan
aeb08c8b22
add agg-tiles-hash calc to martin-cp (#1033)
* Automatically computes `agg-tiles-hash` metadata value after copying
tiles
* Add a `--skip-agg-tiles-hash` option
2023-12-02 09:12:19 +08:00
Yuri Astrakhan
d311888f94
Update Docker build process (#1022)
* Fix docker file builds to use debian
* add a few more things to `.dockerignore`
* remove unused `martin` from docker-compose.yml
* delete unused arm64.Dockerfile

This should also fix #1021
2023-11-23 21:14:32 -05:00
Yuri Astrakhan
d6219a6526
Add compression and query to martin-cp (#1019)
* Use gzip compression for MVT tiles by default
* Allow user to set compression with `--encoding` parameter (same as
browser's header, e.g. use `br,gzip' to encode with brotli as first
choice, unless already encoded as gzip)
* Allow user to pass a query to the Postgres functions with
`--url-query`
* A bit of a cleanup for `mbtiles summary` output
2023-11-22 05:26:53 +00:00
Lucas
566e8fa948
Revert doc book links - may break a few new ones (#1018)
- [x] Remove chapter numbers
- [x] Update file name of `using-endpoints.md` back
- [x] Update links

---------

Co-authored-by: Yuri Astrakhan <YuriAstrakhan@gmail.com>
2023-11-21 08:06:27 +00:00
Yuri Astrakhan
c6a7ef67c9
Rename dst-type to mbtiles-type (#1014) 2023-11-20 17:38:28 -05:00
Lucas
0f13fb6504
Add cargo binstall support (#1012)
Try to fix #1005
- [x] Add cargo binstall support
- [x] Update links
- [x] Update [home-brew](https://github.com/maplibre/homebrew-martin) by
another [PR](https://github.com/maplibre/homebrew-martin/pull/8)
- [x] To check is there anything to do for `mbtiles`
2023-11-20 02:56:09 -05:00
Yuri Astrakhan
f88fd10aa8
Add martin-cp tool to bulk-copy tiles from any Martin-supported sources (#1011)
This adds a new utility called `martin-cp` that allows copying any
number of tiles from a single source (or a composite source) to an
mbtiles file.

`martin-cp` is a tool for generating tiles in bulk, and save retrieved
tiles into a new or an existing MBTiles file. It can be used to generate
tiles for a large area or multiple areas. If multiple areas overlap, it
will generate tiles only once. `martin-cp` supports the same
configuration file and CLI arguments as Martin server, so it can support
all sources and even combining sources.
2023-11-20 06:27:51 +00:00
Yuri Astrakhan
140ed25679
mbtiles improvements, minor changes (#1013)
# MBTiles
* New `--agg-hash (update|verify|off)` flag replaces
`--update-agg-tiles-hash` (still supported, but not shown in the help
screen). This allows bypassing aggregate hash validation entirely,
without either updating or validating it.
* Simplify MBTiles SQL generation
* MBTiles now uses faster `1 << zoom` everywhere, and a dedicated TMS
inversion fn
* split up metadata insert and delete into separate fn
* consolidated schema initialization
* ensure db settings (like pragma) are always reset on new files

# Other
* Always sort JSON-serialized keys for consistency
  * this affects `/catalog` key ordering, but content is the same
* Minor code cleanup
2023-11-19 10:06:37 +00:00
Yuri Astrakhan
b0e19d3787
Improve bbox formatting (#1001)
Formats bbox using the most appropriate precision for that zoom level
2023-11-13 08:53:15 +00:00
Yuri Astrakhan
021cddcccd
mbtiles summary tool cleanup (#1000)
After some thinking, it seems `mbtiles summary` (aliased as `mbtiles
info`) would be a bit better than stats. I renamed and adjusted
documentation, consolidating it in one doc page.

Other changes:
* use file system's file size, reporting 'unknown' if needed
* report page count
* moved bbox computation into a separate function
* inlined a number of things for readability
2023-11-13 07:50:10 +00:00
Lucas
0398336114
Add mbtiles statistics command (#986)
- [x] Add tile statistics to mbtiles tools
- [x] Add test
- [x] Use 4326 instead of 3857 for tile bounds
- [x] Add document
- [x] Use size-format to prettify output 
- [x]  Statistics  struct Refactor
- [x] Cleanup and reformat

Closes #964 

---------

Co-authored-by: Yuri Astrakhan <yuriastrakhan@gmail.com>
2023-11-13 06:03:40 +00:00