Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FeatureGroup<T>

Type parameters

Hierarchy

Implements

Index

Constructors

constructor

  • Create a layer group, optionally given an initial set of layers.

    Parameters

    • Optional layers: T[]

    Returns FeatureGroup

Methods

addEventListener

  • addEventListener(type: string, fn: function, context?: any): FeatureGroup<T>
  • addEventListener(eventMap: any, context?: any): FeatureGroup<T>

addLayer

  • Adds a given layer to the group.

    Parameters

    • layer: T

    Returns LayerGroup<T>

addOneTimeEventListener

  • addOneTimeEventListener(type: string, fn: function, context?: any): FeatureGroup<T>
  • Parameters

    Returns FeatureGroup<T>

addTo

  • Adds the group of layers to the map.

    Parameters

    Returns LayerGroup<T>

bindPopup

  • Binds a popup with a particular HTML content to a click on any layer from the group that has a bindPopup method.

    Parameters

    Returns FeatureGroup<T>

bringToBack

  • Brings the layer group to the bottom of all other layers.

    Returns FeatureGroup<T>

bringToFront

  • Brings the layer group to the top of all other layers.

    Returns FeatureGroup<T>

clearAllEventListeners

clearLayers

eachLayer

  • eachLayer(fn: function, context?: any): LayerGroup<T>
  • Iterates over the layers of the group, optionally specifying context of the iterator function.

    Parameters

    • fn: function
        • (layer: T): void
        • Parameters

          • layer: T

          Returns void

    • Optional context: any

    Returns LayerGroup<T>

fire

  • Parameters

    • type: string
    • Optional data: any

    Returns FeatureGroup<T>

fireEvent

getBounds

  • Returns the LatLngBounds of the Feature Group (created from bounds and coordinates of its children).

    Returns LatLngBounds

getLayer

  • getLayer(id: string): T
  • Returns the layer with the given id.

    Parameters

    • id: string

    Returns T

getLayerId

  • getLayerId(layer: ILayer): string

getLayers

  • getLayers(): T[]
  • Returns an array of all the layers added to the group.

    Returns T[]

hasEventListeners

  • hasEventListeners(type: string): boolean

hasLayer

  • hasLayer(layer: T): boolean
  • Returns true if the given layer is currently added to the group.

    Parameters

    • layer: T

    Returns boolean

off

  • Parameters

    • type: string
    • Optional fn: function
    • Optional context: any

    Returns FeatureGroup<T>

  • Parameters

    • Optional eventMap: any
    • Optional context: any

    Returns FeatureGroup<T>

on

  • Parameters

    Returns FeatureGroup<T>

  • Parameters

    • eventMap: any
    • Optional context: any

    Returns FeatureGroup<T>

onAdd

  • onAdd(map: Map): void
  • Should contain code that creates DOM elements for the overlay, adds them to map panes where they should belong and puts listeners on relevant map events. Called on map.addLayer(layer).

    Parameters

    Returns void

onRemove

  • onRemove(map: Map): void
  • Should contain all clean up code that removes the overlay's elements from the DOM and removes listeners previously added in onAdd. Called on map.removeLayer(layer).

    Parameters

    Returns void

once

  • once(type: string, fn: function, context?: any): FeatureGroup<T>
  • Parameters

    Returns FeatureGroup<T>

removeEventListener

  • removeEventListener(type: string, fn?: function, context?: any): FeatureGroup<T>
  • removeEventListener(eventMap?: any, context?: any): FeatureGroup<T>

removeLayer

  • Removes a given layer from the group.

    Parameters

    • layer: T

    Returns LayerGroup<T>

  • Removes a given layer of the given id from the group.

    Parameters

    • id: string

    Returns LayerGroup<T>

setStyle

  • Sets the given path options to each layer of the group that has a setStyle method.

    Parameters

    Returns FeatureGroup<T>

toGeoJSON

  • toGeoJSON(): any
  • Returns a GeoJSON representation of the layer group (GeoJSON FeatureCollection).

    Returns any

Static addInitHook

  • addInitHook(methodName: string, ...args: any[]): void
  • You can also use the following shortcut when you just need to make one additional method call.

    Parameters

    • methodName: string
    • Rest ...args: any[]

    Returns void

Static extend

  • You use L.Class.extend to define new classes, but you can use the same method on any class to inherit from it.

    Parameters

    Returns any