The canvas is no longer an abstract grid of unrelated cells. overall.jpeg is now the base, rotated 31 degrees so north is up, and every detail map is scaled and positioned onto its real location. Zoom out for all of Tarkov; zoom in and the full-resolution re3mr map takes over. The 31 degrees was measured, not guessed: Customs' detail map is north-up (its PSD compass confirms it) and runs 2.6:1 east-west, so solving its 259x207 zone outline for the band angle gives 31. rotate_point is verified sub-pixel against PIL. Adds Woods, Interchange, Reserve, Shoreline, Shoreline Resort, Lighthouse and Streets, and moves every source under sources/<id>/. baseGroup becomes baseLayers, a list of slash-paths. These PSDs share no naming convention at all -- the base is variously LOCATION, Baselayer, Day, 3DRENDER, BASEMAP+2DLAYERS or Map&Art; several need more than one top-level layer, and Woods buries its terrain three groups deep. Exports also keep alpha now, so maps composite onto the terrain instead of sitting in opaque rectangles. Placement needs sub-cell precision, but tile grids stay integral only when a map's origin is a multiple of tileSize * 2^maxZoom (131072 px). So rather than snapping a map to the grid, the tiler pads it up-and-left to the nearest cell boundary and visits only tiles holding content: exact placement, integral grid, no cost. Each map is tiled to its native level and carries a minZoom, so the overview stays cheap. Two psd-tools failures worked around: stroke effects on empty-bbox layers crash scikit-image (patched to skip), and psd_tools.composite exports a function that shadows its own submodule. Verified zoom 0-9: 10 layers, zero broken tiles. Co-Authored-By: Claude Opus 5 <[email protected]>
TarkovMap
Self-hosted, mobile-friendly Escape from Tarkov map viewer. Layered PSDs go in, a Leaflet tile pyramid comes out, and every map is placed onto one shared world canvas — the overall satellite map, rotated so north is up.
Zoom out for the whole of Tarkov; zoom into a location and the full-resolution re3mr map for it fades in over the terrain.
Only the base map art is extracted. Markers, spawns, legends, captions and titles are dropped during the render.
Quickstart
python -m pip install -r tools/requirements.txt
python tools/build.py
pwsh server/get-caddy.ps1
pwsh server/run.ps1
Open the printed URL. The LAN address works from a phone on the same network.
run.ps1 uses Caddy when server/caddy.exe is present and falls back to
serve.py otherwise, so the first step is optional — see Serving.
Source PSDs are not in the repo (see .gitignore) — get them from the shared
drive and put them under sources/.
Adding a map
See docs/adding-a-map.md. Short version: run
tools/psd_tree.py to find the group holding the art, add an entry to
maps.json, run tools/build.py. No application code changes.
Layout
maps.json the only thing you edit to add or change a map
tools/
psd_tree.py inspect a PSD's layer tree
export_base.py PSD -> build/<id>/base.png (base group only)
tile.py base.png -> web/tiles/<id>/{z}/{x}/{y}.webp
build.py orchestrator; also writes web/data/world.json
preview.py stitch built tiles into one overview image
common.py config loading + the world-grid maths
server/serve.py dependency-free static server with sane cache headers
web/ the site: index.html, app.js, style.css, vendored Leaflet
sources/ gitignored — source PSDs
build/ gitignored — intermediate PNGs
web/tiles/ gitignored — generated tiles
How the shared canvas works
The base is sources/overall/overall.jpeg, rotated 31° so north is up. That
angle was measured, not guessed: Customs' detail map is north-up (its PSD
compass says so) and runs 2.6:1 east–west, so solving its 259 × 207 zone
outline for the band angle gives 31°.
World pixels are overall-map pixels × overallScale (64), which puts Customs
at almost exactly its native 7832 px. Each map's place entry gives its centre
and width in rotated overall-map pixels, and the tiler scales it to match.
Tile grids must stay integral — a map's tile-index offset has to be a whole
number of tiles at every zoom, which only holds when its origin is a multiple
of tileSize · 2^maxZoom (131 072 px). Far too coarse to position anything. So
rather than moving a map onto the grid, the tiler pads it up-and-left to
the nearest cell boundary and only visits tiles containing real content. Exact
placement, integral grid, and the padding costs nothing.
Each map is tiled only down to its native level — the deepest zoom still
downscaling its source — and has a minZoom below which it doesn't load at
all. So the overview is just the base map, and detail maps appear as you go in.
No black gaps
The base map is the backdrop. It is 70 tiles / 0.2 MB, always resident, and Leaflet upscales it past its native z3 — so any gap while detail tiles load shows blurry terrain rather than the page background.
Current maps
Base: overall.jpeg 1308 × 1296 → 1790 × 1786 rotated → world 114 496 × 114 240.
| Map | PSD | Base layers |
|---|---|---|
| Customs | 7832 × 5016 | LOCATION |
| Customs — Dorms | 4301 × 4904 | LOCATION |
| Woods | 7680 × 5168 | re3mr.com/Map&Art/Map&OverlayArt/{RawMapLayer,MapBlackout,WaterDetail} |
| Interchange | 9600 × 5400 | 3DRENDER |
| Reserve | 5760 × 3240 | Day copy |
| Shoreline | 5760 × 3240 | Baselayer |
| Shoreline — Resort | 10694 × 6016 | BGCOLOR PATTERN, BASEMAP+2DLAYERS |
| Lighthouse | 8259 × 7560 | Day |
| Streets of Tarkov | 7605 × 4841 | Layer 1, Map - 3D map portion… |
There is no shared naming convention between these PSDs — see docs/adding-a-map.md.
Tile resolution and sharpness
maxZoom is derived from the largest map: ceil(log2(7832 / 256)) = 5. At z5
one source pixel is one CSS pixel, and z5 is the full PSD — verified by
reading the embedded terrain smart object, which is exactly 7832 × 3720 placed
1:1. There is no hidden detail to recover, so z5 is a hard ceiling.
Sharpness is therefore about level selection, not pyramid depth. Leaflet
picks its level with Math.round(mapZoom), so at zoom 2.25 it takes level 2 and
stretches it 1.19×. On a 150 %-scaled Windows display (devicePixelRatio 1.5)
that compounds to a 1.78× upscale — visibly soft.
DENSITY_BOOST in app.js fixes it: halve the CSS size of a tile and request
one level deeper, so we downscale a denser level instead of upscaling a coarser
one. Measured at devicePixelRatio 1.5, in source pixels delivered per device
pixel (higher is sharper, 1.0 is pixel-perfect):
| View zoom | Before | After |
|---|---|---|
| 0–4 | 0.56 | 1.33 |
| 5 (1:1 source) | 0.67 | 0.67 |
It costs ~4× the tiles in view (99 at the busiest level on a 1315 px viewport, ~17 KB each). Cached for a week and served by Caddy, that is a fair trade.
At z5 and beyond you are past the source resolution and the browser upscales —
unavoidable, and ZOOM_HEADROOM deliberately allows two levels of it.
Serving
Two options, both driven by server/run.ps1:
serve.py |
Caddy | |
|---|---|---|
| Dependencies | none (stdlib) | one 47 MB binary |
| conc 8 | 2,622 req/s · p95 4.0 ms | 6,987 req/s · p95 1.9 ms |
| conc 32 | 462 req/s · max 1,013 ms | 5,877 req/s · max 21 ms |
| ETags / compression | no | yes (zstd, gzip) |
Measured on loopback, 480 tile requests over reused connections.
The number that matters is the second row. serve.py is thread-per-connection
behind the GIL, so under load it doesn't just slow down — throughput falls and
tail latency goes past a second. Caddy stays flat. Use Caddy for anything real;
serve.py exists so a fresh clone works with nothing installed.
serve.py was also defaulting to HTTP/1.0, which closes the socket after
every response — one TCP handshake per tile, ~30 per map view. It now sets
HTTP/1.1, which is most of its improvement above.
Neither runs HTTP/2: browsers only negotiate h2 over TLS, and putting a trusted cert on every phone isn't worth it on a LAN. The Caddy win is Go's I/O, not h2.
To reach it from a phone, allow the port once (elevated):
netsh advfirewall firewall add rule name="TarkovMap 8080" dir=in action=allow protocol=TCP localport=8080
Licence
Map art is by re3mr.com under CC BY-NC-SA 4.0. Attribution is shown in the viewer and must stay there. Use is non-commercial, and derivative map images inherit the same licence. Local and LAN hosting is fine; get sign-off before hosting publicly.