Skip to content

Add scripts to export & serve map style preview

James Westman requested to merge jwestman/gnome-maps:map-style-preview into main

exportMapStyle.js exports the map style as JSON and creates a MapLibre GL JS-based preview site. This is useful for sharing updates without requiring people to build a branch, testing whether unexpected behavior is the result of a libshumate bug, and easily viewing changes as you work. The preview has the symbolic icons, but not highway shields.

serveMapStyle.js uses libsoup to serve the generated preview site. It uses Gio.FileMonitor to watch for changes to the src/mapStyle and scripts/map-style-web directories and rebuild the style, and uses websockets to tell the page to reload.

The config object used when constructing the map style JSON now has a renderer variable, so we can work around libshumate or MapLibre specific behavior.

Merge request reports