Map Constructor API

is an easy-to-use online tool for creating maps with directions and marking places on maps. You can put the maps you create on your website or blog. You can also use these maps in accordance with the Commercial API.

To display a map on a webpage, just copy the widget code generated by the Map Constructor and embed it on the page.

You can use the Map Constructor to create two kinds of maps: interactive and static. For interactive maps, the Map Constructor generates a script element, which loads the JavaScript code for creating the map to the page. For a static map, the Map Constructor generates the img element, which contains a link to a page that performs a 301 redirect to the Static API with the specified map parameters.

The Map Constructor API lets you change the map settings by passing the desired parameters in the widget code. For example, you can set the map height and width, as well as its language.

You cannot change the Map Constructor widget code that is generated by using the iframe element.

Interactive map

The interactive map is embedded on the page using the script element. The following map parameters can be set using the src attribute:

  • um — the map ID (required).

    Example of parameter value: um=constructor%3A834e99a97453487e0b040c9619...

    Note. In previous versions of the , the map ID was set in the sid parameter. Example: sid=29uD3jKC-8XFdTlfCwkxSmnSQkYPbrYH. This parameter has been deprecated.
  • width — The width of the map in pixels or percentages. If this parameter is omitted, the map stretches to the entire width of the parent container.
  • height — The height of the map in pixels or percentages. If this parameter is omitted, the map stretches to the entire height of the parent container. If this parameter is specified as a percentage, you must set the height for the parent container, or the map won't be displayed.
  • id — The ID of the DOM element to embed the map in. Specified if the widget is inserted on the page in the element .
  • lang — The locale. The following values are supported: ru_RU (default), ru_UA, uk_UA, en_RU, en_US, tr_TR. For more information, see the section Map localization.
  • scroll — Enable the “zooming the map with the mouse wheel” behavior. Accepts the value "true".
  • apikeyMaps API key. If the API key is not specified, the map will not display the following controls: the search bar, button for the route building, and panoramas.
Note. The widget can be inserted in either the body element or the head element. If the widget code is in the head element, the id parameter must be specified in the src attribute.

If the same widget code with the same id is inserted on a page multiple times, all the maps will be added to the DOM element with the specified id.

Several examples of embedding an interactive map on a page are shown below.

Example 1. Embedding an interactive map with set dimensions

Example 2. Embedding an interactive map in a specific container

Example 3. Embedding an interactive map in a container with set parameters

Static map

A static map is inserted on a page using the img element. Map parameters that can be set in the src attribute:

  • um — the map ID (required).

    Example of parameter value: um=constructor%3A834e99a97453487e0b040c9619...

    Note. In previous versions of the , the map ID was set in the sid parameter. Example: sid=29uD3jKC-8XFdTlfCwkxSmnSQkYPbrYH. This parameter has been deprecated.
  • width — The width of the map, in pixels (if omitted, it is taken from stored map parameters).
  • height — The height of the map, in pixels (if omitted, it is taken from stored map parameters).
  • lang — The locale. The following values are supported: ru_RU (default), ru_UA, uk_UA, en_RU, en_US, tr_TR. For more information, see the section Map localization.
  • apikeyMaps API key. Required if the map is used for commercial purposes. See the Using the commercial version of the API section for more information.
Note. The code snippet can only be embedded in the body element.

The examples below demonstrate placing a static map on a page.

Example 1. Embedding a static map without specifying the size

Example 2. Embedding a static map with set dimensions

Using the commercial version of the API

The Commercial API is intended for commercial purposes. You can use it in closed systems, applications, and software modules. The paid version lifts some restrictions of the standard license.

The commercial version applies to both interactive and static maps.

To use the commercial version of the API with a static map, the element code must specify the parameter apikey — The API key obtained in developer console. For example: