Creates instances of layers of different types.

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

interface LayerFactory {
    createGroupLayer(opts: any): Promise<{ instance: GroupLayer }>;
    createLayer<Type extends keyof LayerTypesLookup>(
        type: Type,
        options: LayerPropertiesForType<Type>,
    ): Promise<{ instance: LayerClassForType<Type> }>;
    createLayer(
        type: string,
        options: Record<string, any>,
    ): Promise<{ instance: Layer }>;
    getTypeMapping(): Record<string, string>;
    getTypeNames(): string[];
}

Methods

  • Creates a GroupLayer.

    Parameters

    • opts: any

      options of group layer

    Returns Promise<{ instance: GroupLayer }>

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

  • Create a layer of given type.

    Type Parameters

    • Type extends keyof LayerTypesLookup

    Parameters

    • type: Type

      The kind of layer.

    • options: LayerPropertiesForType<Type>

      Options that will be passed during layer construction.

    Returns Promise<{ instance: LayerClassForType<Type> }>

    A promise which will resolve to &#123;instance: Layer&#125;.

  • Second overload for layer types that are not statically known.

    Parameters

    • type: string
    • options: Record<string, any>

    Returns Promise<{ instance: Layer }>

  • Returns a mapping from layer type to esri layer type name.

    Returns Record<string, string>

  • Returns the currently available type names.

    Returns string[]