Geocoding service

This bundle provides a store for accessing the service for geocoding addresses and geonames by the Bundesamt für Kartographie und Geodäsie (BKG). It works in combination with both the omnisearch and the search-ui bundles.

search bar

By clicking on a suggestion, the map zooms to the according location.

result list

Activating the service

To get access to the geocoding service, you are required to obtain an activation key or an application key.

We recommend to use an application key in favor of an activation key. The application key is used to generate a temporary session ID which is then appended to the geocoding requests coming from the clients. The application key is not publicly visible. In contrast, the activation key can be read by everyone who accesses your web app. For more information, see the article on the BKG website.

To obtain a key, please contact:

Bundesamt für Kartographie und Geodäsie
Dienstleistungszentrum
Karl-Rothe-Straße 10-14
04105 Leipzig

E-Mail: dlz@bkg.bund.de
Tel.: 0341/5634-333
Fax: 0341/5634-415

Configuration

For security reasons, we recommend to use an application key in favor of an activation key.

Activation key

After you completed the activation process, configure the app with the service URL you received (containing a unique activation key).

Open the map.apps application.properties file and add the following parameter:

geocoding.service.url=https://sg.geodatenzentrum.de/gdz_ortssuche__[yourKey]

Install the backend component that ships with map.apps SDI. It connects to the BKG service to obtain a temporary session ID that is only valid for a limited period of time.

The backend component contains a filter servlet for map.apps that replaces the bkg.session.key variable inside an app.json file with a valid BKG session key.

Installation

  1. Copy the file bkg-geocoder/ct-sdi-extension-bkg-<version>.jar to the lib folder inside the map.apps webapp.

  2. Inside the map.apps webapp, edit WEB-INF\classes\spring-filter-config.xml and add the new bean element right before the ref element for the propertiesReplacementFilter:

    <bean id="FilterChain" class="de.conterra.rest.support.filter.ChainingFilter">
    <description>javax.servlet FilterChain used to process non jax-rs resources</description>
    <property name="filters">
    <list>
    ...
    <!-- Start -->
    <bean class="de.conterra.sdiextension.bkg.filter.SessionKeyFilter" p:acceptPath="**/app.json">
    <constructor-arg index="0" value="${bkg.session.key.url}"/>
    </bean>
    <!-- End -->
    <ref bean="propertiesReplacementFilter"/>
    ...
    </list>
    </property>
    </bean>
  3. Open the map.apps application.properties file and add the following parameter:

    bkg.session.key.url=https://sg.geodatenzentrum.de/gdz_getSession?bkg_appid=<your_api_key>&domain=<your_domain>

    In the URL replace <your_api_key> and <your_domain> with the values you obtained from the BKG after registering for the service.

  4. Restart the Tomcat server.

  5. In your app.json files, use the placeholder @@bkg.session.key@@ where the session key should be inserted:

    {
        "sdi_geocodingservice": {
            "GeoCodingStore": {
                "url": "https://sg.geodatenzentrum.de/gdz_ortssuche__@@bkg.session.key@@"
            }
        }
    }