Sprite Sources
-Given a directory with SVG images, Martin will generate a sprite – a JSON index and a PNG image, for both low and highresolution displays. The SVG filenames without extension will be used as the sprites’ image IDs (remember that one sprite and thus sprite_id
contains multiple images).
+
Given a directory with SVG images, Martin will generate a sprite – a JSON index and a PNG image, for both low and highresolution displays.
+The SVG filenames without extension will be used as the sprites’ image IDs (remember that one sprite and thus sprite_id
contains multiple images).
The images are searched recursively in the given directory, so subdirectory names will be used as prefixes for the image IDs.
For example icons/bicycle.svg
will be available as icons/bicycle
sprite image.
The sprite generation is not yet cached, and may require external reverse proxy or CDN for faster operation. @@ -208,6 +209,16 @@
Sprite index
+Coloring at runtime via Signed Distance Fields (SDFs)
+
If you want to set the color of a sprite at runtime, you will need use the Signed Distance Fields (SDFs)-endpoints.
+For example, maplibre does support the image being modified via the icon-color
and icon-halo-color
properties if using SDFs.
SDFs have the significant downside of only allowing one color. +If you want multiple colors, you will need to layer icons on top of each other.
+The following APIs are available:
+-
+
/sdf_sprite/<sprite_id>.json
for getting a sprite index as SDF and
+/sdf_sprite/<sprite_id>.png
for getting sprite PNGs as SDF
+
Combining Multiple Sprites
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>
. No ID renaming is done, so identical sprite names will
diff --git a/using.html b/using.html
index e65a363fd..35e3213e2 100644
--- a/using.html
+++ b/using.html
@@ -189,6 +189,7 @@
Martin Endp
/{source1},…,{sourceN}
Composite Source TileJSON
/{source1},…,{sourceN}/{z}/{x}/{y}
Composite Source Tiles
/sprite/{spriteID}[@2x].{json,png}
Sprite sources
+/sdf_sprite/{spriteID}[@2x].{json,png}
SDF Sprite sources
/font/{font}/{start}-{end}
Font source
/font/{font1},…,{fontN}/{start}-{end}
Composite Font source
/health
Martin server health check: returns 200 OK
/{source1},…,{sourceN}
/{source1},…,{sourceN}/{z}/{x}/{y}
/sprite/{spriteID}[@2x].{json,png}
/sdf_sprite/{spriteID}[@2x].{json,png}
/font/{font}/{start}-{end}
/font/{font1},…,{fontN}/{start}-{end}
/health
OK