Parses a basemap configuration.
See examples.
Optional
options: anyAdditional properties that will be merged into the basemap instance, e.g. title
.
A promise which resolves to {instance: basemap}
.
// string of well-known basemap
const result = await configParser.parse("streets", { title: 'Streets' });
// result instance is esri/Basemap, the well-known streets basemap, with custom title
// string of well-known basemap
const result = await configParser.parse({ id: "streets" });
// result instance is esri/Basemap, the well-known streets basemap
// config object with custom layer
const result = await configParser.parse({
title: "My Basemap",
baseLayers: [{
"url": "https://myarcgis.com/arcgis/rest/services/MyService/MapServer",
"type": "AGS_TILED"
}]
});
// result instance is esri/Basemap, with a custom layer
// config object with custom layer, but shorter
const result = await configParser.parse({
"url": "https://myarcgis.com/arcgis/rest/services/MyService/MapServer",
"type": "AGS_TILED"
})
// result instance is esri/Basemap, with a custom layer
// config object with custom layers, but shorter
const result = await configParser.parse([{
"url": "https://myarcgis.com/arcgis/rest/services/MyService/MapServer",
"type": "AGS_TILED"
},
{
"url": "https://myarcgis.com/arcgis/rest/services/OtherService/MapServer",
"type": "AGS_TILED"
}])
// result instance is esri/Basemap, with two custom layers
Parses Basemap configurations.
Use service name
"map-config-api.BasemapConfigParser"
to inject an instance of this class.