createMapService Method

Description

Creates a map service based on a declared map scheme, making it available for use in the diagram editor.

Note that mapping is a separately licensed feature of the ESD/SPD Web SDK.

Syntax

.createMapService(/* String */ schemeId, /* Object */ serviceConfiguration);

Parameters

schemeId: String

The ID of a declared map scheme. Four map schemes are pre-declared, 'Bing', 'Google', 'ESRI Custom', and 'ESRI Base Layer'. The first two schemes use the REST-based map image service provided by Google and Bing to place maps in diagrams. The ESRI schemes use the Leaflet javascript library to generate a map image from ESRI map services.

serviceConfiguration: Object

A hash containing information used to initialize the map service. For the Bing and Google map schemes, this should contain one attribute, 'key', with the value set to the API key for Bing or Google maps. The ESRI Base Layer scheme has no options, but the ESRI Custom scheme requires one attribute, 'layerUrls', with the value set to an array of URLs to compatible REST-based map services that will be applied in the specified order as map layers. See the gisConfiguration property documentation for an example.

Remarks

Custom map schemes can be declared to enable the use of other map services. For more information on this, contact PAE support.

Example

editor = new ESDWeb(null, 'editorNode');

editor.startup();

// If the map feature is enabled, create map services and configure the map layer.
if (editor.get('features').some(function (f) { return f === 'GIS'})) {
    editor.createMapService('Bing', {key: '==== Bing Map API Key ====='});
    editor.createMapService('Google', {key: '==== Google Map API Key ====='});
}