YAML Configuration (Configuration and Application files)
The following configuration files are under the config/ folder and its subfolders.
Warning
In all .yaml files, tabulators may not be used for indentation. Instead, you need to use the space bar.
doctrine.yaml
fom_user:
selfregister: false
reset_password: true
max_reset_time: 1
mail_from_address: ~
mail_from_name: ~
fom_user.selfregistration: To enable or disable self-registration of users, change this parameter. You have to define self_registration_groups, so that self-registered users are added to these groups automatically, when they register. They will get the rights that are assigned to these groups.
fom_user.reset_password: In the same way the possibility to reset passwords can be enabled or disabled.
Database configuration
The files .env.local and doctrine.yaml are needed to configure databases in Mapbender. In .env.local, (multiple) variables and definitions for database connection(s) can be defined. These variables are being processed in doctrine.yaml.
Note
Every database defined in .env needs to have a placeholder in doctrine.yaml:
doctrine:
dbal:
default_connection: default # Database connection, used as standard in Mapbender (``default_connection: default``).
connections:
default:
url: '%env(resolve:MAPBENDER_DATABASE_URL)%'# Placeholder which resolves the environment variable in the file .env.local. This variable contains the database connection information.
Use of several databases
Example with two database connections in doctrine.yaml:
doctrine:
dbal:
default_connection: default
connections:
# database connection default
default:
url: '%env(resolve:MAPBENDER_DATABASE_URL)%'
# database connection geodata_db
geodata_db:
url: '%env(resolve:GEOBASIS_DATABASE_URL)%'
# IMPORTANT: You MUST configure your server version,
# either here or in the DATABASE_URL env var (see .env file)
#server_version: '15'
.env or .env.local file
This file handles necessary environmental variables.
Database
The files .env and doctrine.yaml are used to configure database connections in Mapbender. In .env, (multiple) variables for database connection(s) can be defined. The .env is overwritten by .env.local. This is read by doctrine.yaml. Several database connections can also be defined in doctrine.yaml. An alias is assigned to each database connection.
Example: Database configuration in .env.local with the default database variable, if the pre-installed SQLite database is used:
MAPBENDER_DATABASE_URL="sqlite:///%kernel.project_dir%/var/db/demo.sqlite"
When using PostgreSQL (e.g. for the use with Search Router), use the following configuration instead:
SEARCH_DB_DATABASE_URL="postgresql://dbuser:dbpassword@localhost:5432/dbname?serverVersion=18&charset=utf8"
Use of several databases
Mapbender also allows you to use several databases. This is recommended when integrating geodata. These should be stored separately from the Mapbender database.
You need a second database for geo data search (with SearchRouter) and data collection (Digitizer).
The default database connection (default_connection: default) is used by Mapbender.
If you want to use another database, you just have to define a database connection with a different name in your .env.local file. Now, you can refer to the database search_db in the elements SearchRouter and Digitizer.
To learn more about this structure, visit the Symfony documentation. Mapbender uses Doctrine. Doctrine is a collection of PHP libaries (Doctrine project).
Mailer
The mailer information is defined in the .env.local file via the MAILER_DSN variable.
#MAILER_DSN=smtp://user:pass@smtp.example.com:25
MAILER_DSN=null://null
The configuration will be called via the fom.yaml file:
fom_user:
selfregister: false
reset_password: true
max_reset_time: 1
mail_from_address: info@mapbender.org
mail_from_name: Mapbender Team
Hint
The functions ‘Self-Registration’ and ‘Reset password’ need a mailer. More information in chapter Users.
parameters.yaml
The following fundamental Mapbender parameters are specified here.
Language settings
Mapbender is automatically adjusted to your browser’s language. Yet it is also possible to set your preferred language via the fallback_locale parameter. If a translation of your browser’s language is missing in Mapbender, it will take the defined language.
The locale can only be set for the entire Mapbender installation (not for single applications).
Available language codes are:
en for English (default)
de for German
es for Spanish
fr for French
it for Italian
nl for Dutch
pt for Portuguese
ro for Romanian
ru for Russian
tr for Turkish
uk for Ukrainian
Configuration example:
fallback_locale: en
locale: de
You also can force Mapbender to use the language defined for the parameter locale to be used. To do this, add mapbender.automatic_locale: false.
mapbender.automatic_locale: false
fallback_locale: en
locale: es
More information in Translation in Mapbender.
Application Sorting
The default sorting of the application list shows the applications from the database shown first.
However, you can change the behaviour via the parameter mapbender.application.sortorder.
mapbender.application.sortorder: yaml-first
db-first: Database applications are shown first, then yaml applications. Internally sorted by title (default).
yaml-first: Yaml applications are shown first, then database applications. Internally sorted by title.
db-only: Only database applications are shown in the applications list, yaml applications are hidden. ⚠️ yaml applications are still accessible by calling /application/<slug>, to completely remove yaml applications, delete the from the config/applications directory in the filesystem.
yaml-only: Only yaml applications are shown in the applications list, database applications are hidden. ⚠️ database applications are still accessible by calling /application/<slug>, to completely remove database applications, temporarily change the parameter value back and delete the applications
title: Applications are sorted by title, independant of origin
date: Applications are sorted by most recent update, independant of origin
SSL certificate
For productive environments, it is important to install a SSL certificate. After that, set the parameters.cookie_secure variable in your parameters.yaml to true. This ensures that the Login cookie is only transmitted over secure connections.
Proxy settings
If you use a proxy, you need to change parameters.yaml.
Hint
OWSProxy3 is a transparent Buzz-based proxy that uses cURL for connection to web resources via/without a proxy server.
Configuration example:
# OWSProxy Configuration
ows_proxy3_logging: false # logging of requests, default is false, true logs in table owsproxy_log
ows_proxy3_obfuscate_client_ip: true # obfuscats a client ip, default is true, true will hide the last byte of the client's ip address
ows_proxy3_host: myproxy # proxy definition for connnection via a proxy server. Host name of the proxy server
ows_proxy3_port: 8080 # proxy definition for connnection via a proxy server. Port name of the proxy server
ows_proxy3_connecttimeout: 60
ows_proxy3_timeout: 90
ows_proxy3_user: ~ # user name for proxy server (set user for proxy server if needed)
ows_proxy3_password: ~ # password for proxy server (set password for proxy server if defined)
ows_proxy3_noproxy: # list of hosts for connnections without proxy server
- 192.168.1.123
Logo and custom branding
In parameters.yaml, you can refer to your own logo and to an alternative image for the login page. This change has a global impact on the whole Mapbender installation.
branding.project_name: Geoportal powered by Mapbender
branding.project_version: 1.0
branding.logo: ./bundles/mapbendercore/image/OSGeo_project.png
branding.login_backdrop: ./bundles/mapbendercore/image/login-backdrop.jpg
The files must be accessible under application/public.
Project name
The name of the project (default: Mapbender) can be changed in parameters.yaml. The change has a global impact on the whole Mapbender installation.
branding.project_name: Geoportal
Warning
In parameters.yaml, tabulators may not be used for indentation. Instead, you need to use the space bar.
Sidelinks
Sidelinks can be added through the use of mapbender.sitelinks.
A sidelinks always needs a link and a text.
mapbender.sitelinks:
- link: https://mapbender.org/en/legal-notice/ # Link URL
text: Imprint & Contact # Link text
- link: https://mapbender.org/en/privacy-policy/
text: Privacy Policy
- link: https://doc.mapbender.org/
text: Documentation
Disabling Elements
Disabling individual elements can be configured using the following parameter:
mapbender.disabled_elements:
- Mapbender\CoreBundle\Element\ResetView
Default layer order
You can define a default layer order when creating new WMS layerset instances.
Allowed values are either * “standard”: Traditional Mapbender behaviour: top-down rendering in GetCapabilities order; also the default if this parameter is not defined * “reverse”: bottom-up, for QGIS server, ArcGIS etc
wms.default_layer_order: standard
Customizing icons
By setting the following parameters, you can enable specific customization of icons:
mapbender.icons.disable_default(default: false).When set to true, the default icons from the Mapbender namespace are disabled in the button edit form. These include the icons About, Area Ruler, Feature Info, Image Export, Layer tree, Legend, Line ruler, and Polygon. These are used, for example, for the similarly named elements: About Dialog, Line/Area Ruler, FeatureInfo, Image Export, Layertree, Legend, Digitizer, and Sketches.
mapbender.icons.disable_default_fa(default: false).When set to true, the default Font Awesome icons are disabled in the button edit form. This applies to all other available icons that are not in the Mapbender namespace.
mapbender.icons.custom(default: ~).Allows adding more icons from FontAwesome (a list of freely available icons can be found on the Font Awesome homepage).
The parameter is an array of objects containing three keys:
name: Identifier for this icon, e.g., for usage in yaml-defined applications.
title: Description of the icon as shown in the selection menu in the button edit form.
class: Full class name (including “fa”) of the icon. Copy it from the lower part of the popup when you click on the icon on the Font Awesome homepage.
With these configuration options, you can customize the icons in Mapbender to suit your requirements. Here’s an example:
mapbender.icons.disable_default: true
mapbender.icons.disable_default_fa: true
mapbender.icons.custom:
- name: iconSnowflake
title: Snowflake
class: fa-solid fa-snowflake
- name: iconHeartbeat
title: Heartbeat
class: fa-solid fa-heart-pulse
Reglar Expression for search requests
The default regular expression for input fields in search/data manager/digitizer.
It can be overridden per search field in the element configuration (pattern) or per data manager field in the form field configuration (attr.pattern).
The default value is ‘.*’, allowing all characters.
mapbender.search.default_regex: '.*'
mapbender.data_manager.default_regex: '.*'
The following setting restrict input to letters, digits, underscores, hyphens and whitespace.
mapbender.search.default_regex: '^[\p{L}0-9_\-\s]*$'
mapbender.data_manager.default_regex: '^[\p{L}0-9_\-\s]*$'
FeatureInfo iframe sandbox options
You can set the sandbox iframe attributes in the feature info dialog,
See https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/iframe#sandbox for options
mapbender.featureinfo.iframe_sandbox_params: 'allow-scripts allow-popups allow-popups-to-escape-sandbox allow-downloads'
Overriding JavaScript and CSS/Sass Resources
To manually override JavaScript and CSS/Sass resources, and as an alternative to overriding in the bundle, you can add the following to your paramaters.yaml file:
mapbender.asset_overrides:
"@MapbenderCoreBundle/Resources/public/sass/element/featureinfo.scss": "@@MyBundle/Resources/public/sass/element/custom_featureinfo.scss"
Note
Please note that the @ sign in the replacement key must be escaped with an additional @@ sign.
YAML Application files
YAML application files are stored under applications/ (underneath config/!). There are files pre-implemented as example applications:
Mapbender Demo (mapbender_user)
Mapbender Demo Basic (mapbender_user_basic)
If you do not want the example applications to be visible you have different way to do this.
Set
mapbender.application.sortorder: db-onlyin your parameters.yaml file.Delete the demo applications.
Edit the demo application with a text editor and set the
publishedvariable to false.
parameters:
applications:
mapbender_user:
[...]
published: false
Then, clear the Mapbender cache and your browser cache. After that, the applications will not be visible for users.
Hint
The root user can always see unpublished applications.
In the same way, new YAML applications can be placed in the folder and will be automatically recognized by Mapbender.
Mapbender Demo Map
This is the main Demo application. It can be optimized for a desktop and mobile use. It contains most of the Mapbender elements.
Detailed descriptions of the elements at Elements.
Mapbender Demo Map basic
Differences to the Mapbender Demo Map. It does not has a sidepane. It offers the elements via buttons. The possibilities of styling via CSS are demonstrated.
Detailed descriptions of the elements at Elements.
Export/import YAML application files with the backend
Export
You can export applications as JSON files under Applications → Export.
You can locate the export button within the application overview page. Find it in the application’s button menu.
Import
Under Applications → Import, an export file can be imported into a Mapbender installation.
To do this, first select the Create Application button. Then click on the Import button:
Then, use the Import mask to load an import file as an application.
Export/import/clone YAML application files over the console
Please go to Application Export, Import & Cloning to see the console commands. Find a few introductional words about exporting and importing applications over the console below.
Export
Applications can be exported as .json or .yaml file over the console.
A YAML file that has been exported over the console cannot be placed under applications/ to be imported in a Mapbender installation. The YAML format that is produced by exporting over the console is different from the YAML format of the files under applications/.
Import
YAML files that have been exported over the user interface or console can be imported over the console.
Clone
Clone/Copy an existing application.