Danish Address
Danish Address adds Danish address support to Drupal using Klimadatastyrelsen's official Adressevælgeren API.
The module provides a field type you can add to any entity — content types, taxonomy terms, users, paragraphs. Editors type an address and get live suggestions from Denmark's official address register (DAR). Selecting a suggestion stores a normalised address together with postal code, postal district, the DAR identifiers and coordinates.
It is aimed at Danish sites that need structured addresses for branches, events and contacts.
This module replaces GSearch (Dataforsyningen). Klimadatastyrelsen is closing the GSearch API as part of the Dataforsyningen platform transition — it appears on their list of services being closed, row 88. Adressevælgeren is the replacement for address lookup. See Upgrading from GSearch below.
Features
- Autocomplete input. The field widget uses the Select2 module for a searchable dropdown. As the editor types, the module queries Adressevælgeren and shows matching Danish addresses.
- No account and no API key. Adressevælgeren has no user management yet, and the module ships with the shared token Klimadatastyrelsen ask every caller to send. There is nothing to sign up for and nothing to configure.
- Complete address data. A selected address stores the street name, house number, floor and door designations, postal code, postal district, country code, the DAR address and access-address UUIDs, and WGS84 coordinates.
- Optional free-text mode. A per-field setting lets the field accept any text when the address is not in the Danish register — useful for international or informal addresses.
- Themeable output. The formatter renders through Twig templates you can override, and the field item exposes typed getters for custom rendering.
Requirements
Adressevælgeren publishes coordinates in ETRS89 / UTM zone 32N (EPSG:25832) and offers no way to ask for anything else, so the module reprojects them to WGS84 before storing. proj4php does that work; there is no coordinate mathematics in this module.
Installation
- Install with Composer:
composer require drupal/dk_address - Enable the module.
- Add a field of type Danish address (Adressevælgeren) to a content type or other entity. Optionally enable Allow storing free-text addresses on the field.
There is no configuration step. The defaults at /admin/config/services/dk-address are correct as shipped, and you should not need to change them.
Upgrading from GSearch
Your stored addresses carry over unchanged. GSearch and Adressevælgeren both return DAR UUIDs, and every identifier GSearch produced resolves in Adressevælgeren to the same address, with the same display text. Stored coordinates stay valid too. The upgrade therefore moves configuration, not address data.
The project ships a Danish Address: migrate from GSearch submodule for this. With both modules installed, enable it; it converts your address_gsearch fields, form and view displays and settings in one pass, then you uninstall the GSearch module and the migration submodule.
The conversion rewrites field storage configuration directly, because Drupal's entity API does not permit changing a field's storage type. Please try it on a copy of your site before running it on production.
When the API is unavailable
Klimadatastyrelsen expect to introduce user management for Adressevælgeren in late 2026 or early 2027, at which point the shared token will stop being accepted and each site will need its own credential. Outages happen too. The module is built so that neither breaks your site:
- Saved addresses render normally — displaying a field fetches nothing.
- Content carrying an unchanged address still saves. An editor who never touched the address field is not blocked by an API being down.
- Recently looked-up addresses still resolve from cache, and expired cache entries are served in preference to failing.
- An error appears on the status report at
/admin/reports/status, naming the likely cause and what to do about it, so you do not have to be following Klimadatastyrelsen's announcements to find out.
The settings page also accepts an optional credential belonging to your own site. It is never sent while the shared token is accepted, and is tried automatically if that token is ever refused. Sites upgrading from GSearch have their existing Dataforsyningen token placed there by the migration submodule. Note that Klimadatastyrelsen have not yet published which account system Adressevælgeren's user management will use, so an existing Dataforsyningen token may or may not turn out to be the right one.
Known limitations
These come from Adressevælgeren itself rather than from the module. See Klimadatastyrelsen's Kendte fejl and FAQ.
Similar projects
- GSearch (Dataforsyningen) — this module's predecessor. Its API is being closed by Klimadatastyrelsen, so new sites should use Danish Address instead.
- Address DAWA — built on DAWA, which Klimadatastyrelsen has closed.
- Address — international postal addresses, with no Danish register lookup. Use it when you need addresses from many countries rather than validated Danish ones.
Sponsors
This module has been developed by Reload, paid for by the Copenhagen Public Libraries and Danish Public Libraries