Web vector hosting

Local provision basemap.de Web Vector

If you have a local copy of the Vector Tiles from basemap.de Web Vektor with the associated style files, you can make them available via your own web server with the following adjustments. Please note the Terms of use.

The instructions assume that the data is provided in the following folder structure via a web server:
|- fonts
  |- Liberation Sans Bold
  |- ...
|- sprites
  |- bm_web_col_sprite.json
  |- bm_web_col_sprite.png
  |- ...
|- styles
  |- bm_web_col.json
  |- ...
|- tiles
  |- v1
      |- bm_web_en_3857
          |- bm_web_en_3857.json
          |- 0
          |- 1
          |- ...
      |- ...

Adapt URLs to local environment

The links contained in the files must be adapted to the local environment. This can be done, for example, by "search and replace" across all files. To do this, replace the URL path https://sgx.geodatenzentrum.de/gdz_basemapde_vektor by the domain and the path of your own server. The URL must be changed to the domain via which the browsers and applications are to access the data.

Alternatively, the URLs can be customised individually in the following files.

Styles
In all JSON files in the "styles" folder, the URLs under "glyphs", "sprites" and "sources" must be changed.

Example styles/bm_web_col.json:
{
  "id": "bm_web_col",
  "version": 8,
  "name": "bm_web_col",
  "metadata": {
    "basemapde:style-version": x.x,
    "mapbox:autocomposite": false,
    "mapbox:type": "template",
    "maputnik:renderer": "mbgljs"
  },
  "centre": [10,51],
  "zoom": 6,
  "glyphs": "https://sgx.geodatenzentrum.de/gdz_basemapde_vektor/fonts/{fontstack}/{range}.pbf",
  "sprite": "https://sgx.geodatenzentrum.de/gdz_basemapde_vektor/sprites/bm_web_col_sprite",
  "transition": {
    "duration": 300,
    "delay": 0
  },
  "sources": {
    "smarttiles_en": {
      "type": "vector",
      "attribution": "© 2024 basemap.de / BKG | Data sources: © GeoBasis-DE",
      "url": "https://sgx.geodatenzentrum.de/gdz_basemapde_vektor/tiles/v1/bm_web_de_3857/bm_web_de_3857.json"
    }
  },
  "layers": [
    ...
  ]
}
Tiles
In all subfolders of the "tiles/v1" folder, the JSON file that corresponds to the folder name must be adapted. The URL under "tiles" must be changed in these files.

Beispiel tiles/v1/bm_web_de_3857/bm_web_de_3857.json:
{
    "attribution": "GeoBasis-DE",
    "basename": "bm_web_en_3857",
    "bounds": [
        5.8,
        47.2,
        15.1,
        55.1
    ],
    "centre": [
        10.45,
        51.150000000000006,
        2
    ],
    "format": "pbf",
    "id": "bm_web_en_3857",
    "maxzoom": 15,
    "minzoom": 0,
    "name": "bm_web_en_3857",
    "scheme": "xyz",
    "tilejson": "2.2.0",
    "tiles": [
        "https://sgx.geodatenzentrum.de/gdz_basemapde_vektor/tiles/v1/bm_web_de_3857/{z}/{x}/{y}.pbf"
    ],
    "vector_layers": [
...
]
}

Configuration of the web server

In order to provide Vector Tiles via a web server, certain configurations must be made in the web server so that the Vector Tiles can be read correctly by browsers. Configurations for the Apache HTTP server are given as examples. 

The PBF files within the tiles folder must be delivered with the correct MIME type and content encoding:
<Directory {lokaler-pfad}/tiles>
<FilesMatch".pbf$">
ForceType application/x-protobuf
Header always set Content-Encoding "gzip"
</FilesMatch>
</Directory>

If cross-origin access is also to be permitted for access to the vector tiles and styles, the corresponding access control headers must be set: 
<Directory {lokaler-pfad}/tiles>
<FilesMatch".pbf$">
ForceType application/x-protobuf
Header always set Content-Encoding "gzip"
</FilesMatch>

Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "GET"
</Directory>
<Directory {lokaler-pfad}/fonts>
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "GET"
</Directory>

<Directory {lokaler-pfad}/sprites>
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "GET"
</Directory>

<Directory {lokaler-pfad}/styles>
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Methods "GET"
</Directory>

To prevent incorrect display of umlauts in the labelling of the map, the encoding of the web server should be set to UTF-8:
AddDefaultCharset UTF-8