martin/tests/expected/given_config.yaml
Yuri Astrakhan a5c5505713
Add dynamic sprites support (#715)
Dynamically create image sprites for MapLibre rendering, given a
directory with images.

### TODO
* [x] Work with @flother to merge these PRs
  * [x] https://github.com/flother/spreet/pull/59  (must have)
  * [x] https://github.com/flother/spreet/pull/57
  * [x] https://github.com/flother/spreet/pull/56
* [ ] https://github.com/flother/spreet/pull/62 (not required but nice
to have, can upgrade later without any code changes)
* [x] Add docs to the book
* [x] Add CLI param, e.g. `--sprite <dir_path>`
* [x] Don't output `.sprites` in auto-genned config when not in use

### API
Per [MapLibre sprites
API](https://maplibre.org/maplibre-style-spec/sprite/), we need to
support the following:
* `/sprite/<sprite_id>.json` metadata about the sprite file - all coming
from a single directory
* `/sprite/<sprite_id>.png` all images combined into a single PNG
* `/sprite/<sprite_id>@2x.json` same but for high DPI devices
* `/sprite/<sprite_id>@2x.png`

Multiple sprite_id values can be combined into one sprite with the same
pattern as for tile joining:
`/sprite/<sprite_id1>,<sprite_id2>,...,<sprite_idN>[.json|.png|@2x.json|@2x.png]`.
No ID renaming is done, so identical names will override one another.

### Configuration
[Config file](https://maplibre.org/martin/config-file.html) and possibly
CLI should have a simple option to serve sprites. The configuration may
look similar to how mbtiles and pmtiles are configured:

```yaml
# Publish sprite images
sprites:
  paths:
    # scan this whole dir, matching all image files, and publishing it as "my_images" sprite source
    - /path/to/my_images
  sources:
    # named source matching source name to a directory
    my_sprites: /path/to/some_dir
```

Implement #705
2023-06-16 08:19:47 -04:00

124 lines
2.3 KiB
YAML

keep_alive: 75
listen_addresses: localhost:3111
worker_processes: 1
postgres:
default_srid: 4326
max_feature_count: 1000
pool_size: 20
tables:
MixPoints:
schema: MixedCase
table: MixPoints
srid: 4326
geometry_column: Geom
id_column: giD
bounds:
- -170.94984639004662
- -84.20025580733805
- 167.70892858284475
- 74.23573284753762
geometry_type: POINT
properties:
taBLe: text
points1:
layer_id: abc
schema: public
table: points1
srid: 4326
geometry_column: geom
minzoom: 0
maxzoom: 30
bounds:
- -180.0
- -90.0
- 180.0
- 90.0
extent: 4096
buffer: 64
clip_geom: true
geometry_type: POINT
properties:
gid: int4
points2:
schema: public
table: points2
srid: 4326
geometry_column: geom
minzoom: 0
maxzoom: 30
bounds:
- -180.0
- -90.0
- 180.0
- 90.0
extent: 4096
buffer: 64
clip_geom: true
geometry_type: POINT
properties:
gid: int4
points3857:
schema: public
table: points3857
srid: 3857
geometry_column: geom
minzoom: 0
maxzoom: 30
bounds:
- -180.0
- -90.0
- 180.0
- 90.0
extent: 4096
buffer: 64
clip_geom: true
geometry_type: POINT
properties:
gid: int4
table_source:
schema: public
table: table_source
srid: 4326
geometry_column: geom
minzoom: 0
maxzoom: 30
bounds:
- -180.0
- -90.0
- 180.0
- 90.0
extent: 4096
buffer: 64
clip_geom: true
geometry_type: GEOMETRY
properties:
gid: int4
functions:
function_zxy_query:
schema: public
function: function_zxy_query
minzoom: 0
maxzoom: 30
bounds:
- -180.0
- -90.0
- 180.0
- 90.0
function_zxy_query_test:
schema: public
function: function_zxy_query_test
minzoom: 0
maxzoom: 30
bounds:
- -180.0
- -90.0
- 180.0
- 90.0
pmtiles:
sources:
pmt: tests/fixtures/files/stamen_toner__raster_CC-BY+ODbL_z3.pmtiles
sprites:
paths: tests/fixtures/sprites/src1
sources:
mysrc: tests/fixtures/sprites/src2