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

    Interface LayerFactory

    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: GroupLayerProperties,
        ): 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<LayerType, string>;
        getTypeNames(): string[];
    }
    Index

    Methods

    • Creates a GroupLayer.

      Parameters

      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<LayerType, string>

    • Returns the currently available type names.

      Returns string[]