App 2.39.1, server 2.8.0: map roads from OpenFreeMap, on demand
The public Overpass answered 429/502 and needs ~40 s a tile while the car gives up after 8 s, so the server cancelled its queries and the car's retries added load. Now the server fetches only the tiles a car asks for, as OpenStreetMap vector tiles from OpenFreeMap (MAP_TILES_URL), decodes the transportation layer with a small reader of its own, and keeps each tile 30 days on a volume (MAP_CACHE_DIR). A fetch finishes even after the car has stopped waiting; the car hears 503 with Retry-After and gets the tile on its next try. App: OpenFreeMap/OpenMapTiles attribution on the map, retry after 15 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LhzAVaUyqcw5PkGjz4mWW6
This commit is contained in:
+2
-2
@@ -34,8 +34,8 @@ android {
|
||||
applicationId "com.stinnesbeck.nilsmg4"
|
||||
minSdk 27
|
||||
targetSdk 36
|
||||
versionCode 142
|
||||
versionName "2.39.0"
|
||||
versionCode 143
|
||||
versionName "2.39.1"
|
||||
|
||||
// Nothing about the server ships in the APK: its URL and ingest token are entered in
|
||||
// the app's Server tab (ServerConfig), and the database is only reachable by the server.
|
||||
|
||||
@@ -296,14 +296,14 @@ final class GridView extends ClusterCanvasView {
|
||||
caption(c, why, w / 2f, horizon + (h - horizon) * 0.2f, u, Paint.Align.CENTER);
|
||||
}
|
||||
|
||||
/** OpenStreetMap's licence asks for its name wherever its data is shown. */
|
||||
/** The tiles' and the data's licences ask for their names wherever the map is shown. */
|
||||
private void drawAttribution(Canvas c, float w, float h, float u) {
|
||||
text.setTypeface(label);
|
||||
text.setTextSize(12f * u);
|
||||
text.setTextAlign(Paint.Align.RIGHT);
|
||||
text.setStyle(Paint.Style.FILL);
|
||||
text.setColor(dim);
|
||||
c.drawText("© OpenStreetMap contributors", w - 26f * u, h - 80f * u, text);
|
||||
c.drawText("OpenFreeMap © OpenMapTiles · © OpenStreetMap contributors", w - 26f * u, h - 80f * u, text);
|
||||
}
|
||||
|
||||
// ---------- Top ----------
|
||||
|
||||
@@ -49,7 +49,8 @@ final class MapRoads {
|
||||
private static final String TAG = "MapRoads";
|
||||
private static final int DISK_TILES = 400;
|
||||
private static final long DISK_AGE_MS = 30L * 24 * 60 * 60 * 1000;
|
||||
private static final long RETRY_MS = 60_000L;
|
||||
/** A tile the server did not have yet (it goes on fetching) is asked for again after this. */
|
||||
private static final long RETRY_MS = 15_000L;
|
||||
/** A fix older than this is not drawn from. */
|
||||
static final long FIX_FRESH_MS = 15_000L;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user