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
git lfs install
git lfs pull
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. The default launcher is the editable authoring server.
Pass -ReadOnly for a deployment-style preview. In read-only mode run.ps1
uses Caddy when server/caddy.exe is present and falls back to serve.py, so
the Caddy download is optional — see Serving.
Source PSDs and archives are stored through Git LFS. Run git lfs install
before cloning and git lfs pull if a checkout contains pointer files.
Documentation
| DOCUMENTATION.md | Full technical reference — architecture, coordinate systems, config, traps, troubleshooting |
| docs/adding-a-map.md | Step-by-step runbook for adding a map |
| PLAN.md | Project status and remaining work |
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 -> original and optional permanently trimmed tiles
build.py orchestrator; also writes web/data/world.json
preview.py stitch built tiles into one overview image
place_preview.py gridded base map for positioning maps
retilt.py change world.rotate, keeping placements
common.py config loading + world placement maths
server/serve.py dependency-free static server with sane cache headers
web/ the site: index.html, app.js, style.css, vendored Leaflet
sources/ Git LFS — layered source artwork
build/ gitignored — intermediate PNGs
web/tiles/ gitignored — generated original tiles
web/tiles-trimmed/ gitignored — generated permanently trimmed tiles
How the shared canvas works
The base is sources/overall/overall.jpeg, rotated 45° so north is up.
(An aspect-ratio fit of the Customs zone outline suggested 31°, but the zone
polygon encloses more than the playable strip so that estimate ran low; 45°
is the current visual starting point. Adjust with tools/retilt.py, which converts
every placement through the old and new angles so geography is preserved.)
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. Main maps default to minZoom: 0, so they remain
visible in the overview. Nested detail maps can set a later minZoom and only
appear as you zoom in.
Interactive placement
Select a detail map, choose Edit placement, then drag its yellow center
anchor or enter exact X/Y values. Width and Height can be changed independently
to stretch the map horizontally or vertically around that anchor. All changes
preview live without rebuilding. Save & rebuild writes the new geometry to
maps.json, rebuilds only that map, and reloads its versioned tiles. The normal
project launcher starts the writable local server:
pwsh server/run.ps1 -Port 8081
Use -ReadOnly for a deployment-style preview. In that mode the authoring
controls are hidden and every write API returns 403. The editable server is
intended only for a trusted local machine or private admin access; exported
static viewers remain read-only and use the separate local-marker mode below.
Static-site export
On the editable server, choose Export site ZIP to create and download
exports/tarkov-map-static.zip. The archive contains only the finished web/
document root plus a small export manifest; it does not include Python, PSDs,
build tooling, editable APIs or marker backup snapshots. Extract the ZIP into a
static host's document root and put that host behind Cloudflare. The bundled
capability file keeps map geometry and all published files read-only.
The exported viewer still allows visitors to edit markers. Published marker
files (including the canonical marker edits made through the editable Python
server) are cached per map in the browser. Visitor additions, moves, renames,
category changes and deletions are stored only in that site's localStorage;
the static host receives no write request. Reset this map discards the
selected map's browser-local changes and refetches the latest published marker
files. Local marker changes survive refreshes and browser relaunches, but remain
specific to that browser, device and site origin.
Placement mode renders the selected map at 50% opacity so landmarks on the overall map remain visible underneath it.
Playable-area trimming
Select a detail map and choose Trim area. Click around the playable boundary
to add polygon points; drag any yellow point to refine it. The Outside
transparency slider controls how strongly the unplayable portion fades while
the polygon interior remains fully opaque. Save trim stores normalized
polygon points in maps.json, leaves build/<id>/base.png and the original
tile pyramid untouched, and writes a separate permanent build/<id>/trimmed.png
plus web/tiles-trimmed/<id>/ pyramid. The normal viewer loads that rasterized
copy; only the editor uses a temporary live mask for previewing unsaved edits.
Trim saves use a trim-only build, so they do not regenerate the original tiles.
Map navigation and active-map detection are recalculated from the saved trim
polygon, rather than continuing to use the untrimmed rectangular canvas.
Semantic marker layer
Markers toggles a real Leaflet data layer; no PSD marker artwork is placed
over the tiles. tools/extract_markers.py reads visible on-map PSD layer
metadata, ignores legends and title furniture, classifies and deduplicates
markers, and writes normalized records to web/data/markers/<map-id>.json:
python tools/extract_markers.py
python tools/extract_markers.py --source-root C:/path/to/source-checkout
python tools/backup_markers.py
python tools/render_marker_audit.py --source-root C:/path/to/source-checkout
The audit command flattens every visible PSD layer and writes a side-by-side reference/semantic comparison for each map. Use it after extraction to catch legend copies, off-map records, missing extract names and role mismatches.
Every map uses the same configurable symbols, colors and labels. Open Marker categories to show or hide individual categories; those choices and the main toggle are persisted in local browser storage. Hovering a marker shows its name, category and source map.
Edit web/data/marker-config.json to change category grouping, color, size,
symbol (including emoji), visible text, default visibility, or the zoom at
which text labels appear. The viewer builds a world-space grid index and only
fetches only the focused parent/sub-map family, unloads the previous family,
and creates markers only in the padded viewport. Selecting Customs therefore
loads customs.json and customs-dorms.json; selecting Shoreline loads
shoreline.json and shoreline-resort.json. gridSize and viewportPadding
in the config tune the viewport index.
Extracts and transits are enabled by default, use larger high-stacking symbols, and reveal labels earlier than ordinary markers. Bulk spawn, loot, key, cache and location categories begin hidden to keep the main map readable.
Visible labels are laid out against the current viewport, nearby marker icons and the open control panel. Crowded labels move to the nearest free position; when that position is no longer adjacent, a leader line connects the label to its marker. Extract labels receive placement priority.
With the editable server running, select a map and open Marker edit. Click
an existing marker to rename it or change its category, drag it to save a new
position, delete it, or choose Drop new marker and click inside the selected
map.
Manual changes are written to web/data/marker-edits/<map-id>.json as compact
overrides, additions and deleted-marker IDs. The generated file under
data/markers/ remains untouched, so deletion is reversible.
tools/backup_markers.py snapshots every generated map file into
web/data/marker-defaults/. Existing snapshots are never overwritten and the
backup files are marked read-only. The viewer and editable server do not write
to that directory.
No black gaps
The base map is the backdrop. It is 85 tiles / 0.3 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.
Cache busting
Tile paths are stable across rebuilds but their contents are not — move a map's
place and tiles/<id>/6/17/33.webp becomes different imagery. Tiles are
served immutable for a week, so a browser that saw the old build would blend
it with the new one and show duplicated, offset terrain.
Each map therefore carries a version in world.json — a hash of its
geometry, zoom range and source file stamp — appended to every tile URL as
?v=. Re-tile a map and it simply gets fresh URLs. Identical rebuilds keep the
same version, so nothing is re-downloaded needlessly.
Stacking
Placements are approximate, so map rectangles overlap where the real locations
don't. Baseline order puts the finer map on top (by maxNativeZoom, then
smaller footprint), and on top of that the map whose centre you are viewing
is lifted above all others — so an overlapping neighbour can never hide the
map you came to see.
Current maps
Base: overall.jpeg 1308 × 1296 → 1842 × 1842 rotated → world 117 824 × 117 824.
| Map | PSD | Base layers |
|---|---|---|
| Customs | 7832 × 5016 | LOCATION |
| Customs — Dorms | 4301 × 4904 | LOCATION |
| Woods | 7680 × 5168 | re3mr.com/Map&Art/Map&OverlayArt/{RawMapLayer,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 | Map - 3D map portion… |
There is no shared naming convention between these PSDs — see docs/adding-a-map.md.
Tile resolution and sharpness
World maxZoom is 9, set so the whole 117 824 px world fits the pyramid. Each
map is tiled only to its own native level — the deepest zoom still
downscaling its source — recorded as maxNativeZoom in world.json. The base
map is native at z3; detail maps land at z7–z9.
Those ceilings are real: Customs' embedded terrain smart object is exactly 7832 × 3720 placed 1:1, so there is no hidden detail to recover. Past a map's native level the browser upscales.
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 |
|---|---|---|
| below native | 0.56 | 1.33 |
| at native | 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.
Past a map's native level you are beyond its source resolution and the browser
upscales — unavoidable, and ZOOM_HEADROOM deliberately allows one level of it.
Serving
Two read-only options, both selected with server/run.ps1 -ReadOnly:
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.
Tile responses are cached for one year and marked immutable. Versioned tile
URLs make that safe after rebuilds and let a CDN serve repeat requests without
returning to the origin VPS.
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.