Skip to content

To use maps with OpenStreetMap on a site, you have to set the osm.apikey property at the site folder. 

You can obtain the API key from the service provider maptiler. Currently, only this service provider is supported for OSM. Create an account there (this is free up to a certain quota) and create a new key in the Account > Keys menu item. Enter this key in OpenCms in the osm.apikey property.

To use Google Maps on a site, you have to set the google.apikey property at the site folder. 

You can get the API key from Google. Important: Select Maps, Routes and Places for your API key. Enter this key in OpenCms in the google.apikey property. 

Note: Google only provides a limited number of free map queries. Since 2018, this has been 28,500 map requests per month, which is less than 1,000 requests per day. More requests quickly become expensive. Using OSM with maptiler is much more cost-effective. Once Google's free map queries have been used up, the maps will no longer be displayed properly with Google Maps.

In the form editor, Google Maps is always used to create a map or POI in edit mode in order to visually place points on a map.

You therefore always need a key from Google, even if you only want to display OSM maps on the website.

Map queries in edit mode are also counted by Google and further reduce the number of free map queries from Google.

This can lead to the problem that the free quota of Google Maps queries has been used up by the online display, making it impossible for the editorial team to edit the maps after a certain point in the month.

It is therefore possible to store a separate key for the editing mode via the google.apikey.workplace property. Only this separate key is then used for editorial mode. The google.apikey key continues to be used for the online display of Google Maps on the website.

In this case, the map queries for editorial mode are counted separately from the online map queries. Normally, the free Google Maps quota per month is sufficient if it is only used for editorial mode.

The element setting “Cluster markers” affects the initial zoom level for maps with OpenStreetMap. If the “Cluster markers” setting is selected, the map searches for a suitable zoom level when the page is initially loaded so that all markers and bundles are visible in the map section when the page loads.

The number of markers is displayed in a cluster. Clicking on the number will break up the cluster into individual markers.

The zoom level and map section also change automatically when the group of markers changes.

For each group of markers on the map, individual icons can be configured to replace the default icon. This is done in the first tab, “Map data,” when editing the map in the form editor. To do this, activate the “Marker configuration” element. The following fields can be used to configure the individual icon:

  • Group: Enter the name of the group for which the custom icon should apply.
  • Color: Sets the color for the marker icon. If no color is specified, the default color from the CSS is used.
  • Icon: The icon to be used for the markers. Any icon available for Mercury can be entered.
  • Icon on background: If checked, the icon is displayed on a colored background to make it better visible.

It may happen that you want to change your map provider. For example, using Google Maps may get too expensive, and you may want to switch your existing websites to the more cost-effective OSM variant instead. Using a trick in the configuration, it is possible to change the map provider on existing pages without having to manually edit all pages with maps.

This method is particularly useful if there are already hundreds of pages that use a specific map provider and you do not want to change them all manually.

The prerequisite is that you have configured the key google.apikey for Google Maps and the key osm.apikey for OSM. In addition, you must have set the additional key google.apikey.workplace for edit mode.

To switch from Google Maps to OSM, set the google.apikey property to the value “osm” (without quotation marks).

To switch from OSM to Google Maps, set the osm.apikey property to the value “google” (without quotation marks).

The respective property should be set on the folder containing the maps to be changed, e.g., on the start folder of a website.