/** * @copyright Sister Software * @license AGPL-3.0 * @author Teffen Ellis, et al. * * Fetch Denmark's INSPIRE Addresses GeoPackage for the `dk-inspire` adapter. * * Denmark is one of the member states that serves the Addresses (AD) theme as a predefined-dataset * ATOM feed rather than as a WFS, so `#tools/fetch/inspire-addresses` — which pages a WFS and joins * its feature types locally — does not reach it. This module reads the feed, downloads the one * dataset it offers and extracts the GeoPackage. * * The acquisition belongs under a `tools/` root. `@mailwoman/corpus` is one of the * `TOOLING_PACKAGES` in `dependency-cruiser.config.mjs`, which keep their tooling under `lib/`, so * this module sits beside `#fr/tools/fetch/ban` rather than in an `sdk/` root the workspace does * not declare. * * Klimadatastyrelsen states CC BY 4.0 for this theme, and the address-source register elects it. The * model card must attribute Klimadatastyrelsen. * * Five properties of this host were measured, and each one breaks a reader that assumes otherwise: * * 1. `content-length` on the feed is the gzip-compressed length. The header says 1,455 while 3,130 * bytes are delivered, so a reader that trusts it truncates the feed. Every byte count here is * counted off the delivered body. * 2. The entry's `rel="alternate"` href is a Wing FTP weblink landing page, HTTP 200 `text/html`, * 3,811 bytes. The file needs `&realfilename=DK_INSPIRE_Addresses.zip` appended, which answers * HTTP 200 `application/zip`. * 3. The host ignores `Range`. `bytes=0-4095` answers HTTP 200 with no `content-range` and the whole * 101 MB body, so the one-byte range GET that sizes an OpenAddresses source cannot be used here. * 4. The entry's own `length="4291699"` understates the real 101,406,038 bytes by 23 times. The * download is never sized from the feed. * 5. The feed's `` is 2020-12-24 and the entry's 2022-10-06, both stale against the file's * own 2026-09-27 modification date, so a freshness check cannot read the feed's timestamps. This * module compares the downloaded zip's sha256 against its manifest instead. * * The linked OpenSearch description parameterises only `spatial_dataset_identifier_code`, `crs` and * `language`, and offers no spatial subsetting, so there is no way to fetch part of Denmark. The * feed holds one entry covering the whole country. */ import type { BaseFetchOptions, FetchSummary } from "#tools/fetch/download"; /** * The ATOM service document for Denmark's Addresses theme. */ export declare const DK_ADDRESSES_FEED_URL = "https://www2.sdfe.dk/INSPIRE/feeds/Addresses.xml"; /** * The zip member the adapter reads. */ export declare const DK_ADDRESSES_GEOPACKAGE_MEMBER = "ad_inspire.gpkg"; /** * What the feed states about its one dataset. */ export interface AddressesFeedEntry { /** * The entry's title, `DK INSPIRE Addresses` in the measured feed. */ title: string; /** * The download URL, with the member named so the host serves the file rather than its landing page. */ downloadURL: string; /** * The media type the entry advertises, `application/geopackage+sqlite3` in the measured feed. */ mediaType: string | null; } /** * Read the one dataset entry out of the feed. * * Parsed with `@mailwoman/core/html/elements` rather than matched with a pattern. * * The feed needs both of the things a pattern handles badly. * Its entry tag carries an `xml:lang` attribute, so a reader has to keep attributes. * * Its hrefs escape the ampersand between query parameters, so a reader has to decode entities. * * The parser does both. * XML mode is required: the entry's links self-close, and HTML mode leaves them open. * * @param xml The whole feed, 3,130 bytes, taken as one string rather than as a stream. * @throws When the feed holds no entry, or its entry no usable link. * A feed holding neither reads as a change at the publisher, which a caller has to see. */ export declare function readAddressesFeed(xml: string, feedURL: string): Promise; /** * Name the zip member on a weblink URL, so the host serves the file instead of its landing page. * * A URL that already names one is answered unchanged, so a publisher that starts writing * the complete URL into the feed does not get the parameter twice. */ export declare function datasetURLOf(href: string): string; export type FetchDKAddressesOptions = BaseFetchOptions; /** * Download Denmark's Addresses GeoPackage and leave it beside a manifest recording its sha256. * * Re-runnable: a run whose manifest sha256 still matches the extracted GeoPackage * reuses that file and makes no request. */ export declare function fetchDKAddresses(options: FetchDKAddressesOptions, report?: (line: string) => void): Promise; //# sourceMappingURL=inspire.d.ts.map