maplibre/martin

Add support for tile, sprite, and font source aliasing

Open

#1,076 opened on Dec 16, 2023

 (0 comments) (5 reactions) (0 assignees)Rust (377 forks)auto 404
confighelp wantedrust

Repository metrics

Stars
 (3,761 stars)
PR merge metrics
 (PR metrics pending)

Description

Martin allows users to specify multiple comma-separated sources and expect it to work like a single source.

type URL
TileJSON /{source1},...,{sourceN}
Tiles /{source1},...,{sourceN}/{z}/{x}/{y}
Sprites /sprite/<sprite_id1>,<sprite_id2>,...,<sprite_idN><suffix>Where the suffix could be .png, .json, @2x.png, @2x.json
Fonts /font/{name1},…,{nameN}/{start}-{end}

Proposal

Server configuration should allow administrator to configure "aliases" - predefined composite sources, where the client would not be aware that the source actually consists of multiple sources combined on the fly.

Configuration

For tile sources, the configuration would look like this:

aliases:
  my_source:  # name of the alias
    sources:
      # List of sources that should be combined, in the order they should be combined.
      # Listing just one source effectively creates a redirect to an existing source.
      # The list must not reference any other aliases.
      - source1
      - source2
      - source3

For sprites and fonts, the configuration would look like this (note the aliases key is under sprites). The fonts would be similar.

sprites:
  aliases:
    my_sprite:  # name of the sprite alias
      sources:
        # list of sprite sources that should be combined.
        # The list must not reference any other aliases.
        - sprite1
        - sprite2
        - sprite3
  # The rest is the regular sprite configuration as exists now
  paths:
    # all SVG files in this dir will be published as a "my_images" sprite source
    - /path/to/my_images
  sources:
    # SVG images in this directory will be published as a "my_sprites" sprite source
    my_sprites: /path/to/some_dir

Contributor guide