Dokumentation · Siderne
The map: positions and outlines (K2)
Where a metering point lies, and the outlines it is drawn on. The owner's answer to Question 5 of
docs/design/proposal-2026-11-mix-styles-map.md (30 November 2026) is Fil: the owner's own
file of coordinates first, the postcode's midpoint as the automatic fallback, no geocoding service.
K1's research is docs/research/K1-map-platform.md; the background tiles (K3, K4b) are not here.
1. The position of a point
calc.mp_positions() (migration 0460, executable by elo_api) gives every metering point once:
precision_tag | x, y (EPSG:25832 metres) | reason | When |
|---|---|---|---|
exact | the owner's file's | NULL | the point is in the owner's file (core.mp_position) and its address is open |
postcode | the midpoint of its postcode | NULL | not in the file, its address is open, and its postcode is a geographic postcode of DAGI (ref.postcode_point) |
none | NULL | protected | its current master data withholds the address (below) |
none | NULL | no_master_data | the point has no current master-data version |
none | NULL | no_postcode | open, not in the file, and its postcode has no midpoint (a post-box or company code, which DAGI's geographic layer does not hold; a postcode wholly at sea) |
Nothing derived is stored: the tag is computed when asked. The page's words for the reasons are
K4a's (the proposal: adresse beskyttet for protected, mangler koordinat for the two others);
an unplaced point keeps its rank and is listed under Ikke på kortet (n) (N38).
Coordinates are EPSG:25832 (ETRS89 / UTM zone 32N), whole metres, everywhere: the table, the
function, the outlines. The background's tiles (Datafordeleren's View1) are in the same system,
so nothing is reprojected in the browser. A coordinate outside Denmark's extent (x 380 000-920 000,
y 6 020 000-6 420 000) is refused by the tables' checks.
The protected-address rule
A coordinate is an address (N4, §4.2 of the proposal). A point is placed, by its file or by its
postcode, only when its current master-data version has protected_name IS FALSE AND protected_address IS FALSE: the same test that lets core.mp_version hold a street. A point whose
name protection is not known (NULL, the list response) is not placed either. Three places hold
the rule:
calc.mp_positions()gives such a pointnone/protected, whatever is stored; 2. the import (core.replace_positions) does not store a coordinate for it, and counts it. It reads the protection under a lock (K2f3, K2v-02, migration 0462): it locks the points' current versionsFOR SHAREfirst, inmp_idorder, then reads them. The worker writes a new version after locking the current oneFOR UPDATE, so a race goes one of two ways. Either the import waits for that version and reads it, or the worker waits for the import's commit and the trigger (3) then deletes what it stored. A version held longer than 5 s refuses the import; 3. a trigger oncore.mp_versiondeletes the point's stored coordinate when a current version that is not open is written (the worker writes master data; the trigger runs with the owner's rights, the worker has no right oncore.mp_position).
The postcode of a protected point is stored by the master data as before (four digits, a town); it is never used to place the point.
The removal
make account-remove deletes the account's rows of core.mp_position (migration 0460 replaces
ops.remove_account with every clause of 0431 and this one) and names the table once in its
answer. ref.postcode_point is public data and references nothing.
2. The owner's file (make map-positions)
make map-positions FILE=<file> the file is the whole list
make map-positions CLEAR=1 every exact position removed
The file is read and checked on the host (elo_devtools.map_positions), then one transaction runs
in the stack's PostgreSQL as the owner of the data (as make set-price-area does). The stack must be
running.
Format. UTF-8 text (a byte-order mark is allowed), the first line names the columns, the
separator is the first line's (;, , or a tab). Columns in any order and case:
gsrn: 18 digits;latandlonin degrees (WGS 84 / ETRS89, what a map application shows), converted to EPSG:25832 by Krüger's series (under a millimetre across Denmark), orxandyin EPSG:25832 metres (what Danish registers give).
Any other column is allowed and never read. A decimal comma is read where the separator is not a
comma. Blank lines and lines beginning with # are skipped. Example (a spreadsheet saved as CSV):
Navn;GSRN;Lat;Lon
Rådhuset;579999000001010000;56,7489;8,8516
The whole list. The points the file names get its positions; every other point loses the position an earlier file gave. The demo's generated positions are of the other kind and are not touched by a file of the owner's (a database holds the demo or the owner's data, never both).
Refused, whole, nothing written (exit 3): a file that cannot be read, is larger than 50 MB or
holds more than 200 000 lines, is not UTF-8, has no header with gsrn and a pair of coordinates or
names a column twice, holds no point; a line with fewer fields than the header, a GSRN that is not
18 digits, a coordinate that is no number or lies outside Denmark (latitude and longitude swapped
are caught so), a GSRN given twice. Every faulty line is named by its number and its fault, the
first 20 and then a count.
Not stored, counted: a point whose address is withheld (above); a GSRN that is no point of the database (a removed account's, a typing error).
What is logged. Counts and line numbers, nothing else: no coordinate, no address, no GSRN, no
other value of the file appears in any line the command writes (tools/tests/test_k2_import.py
plants values and searches the output for them). Nor in the database's log (K2f3, K2v-01). No
value is in an SQL text: psql sends the GSRNs and coordinates as the statement's parameters
(\bind). The session, still the superuser's, turns its own statement and parameter logging off,
also on an error. psql prints an error's message alone, and core.replace_positions raises any
error of its own as elo-positions: not stored (<SQLSTATE>), without the detail that could quote
a row. A line whose quoting is broken is refused by its number; an extra column may be as long as
the file allows. For example:
map-positions: 22 line(s) read
map-positions: 19 stored, 0 removed; not stored: 2 whose address is protected or not known to be unprotected, 1 that are no metering point of this database
The file itself stays where the owner keeps it; the repository's .gitignore covers data/, the
place to keep it in a checkout.
3. The outline bundle (assets/dagi/): made, never in git (K2f)
The repository holds no national geographic data. assets/dagi/ is git-ignored but for its
README; the bundle is made by make dagi-bundle, and assets/dagi.sha256 (committed) names the
bundle the repository expects: the source's SHA-256, its address and file name, and one SHA-256
over the bundle's files.
| File | What | Size (bytes / gzipped) |
|---|---|---|
country.geojson | every municipality at 250 m (Douglas-Peucker per ring), properties k (code, three digits) and n (name): the overview, zoom 3-5 | 180 450 / 60 605 |
municipalities/<k>.geojson | each municipality at 25 m, one file each, all 99 of the extraction | 879-32 306 each (median 4.2 KB gzipped); 1.15 MB / 409 KB together |
postcodes.csv | postcode;name;x;y: the midpoint of the land of each geographic postcode (1 089) | 33 961 / 13 376 |
manifest.json | source, its SHA-256, its address, extraction date, tolerances, every file's size | |
ATTRIBUTION.md | the credit and the changes made |
Whole: 1.37 MB, 0.48 MB gzipped (K1 §6.1 predicted about 0.6 MB). GeoJSON with a crs member
naming EPSG:25832 (RFC 7946's WGS 84 rule is not followed, on purpose: see §1). The midpoint is the
centroid of the postcode's polygons intersected with the municipalities' (which end at the coast),
because DAGI's postcodes reach into the sea, some to the territorial limit, where a plain centroid
lies tens of kilometres out. Where that centroid is not on the postcode's land itself, the middle of
the longest stretch of land on the nearest of 64 lines across it.
No file singles out an install's municipalities: every municipality has its file; which ones a page draws is decided from the install's own points at run time.
Making it (make dagi-bundle)
- Without
SOURCE(whatmake demo,make demo-static,make stack-checkandmake releaserun first, andmake upin its soft form, below): nothing whenassets/dagi/is the bundleassets/dagi.sha256names. Otherwise the bundle is built from the pinned source, taken from the cache ($ELO_CACHE_DIR/dagi, else$XDG_CACHE_HOME/elo/dagi, else~/.cache/elo/dagi) or **fetched once from github.com: 186 796 799 bytes**, kept only when its SHA-256 is the pinned one. Measured on 30 November 2026: 52 s with an empty cache (the download and 28 s of building), 28 s from the cache, under a second when the bundle is current. A result that is not the named bundle is refused (exit 3). Network: this is a build-time fetch of a public file by the developer's or builder's machine, never a call of the product: the running stack and the browser fetch nothing (make upmay fetch once, as below). - With
SOURCE=<file> [ORIGIN=<url>]: a bundle from a DAGI extraction the owner has (below), and a newassets/dagi.sha256to commit; the source is copied into the cache under its SHA-256.
make up makes it too (K2f2), and never fails for it (make dagi-bundle-soft, a prerequisite
of up, before the images are built and before the start ticket): nothing when the bundle is the
committed one; otherwise from the cache or fetched once. Offline with the source in the cache:
nothing is fetched. Offline without it, or any other refusal: one line ("no outline bundle …; the
map shows "Uden omrids" …"), exit 0, and the stack starts; an existing bundle is kept as it is.
A bundle is only ever replaced whole (K2f3, K2v-03). It is built into a staging folder beside
assets/dagi/ (assets/.dagi.new-<pid>) and its digest is checked there. Only then is the old
folder renamed aside, the new one renamed into its place, and the old one removed. A refusal (not
the named bundle), a full disk or an interrupted write leaves the previous bundle byte for byte;
a builder killed between the two renames is undone by the next one. One builder at a time:
make up, make demo and a release run at once wait for each other on assets/.dagi.lock. All of
these begin with a dot, so neither git nor an image takes them. migrate refuses a postcodes.csv
without a row (the table keeps its midpoints).
Its migrate then leaves ref.postcode_point as it is and says so.
How the stack gets it
The API's image (and so migrate's) carries assets/dagi/ (COPY assets/dagi in the workspace
and the release stage of services/api/Dockerfile; .dockerignore admits it; a fresh checkout has
the README alone there, so the build never fails for want of it). The release's content rule admits
exactly the bundle's files in the API image's app/assets/dagi/: those assets/dagi.sha256
lists, each with its SHA-256, and the README (K2f3; elo_devtools.release, dagi=). An extra, a
missing or a rewritten file refuses the image. **migrate loads postcodes.csv into
ref.postcode_point at every start** (elo_api.db.postcodes, after the migrations and the
settings), as the owner: the file is the whole list, ops.data_version rises when a row changed, a
second start with the same file changes nothing. Why migrate and not the worker's start: it is
the step that already installs what the database is given, it runs before the API and the worker
in both installs, and its role may write ref; the worker's may not, and should not for public
data. No bundle: the table stays as it is and the log says so; a malformed file is not loaded and
the start goes on (the log names the line, never a value). Directory: ELO_DAGI_DIR, default
/app/assets/dagi.
Source of the bundle
The keyless extraction of 7 November 2021 that K1 measured: Herover/dk-maps, release
07-11-2021, dagi-10-250-500-2000.zip
(https://github.com/Herover/dk-maps/releases/download/07-11-2021/dagi-10-250-500-2000.zip),
member dagi10.gml (1:10 000, OGR's GML 2). No current DAGI source without a key was found on 30
November 2026: Dataforsyningen's API answers 401 since its move that morning (K1 §1),
Datafordeleren's file download and WFS need a key, and a search found no current public copy.
Licence: the data were given in 2021 under the free-data terms of that time (copying and
redistribution with credit); DAGI is under CC BY 4.0 since 16 May 2024; ATTRIBUTION.md says both.
The map's credit line (K1 §4) is Grænser: Klimadatastyrelsen (DAGI, CC BY 4.0).
With the owner's Datafordeleren key
The file the key must produce: DAGI's file download from Datafordeleren (datafordeler.dk,
DAGI, file download), GML, the 1:10 000 scale, holding at least the feature types
Kommuneinddeling and Postnummerinddeling (a zip is read as it is; --member names the
GML in it when there are several). Then make dagi-bundle SOURCE=<file> ORIGIN=<where from> and
commit the new assets/dagi.sha256. The tool reads GML 2 (gml:coordinates) and GML 3.2
(gml:posList) by local names (kommunekode, navn, postnummer) and accepts the four-digit
municipality code (0999). The GML 3.2 form is tested on a recorded stand-in of invented shapes
(tools/tests/fixtures/k2/dagi_gml32.gml), not on a real download (none could be made). A keyed
source has no public address: a builder without it in the cache is told to run make dagi-bundle SOURCE=….
4. The demo
elo_devtools.synth.positions gives the generated organisation an owner's file: one coordinate per
site (every meter of a site at its address), six sites within 3.5 km of postcode 7990's midpoint
(Vesterfjord's postcode in the generator is also a geographic postcode of DAGI), every one on land
in a made bundle (tools/tests/test_k2_demo.py; its tests otherwise use invented shapes). make demo stores them as the owner's role after the load
(demo_load.place_points, generated true) and prints the counts. The three states are all shown:
exact: 18 points;postcode: "Teknisk Gård, vaskehal", left out of the file, at 7990's midpoint;none: "Solbakken, hovedmåler", left out, postcode 7991 (no postcode of DAGI):no_postcode; "Solbakken, køkken" (name protection not known) and "Idrætshal Nord, klubhus" (address protected):protected, in the file but not stored.
The area is one constant (CENTRE); a background's labels there would name real villages, under
the demo's banner "Demo med genererede data" (K1 §4).
5. The map on Overblik (K4a): on outlines, without a background
Vis: Liste · Kort in the head of "Målepunkter med den største ændring" (the address's rang,
liste the default, a presentation choice that "Nulstil filtre" keeps): Kort puts the month
chart across the whole width and, under it, the cell "Målepunkter på kort": the map, the ranked
table beside it (under it at a phone's width) and Ikke på kortet (n) under the table. Only with a
comparison (the ranking needs one). The map follows the chosen card, as the ranking does (R1): its
ranks, sizes and colours are overview.mp_variance's rows of the card's measure.
Two answers, joined by mp_id in the page: the ranking (overview.mp_variance, unchanged) and
overview.mp_positions (K4a; docs/queries.md): calc.mp_positions() for the roots of the
selection (mp, sel; no period, no comparison, no measure), mp_id, precision, x, y, reason. No
key of an address leaves: the address's identity (dar_reference) and the postcode are words no
query may name (dar_reference in any query, the postcode in a query of a selection, phase-2.md
§3.5), so the page clusters by coordinate: an owner's file from an address register gives one
coordinate per address (K2's demo one per site), and a point placed by its postcode stands at its
midpoint. (The brief's "by darReference" is so met without reading it.)
The outlines are files of the web build: vite-plugins/map-outlines.ts copies the bundle's
country.geojson and municipalities/<k>.geojson into map/ of the build and the credit into
licenses/DAGI-ATTRIBUTION.md when make dagi-bundle has made the bundle (the web image's
COPY assets/dagi). The page reads map/country.geojson from its own origin when the map is
shown (never with the list), finds the municipalities its points lie in from those outlines (a
municipality's code is never sent anywhere) and reads their finer files. No request goes to /api
for an outline, none to another host. Without a bundle (a checkout's make up before make dagi-bundle) the same marks, table and list are drawn on the plain ground with the line "Uden
omrids: kortets grænser er ikke med i denne installation (make dagi-bundle). Punkterne står på
deres koordinater." The static demo's build carries the outlines as files beside the page.
What is drawn (web/apps/elo-web/src/shared/map/):
| A point alone | a dot in its impact colour (better, worse, neutral: the product's colours, manual N36) |
| Several points at one address | a double ring in the colour of their summed variance, the count inside |
| The points placed by a postcode | a dashed ring with the count inside, at the midpoint |
| Marks closer than 18 px on the screen | one ring with the count of all (none hides another) |
| 500 points (above 150 placed) | one ring per municipality (from the outlines) with its count, and the largest named beside it ("312 målepunkter · ΔPY −1.234 kWh"); a click zooms to it, draws its points by address and lists them in the table; "Hele kortet" goes back |
| A few points (up to 8 placed) | each with its name and its variance beside it |
| Rank tags | small ink squares beside a mark with the table's ranks of its members (3·8): every rank of a few points, else the first five ranks |
| Size | four stepped classes by the switch Størrelse: Ændring |ΔPY| · <measure> AC (str, delta the default): round limits at about a tenth, a quarter and a half of the largest mark, said in the key under the map |
The table ranks every point of the ranking (placed or not), with its placement (eksakt,
klynge n, postnr., ikke på kortet), AC, ΔPY and ΔPY %; above 16 points the first 15 and the
chosen one, and a line counting the rest. Ikke på kortet (n) lists each unplaced point by name
with its rank ("nr. 5 i listen"), its reason (adresse beskyttet for protected, mangler koordinat for no_master_data and no_postcode), AC and ΔPY; its name opens Målepunkt.
Linked both ways. Pointing at a mark lights its rows (the assisting ground, the name bold);
pointing at a row lights its mark (a ring of ink). A click on a mark chooses it (the card in the
map's corner names it, its placement and figures; the row gets a 3 px edge of ink and
aria-current); a second click opens Målepunkt in the card's view, as the ranking's drill does. The
table's region and the map take the same keys: the arrows step through the rows in rank order (the
unplaced too: the card then says why it is not on the map), Home and End, Enter opens, Escape
clears.
The credit stands under the map: "Grænser: Klimadatastyrelsen (DAGI, CC BY 4.0)", the name linking to the dataset's page and "CC BY 4.0" to the licence's Danish text (K1 §4). No municipality is named on the map.
5.1 The map's rules
The proposal registers its map decisions as N35–N38; the manual has since used N35–N37 for other rules, so they are cited here as the map's rules 1–4 until the manual numbers them (the lead's).
- A map locates; the figures are the table beside it, linked both ways (the proposal's N35).
2. Size in four stepped classes by |ΔPY| or AC; colour by impact; the count inside a ring, the
rank in a square tag from the table over all points (N36, its first half).
3. Every mark stands on a halo of the map's ground (2 px beyond its edge); the outlines and
their land are the ink at a low opacity over the ground (11 % and 4 %, the group's opacity, so a
shared border is not drawn twice as dark), at most 1,45:1 against
it; a mark is at least 3:1 against its halo; counts and tags at least 4,5:1 (N36, its
second half). On outlines alone the ground is the cell's opaque ground, the page's background colour
(
--an-color-background-page: Enkel's and Varm skifer's panels are that colour, Analytisk stands on it), so the halo is white in the light themes and the dark ground in the dark ones. Measured in every style and theme byweb/apps/elo-web/e2e/k4a-map.spec.ts(the report gives the figures). 4. No point is dropped: an unplaced point keeps its rank in the table and is listed underIkke på kortet (n)with its reason (N38).
The proposal's N37 (no live tiles; a background fetched once) is K3's and K4b's.
6. The background (make map-background, K3)
The map can be drawn over Klimadatastyrelsen's Skærmkortet dæmpet (the muted topographic
map), the raster WMTS topo_skaermkort_daempet of Datafordeleren (wmts.datafordeler.dk,
matrix set View1, EPSG:25832, JPEG; K1 §1). The owner's decision (proposal §4.4, Way A): the
tiles are **fetched once, on a command, for the install's own area, with the installer's own key,
and stored on this machine**. The browser fetches tiles from the local web server alone, never
from the map service. Without a key nothing is fetched and nothing is sent: the map shows the
outlines alone ("Uden baggrund"). Drawing the tiles is K4b's (50 % opacity, D20).
Getting a key
Datafordeleren's API key is free and lasts two years (renewable once): a user at
https://portal.datafordeler.dk (e-mail and password are enough for this unprotected data), an
IT-system under it, and an API-key under that (section "API-Keys"). There is no step that
grants a service: a key reaches every free dataset, topo_skaermkort_daempet among them. The key is active 15 minutes after it is made (K1 §2). It goes into
.env, beside the token, as one line:
MAP_BACKGROUND_KEY=<the key>
.env stays mode 0600 and git-ignored; make doctor accepts exactly the token's line and this one.
The key is never accepted in .env.local (refused, like any key that is not a setting),
never written to PostgreSQL, never given to the API, PostgreSQL, Caddy or the worker, and blanked in
make demo.
The commands
make map-background fetch what is missing for the install's points; resumable
make map-background REFRESH=1 fetch every tile again (e.g. after the yearly map update)
make map-background-clear remove the stored tiles; the map shows the outlines alone
The stack must be running. What make map-background does:
- The plan, on the host (
elo_devtools.map_background plan): the placed points (calc.mp_positions(), read as the owner, asmake map-positionsdoes) and the outline bundle give one rectangle per municipality that holds a placed point: the municipality's bounding box plus 2 km, at zoom 3-7 where all its points are at their postcode's midpoint and 3-9 where any has an exact position (Question 5's answer, "Fil"). A point that a 25 m outline leaves just outside the land takes the nearest municipality. **The bundle is checked first** againstassets/dagi.sha256(K2's digest over its files): a changed or other bundle is refused before anything is planned, since its outlines decide what leaves (K3v-05). The positions stay in the host's shell and planner; the plan holds rectangles, never a point. It says counts alone (map-background: 22 placed point(s) in 1 municipality area(s): zoom 3-9 for 1, 3-7 for 0). 2. The fetch, in the one service that holds the key (map-backgroundofdeploy/compose.yaml, the worker's image,elo_worker.map_background), given the plan on its standard input. It reads the grid from GetCapabilities (the layer, JPEG,View1, its CRS EPSG:25832, every matrix's scale, corner, tile and matrix size, the layer's limits) and never assumes it: a zoom level is a matrix's place in that set from the coarsest, and the manifest names each level's identifier and resolution. The real grid (K3f, 30 November 2026):View1inurn:ogc:def:crs:EPSG:6.3:25832(a versioned URN: every OGC form of an EPSG code is read), 14 levels with identifiers0-13from 1 638.4 to 0.2 m/px (level 3 204.8, level 9 3.2), the corner120000 6500000(easting, northing; a corner the other way round is refused), 256 px tiles,image/jpegalone, KVP alone, and the layer's limits naming the matricesView1:0…View1:13(equal to the matrices' sizes; a limit naming no matrix is refused). Then each tile once (areas overlap), sequentially, at most 4 requests a second; a 429 waits itsRetry-After(five times in a row at most, each wait at most 10 minutes; then the run stops); a 5xx, a refused key, a network failure, a redirect or an answer that is not a JPEG stops the run. A stored tile is not fetched again unlessREFRESH=1, so a stopped run is resumed by running it again. Plans over 60 000 tiles are refused while they are planned (never more than that many held), zoom above 10 is refused, and a matrix whose numbers are not finite and sane refuses the document (K3v-04). A rate given to the module that is not a positive finite number is refused before any request (K3v-03). The bytes of the first 30 tiles and a mean and maximum per level are logged (K1 §9 #3), with the first tile's caching headers. 3. The record (elo_devtools.map_background record): the rectangles fetched completely go intoops.map_background_area(migration 0470), one transaction as the owner, replacing the earlier ones.
Exit status: 0 done; 2 no key (nothing was sent) or the demo; 3 refused (the key, the service's answer, the plan); 4 stopped, run again later (what is stored stays); 5 no placed point.
The service's isolation. It runs once and is removed (compose run --rm), under a Compose
profile that make up never starts, read-only but for /tmp and the volume, on a **network of its
own** (map-out): it can reach the map service and nothing of the stack (no database, no API). Its
environment is HOME, MAP_BACKGROUND_KEY and ELO_DEMO; no database URL, no token. Under
ELO_DEMO=1 it refuses before any call.
Where the tiles are, and how the page gets them
The volume map-tiles holds topo_skaermkort_daempet/<z>/<row>/<col>.jpg (<z> the zoom
level: a local name, never the service's matrix identifier, K3v-01) and
manifest.json. The service writes it (as the image's user 10001, whose directory the empty volume
takes at its first mount); Caddy mounts it read-only and serves it at
http://elo.localhost:8080/tiles/… (handle_path /tiles/*: files, no listing, Cache-Control: public, max-age=86400, nosniff; a tile that is not stored is a 404, which the page draws as white).
No other service mounts it. make purge removes it with the database's volume; make down keeps it.
manifest.json (no key, no point, no address):
| Field | What |
|---|---|
layer, matrix_set, crs, source | topo_skaermkort_daempet, View1, EPSG:25832, wmts.datafordeler.dk |
attribution, licence | Baggrundskort: Klimadatastyrelsen (Skærmkortet dæmpet, CC BY 4.0), CC BY 4.0 |
levels | per zoom level: z, the service's matrix id (validated), its directory dir (= z), resolution (m/px), left, top (the matrix's corner), tile (px) |
areas | the rectangles fetched completely: k (municipality code or demo), bbox (EPSG:25832 m), zoom |
incomplete | the rectangles of a stopped run not yet complete |
tiles, complete, fetched_at | counts (fetched, kept, outside coverage, bytes), whether the run finished, when |
A tile's place: column c, row r of a level cover x from left + c·256·resolution and y down
from top − r·256·resolution, the same EPSG:25832 metres as the positions and the outlines.
When a point lies outside it: make status and the page
Nothing fetches automatically: a new metering point in a new municipality (a sync, make token-add) is drawn on the outlines alone until the owner runs make map-background again, which
fetches only what is missing. make status says it, in the section "metering points"
(ops.map_background_state(), counts alone, which the worker may run though it may not read a
position):
map background: none stored (…): no background (no key, or never fetched): no attention;map background: 1 area(s) stored, fetched 2026-11-30; every placed point (19) is inside it;! map background: …; 3 of 19 placed point(s) lie outside it (a new area): make map-background fetches what is missing(needs attention, exit 3);! map background: 18 point(s) with an exact position where only zoom 3-7 is stored: make map-background fetches zoom 8-9(exact positions imported after a postcode-only fetch).
The page's note (K4b, which draws the tiles) reads the same from manifest.json's areas: a placed
point inside no rectangle, or an exact point inside rectangles to zoom 7 alone, gives the quiet line
"Nyt område uden baggrundskort — kør make map-background for at hente fliser." The API may
also offer ops.map_background_state() (executable by elo_api), which gives the same counts.
Attribution
CC BY 4.0, credit to Klimadatastyrelsen (K1 §4; GeoDanmark named as the proposal does, which is
generous, not required). Inside the map frame when tiles are shown (K4b):
Baggrundskort: Klimadatastyrelsen (Skærmkortet dæmpet, CC BY 4.0), and the outlines' line
(K2). The text is manifest.json's attribution.
What leaves the machine (the privacy statement)
The product's outbound calls are Energinet's two services (Eloverblik, Energi Data Service), made by
the worker, and one optional third: make map-background to wmts.datafordeler.dk
(Datafordeleren, Klimadatastyrelsen's platform).
- It is never automatic: no schedule, no start of the stack, no page calls it; only the owner's
command. Never in
make demo, never whenMAP_BACKGROUND_KEYis unset (the service refuses before any call, and nothing else holds the key). The browser never calls it. - What is sent: the installer's key (as the query parameter
apikey=, which Datafordeleren requires) and the WMTS addresses of the tiles covering the install's municipalities' rectangles (public outlines plus 2 km): the rows, columns and levels of those tiles, and the service's name and version inUser-Agent(eloverblik-map-background/1). Never a metering-point ID (GSRN), an address, a coordinate of a point, a consumption figure, a name or a company. The tiles asked for show which municipalities the install's points lie in, at municipality scale. - Klimadatastyrelsen logs the requests against the key under its terms. An owner who does not want even municipality-scale requests to leave the machine leaves the key out; the map then shows the outlines alone.
- The key is never logged, raised, stored or printed: every URL holds it, so one function
strips it (
redact: the parameter's value and the key's own text, raw or encoded) and every way out goes through it (the log handler's filter on every logger's records, httpx's at DEBUG included; every refusal; the last-resort handler;sys.excepthook); no exception of the HTTP library leaves the request function with its text; redirects are refused (one would carry the key elsewhere); a key that is not 8-512 printable characters is refused without being shown. What the service sends back is used only once it passed a validator and holds no key (K3v-01): a GetCapabilities whose matrix identifiers, limits, formats or CRS hold the key or anapikey=is refused; identifiers must be[A-Za-z0-9_.:-]{1,64}and are used in the request alone (directories are zoom levels); response headers are shown by names from a fixed list; the result on standard output, the manifest and every line of the check go throughredact. The tests sweep path names as well as contents.services/worker/tests/test_k3_fetch.pyplants a sentinel key and searches standard output and error, every log record, every file written and every exception for any 12 characters of it.
The packaged install (make release) leaves the map background out for now, deliberately: its
Compose file has no map-background service, no map-out network, no map-tiles volume, and no
service names the key (elo_devtools.release, row "no map background"); there is no elo
command for it yet.
make map-background-demo (for K-demo)
make map-background-demo AREA=demo the generator's sites plus 2 km, zoom 3-9
make map-background-demo AREA=<x0,y0,x1,y1> a box in EPSG:25832 metres
writes the demo's tile set and its manifest into build/map-demo/ (git-ignored; never in the
repository), with MAP_BACKGROUND_KEY of .env. No stack is needed: the service alone runs, as the
user who runs make. Not with DEMO=1 (which blanks the key). The demo's area is about 7.5 km
square: about 150 tiles at zoom 3-9.
The live check (make map-background-check)
make map-background-check KEYFILE=<a file with the line MAP_BACKGROUND_KEY=<key>>
The one check against the real service: in a Compose project of its own (elo-map-check, removed
afterwards), the service reads GetCapabilities and prints the grid (every level's identifier,
resolution, tile and matrix size, corner), fetches up to 30 tiles over the demo's area into a
temporary directory and prints their bytes per level and the first tile's caching and rate-limit
headers. It stores nothing and prints no key. Run it from a checkout of this code; KEYFILE may be
another checkout's .env (Compose reads its key line; the token's is blanked).
Testing without the service
Tests never call Datafordeleren: services/worker/tests/k3_standin.py stands in for it, serving a
the real GetCapabilities of 30 November 2026 (fixtures/k3/capabilities.xml, from the lead's
live check, its key replaced by SENTINEL-NOT-A-KEY, which the stand-in replaces with each
request's key: the document echoes the key in its addresses) and generated JPEG-shaped
tiles, behind a sentinel key, with faults on demand (429 with Retry-After, 5xx, 403, a redirect,
an HTML answer, a slow answer). It runs in process for the unit tests, and behind TLS (a CA of the
test's own, the service's name aliased to it on a network with no way out) for the stack's check.
Kilde: docs/maps.md i løsningens
repository.