App 2.39.0, server 2.7.0: Grid with map

A new Overview style: the Grid over the roads round the car from
OpenStreetMap, drawn in the floor's perspective, heading up, the bigger
roads glowing brighter, the car as a chevron.

Server: POST /v1/map/roads {z:14,x,y} fetches a tile's drivable roads
from Overpass (OVERPASS_URL; one request at a time, at least a second
apart), simplifies them to tile-local points in four classes, caches
them for 30 days and never logs the tile.

App: MapRoads keeps the 3x3 tiles round the car from its own cache or
the server; GPS only while the style is shown; bearing from the GPS or
from successive positions. Without GPS, server or roads the plain floor
says why. OSM attribution on screen and in LICENSE.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LhzAVaUyqcw5PkGjz4mWW6
This commit is contained in:
2026-10-26 23:34:21 +01:00
co-authored by Claude Opus 5.5
parent 776a11b182
commit 65dc1ba847
24 changed files with 1312 additions and 18 deletions
+19 -1
View File
@@ -34,6 +34,7 @@ type config struct {
forgeURL string
forgeRepo string
forgeToken string
overpassURL string
}
// loadConfig reads the environment and fails closed: a missing InfluxDB setting or a
@@ -51,6 +52,7 @@ func loadConfig(getenv func(string) string) (config, error) {
forgeURL: getenv("FORGE_URL"),
forgeRepo: getenv("FORGE_REPO"),
forgeToken: getenv("FORGE_TOKEN"),
overpassURL: getenv("OVERPASS_URL"),
}
if c.listenAddr == "" {
c.listenAddr = ":8080"
@@ -73,6 +75,18 @@ func loadConfig(getenv func(string) string) (config, error) {
if c.forgeURL != "" && !strings.HasPrefix(c.forgeURL, "https://") {
return config{}, errors.New("FORGE_URL must be an https URL")
}
// The map's roads come from an Overpass API: the public one unless another is named, none
// with "off". Only https, like the forge.
switch c.overpassURL {
case "":
c.overpassURL = DefaultOverpassURL
case "off":
c.overpassURL = ""
default:
if !strings.HasPrefix(c.overpassURL, "https://") {
return config{}, errors.New("OVERPASS_URL must be an https URL or \"off\"")
}
}
if c.approvalPass != "" && len(c.approvalPass) < minApprovalPasswordLength {
return config{}, fmt.Errorf("APPROVAL_PASSWORD must be at least %d characters", minApprovalPasswordLength)
}
@@ -102,6 +116,9 @@ func main() {
releases := &Releases{ForgeURL: cfg.forgeURL, Repo: cfg.forgeRepo, Token: cfg.forgeToken}
api := &API{Store: store, IngestToken: cfg.ingestToken, Pairing: pairing, Handoff: NewHandoff(),
Releases: releases, PublicURL: cfg.publicURL}
if cfg.overpassURL != "" {
api.Maps = NewMaps(cfg.overpassURL, mapUserAgent)
}
srv := &http.Server{
Addr: cfg.listenAddr,
@@ -116,7 +133,8 @@ func main() {
defer stop()
go func() {
slog.Info("listening", "addr", cfg.listenAddr, "bucket", cfg.influxBucket,
"pairing", pairing.Enabled(), "pairedDevices", len(devices), "appUpdates", releases.enabled())
"pairing", pairing.Enabled(), "pairedDevices", len(devices), "appUpdates", releases.enabled(),
"maps", api.Maps != nil)
if err := srv.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
slog.Error("server failed", "error", err)
os.Exit(1)