map.apps Bundle APIs 4.20.0
    Preparing search index...

    Interface BasemapConfigParser

    Parses Basemap configurations.

    Use service name "map-config-api.BasemapConfigParser" to inject an instance of this class.

    interface BasemapConfigParser {
        parse(
            config:
                | string
                | BasemapConfigObject
                | LayerProperties
                | LayerProperties[],
            options?: BasemapProperties,
        ): Promise<{ instance: Basemap }>;
    }
    Index

    Methods

    Methods

    • Parses a basemap configuration.

      Parameters

      Returns Promise<{ instance: Basemap }>

      A promise which resolves to &#123;instance: basemap&#125;.

      // string of well-known basemap
      const result = await configParser.parse("streets", { title: 'Streets' });
      // result instance is @arcgis/core/Basemap, the well-known streets basemap, with custom title
      // string of well-known basemap
      const result = await configParser.parse({ id: "streets" });
      // result instance is @arcgis/core/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 @arcgis/core/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 @arcgis/core/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 @arcgis/core/Basemap, with two custom layers