@maschinenlesbar.org/regionalatlas-cli
    Preparing search index...

    Function matchRegion

    • Pick the rows a region names, and say how (RegionMatch.by).

      • A numeric region is a key: the rows whose ags equals it, leading zeros ignored on both sides (by: "ags"). When none does, a row whose shorter key the region pads with zeros (by: "ags-filled"): a level fills in with coarser units, so at gemeinde München is the row 09162 and Berlin 11, and the official 8-digit keys 09162000 and 11000000 (or 11000 at kreis) used to match nothing. The longest such key wins.
      • Otherwise a name, compared case-insensitively in NFC (foldText): the rows whose whole name equals it (by: "name"), with the rows that only contain it in others; when no name equals it, every row whose name contains it (by: "substring"). A substring alone picked the wrong place first: Sachsen gave Niedersachsen, Sachsen and Sachsen-Anhalt in that order, Gera Groß-Gerau before Gera, Berlin at gemeinde level Berlingen. Several rows can still match — a name two regions share (two Gemeinden called Halle; Hannover twice in the Kreis rows of 2000), or a text that is no whole name (Neustadt at gemeinde level: 21 rows) — so check rows.length, and pick one region by its ags.

      A blank region throws RegionalatlasValidationError rather than matching every row.

      Parameters

      Returns RegionMatch