feat: probe-based style discovery, topo style variant#143
Merged
Conversation
Rename standard style to color-relief (reflects its actual content), add new topo variant (color-relief hidden, gray background, vector-only), and replace the hardcoded 3-button style switcher with a dynamic control driven by the maplibreStyles array in map.json. Legacy maps with only the single maplibreStyle string still work via frontend fallback.
- Backend: map.json now emits `"maplibre": true` instead of a `maplibreStyles` array. Remove mapStyleEntry struct and stylesPrefix(). - Frontend: getWorldByName() sets `_baseUrl` on all paths (local, pmtiles CDN, raster CDN) so tile/style URLs need no special-casing. pmtiles CDN response forces `maplibre: true` (subdomain is the signal). - Frontend: initMap() builds style candidates from _baseUrl + known filenames. L.Control.MaplibreStyles probes each with HEAD, shows buttons only for styles that exist, hides control if ≤1 available. - Cloud cascade fixed: local → pmtiles CDN → raster CDN → placeholder.
Merging this branch will increase overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
maplibreStylesarray withmaplibre: trueboolean flag inmap.json_baseUrlon world objects — set for all sources (local, pmtiles CDN, raster CDN) — eliminating cloud vs local branching for tile and style URLsgetWorldByName()cloud cascade: local → pmtiles CDN → raster CDN → placeholdermaplibre: true(subdomain implies MapLibre support, since both CDNs serve identicalmap.jsoncontent)Changes
Backend (
internal/maptool/)mapJSONusesMaplibre boolinstead ofMaplibreStyles []mapStyleEntry. RemovedmapStyleEntrystruct. Styles stage just writes files, setsjob.HasMaplibre = trueHasMaplibre boolreplacesMaplibreStylesonJob. RemovedstylesPrefix()methodStyleStandard→StyleColorRelief, newStyleTopowithbuildTopoLayers()color-relief.jsoninstead ofstandard.jsonFrontend (
static/)getWorldByName(): All paths set_baseUrl(local:images/maps/{world}, pmtiles CDN:https://pmtiles.ocap2.com/{world}, raster CDN:https://maps.ocap2.com/{world}). pmtiles CDN forcesmaplibre: trueinitMap(): Tile URLs and style candidates derived fromworld._baseUrl— no cloud vs local branching.useMapLibreModechecksworld.maplibreor legacyworld.maplibreStyleTest plan
go test ./internal/maptool/...passesmap.jsonhas"maplibre": trueand nomaplibreStylesmaplibreStylestring still work