Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GeoJSONDirective<T>

Type parameters

  • T

Hierarchy

  • GeoJSON
    • GeoJSONDirective

Implements

  • OnDestroy
  • AfterViewInit

Index

Constructors

constructor

Properties

addEvent

addEvent: EventEmitter<Event> = new EventEmitter()

clickEvent

clickEvent: EventEmitter<MouseEvent> = new EventEmitter()

contextmenuEvent

contextmenuEvent: EventEmitter<MouseEvent> = new EventEmitter()

dataChange

dataChange: EventEmitter<IGenericGeoJSONFeatureCollection<GeometryObject, T>> = new EventEmitter()

dbclickEvent

dbclickEvent: EventEmitter<MouseEvent> = new EventEmitter()

defaultStyle

defaultStyle: PathOptions

Protected initialized

initialized: boolean = false

Protected mapComponent

mapComponent: MapComponent

mousedownEvent

mousedownEvent: EventEmitter<MouseEvent> = new EventEmitter()

mouseoutEvent

mouseoutEvent: EventEmitter<MouseEvent> = new EventEmitter()

mouseoverEvent

mouseoverEvent: EventEmitter<MouseEvent> = new EventEmitter()

onEachFeatureEvent

onEachFeatureEvent: EventEmitter<object> = new EventEmitter()

options

options: GeoJSONOptions

popupDirective

popupDirective: PopupDirective

popupcloseEvent

popupcloseEvent: EventEmitter<PopupEvent> = new EventEmitter()

popupopenEvent

popupopenEvent: EventEmitter<PopupEvent> = new EventEmitter()

removeEvent

removeEvent: EventEmitter<Event> = new EventEmitter()

tooltipDirective

tooltipDirective: TooltipDirective

tooltipcloseEvent

tooltipcloseEvent: EventEmitter<TooltipEvent> = new EventEmitter()

tooltipopenEvent

tooltipopenEvent: EventEmitter<TooltipEvent> = new EventEmitter()

Accessors

data

  • get data(): IGenericGeoJSONFeatureCollection<GeometryObject, T>
  • set data(val: IGenericGeoJSONFeatureCollection<GeometryObject, T>): void

Methods

addData

  • addData(data: IGenericGeoJSONFeature<GeometryObject, T>): Layer
  • Parameters

    • data: IGenericGeoJSONFeature<GeometryObject, T>

    Returns Layer

addEventListener

  • addEventListener(type: string, fn: EventHandlerFn, context?: Object)
  • addEventListener(eventMap: EventHandlerFnMap)
  • Alias for on(...)

    Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').

    Parameters

    • type: string
    • fn: EventHandlerFn
    • Optional context: Object
  • Alias for on(...)

    Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}

    Parameters

    • eventMap: EventHandlerFnMap

addEventParent

  • addEventParent(obj: Evented)
  • Adds an event parent - an Evented that will receive propagated events

    Parameters

    • obj: Evented

addLayer

  • addLayer(layer: Layer)
  • Adds the given layer to the group.

    Parameters

    • layer: Layer

addOneTimeEventListener

  • addOneTimeEventListener(type: string, fn: EventHandlerFn, context?: Object)
  • addOneTimeEventListener(eventMap: EventHandlerFnMap)
  • Alias for once(...)

    Behaves as on(...), except the listener will only get fired once and then removed.

    Parameters

    • type: string
    • fn: EventHandlerFn
    • Optional context: Object
  • Alias for once(...)

    Behaves as on(...), except the listener will only get fired once and then removed.

    Parameters

    • eventMap: EventHandlerFnMap

addTo

  • addTo(map: Map)
  • Parameters

    • map: Map

asFeature

  • asFeature(geojson: GeometryObject): Feature<GeometryObject>
  • asFeature(geojson: Feature<GeometryObject>): Feature<GeometryObject>
  • Normalize GeoJSON geometries/features into GeoJSON features.

    Parameters

    • geojson: GeometryObject

    Returns Feature<GeometryObject>

  • Parameters

    • geojson: Feature<GeometryObject>

    Returns Feature<GeometryObject>

beforeAdd

  • beforeAdd(map: Map)
  • Parameters

    • map: Map

bindPopup

  • bindPopup(content: string, options?: PopupOptions)
  • bindPopup(content: HTMLElement, options?: PopupOptions)
  • bindPopup(content: function, options?: PopupOptions)
  • bindPopup(content: Popup)
  • Parameters

    • content: string
    • Optional options: PopupOptions
  • Parameters

    • content: HTMLElement
    • Optional options: PopupOptions
  • Parameters

    • content: function
        • (layer: Layer): Content
        • Parameters

          • layer: Layer

          Returns Content

    • Optional options: PopupOptions
  • Parameters

    • content: Popup

bindTooltip

  • bindTooltip(content: string, options?: TooltipOptions)
  • bindTooltip(content: HTMLElement, options?: TooltipOptions)
  • bindTooltip(content: function, options?: TooltipOptions)
  • bindTooltip(content: Tooltip, options?: TooltipOptions)
  • Parameters

    • content: string
    • Optional options: TooltipOptions
  • Parameters

    • content: HTMLElement
    • Optional options: TooltipOptions
  • Parameters

    • content: function
        • (layer: Layer): Content
        • Parameters

          • layer: Layer

          Returns Content

    • Optional options: TooltipOptions
  • Parameters

    • content: Tooltip
    • Optional options: TooltipOptions

bringToBack

  • bringToBack()
  • Brings the layer group to the top [sic] of all other layers

bringToFront

  • bringToFront()
  • Brings the layer group to the top of all other layers

clearAllEventListeners

  • clearAllEventListeners()
  • Alias for off()

    Removes all listeners to all events on the object.

clearLayers

  • clearLayers()
  • Removes all the layers from the group.

closePopup

  • closePopup()

closeTooltip

  • closeTooltip()

coordsToLatLng

  • coordsToLatLng(coords: [number, number]): LatLng
  • coordsToLatLng(coords: [number, number, number]): LatLng
  • Creates a LatLng object from an array of 2 numbers (longitude, latitude) or 3 numbers (longitude, latitude, altitude) used in GeoJSON for points.

    Parameters

    • coords: [number, number]

    Returns LatLng

  • Parameters

    • coords: [number, number, number]

    Returns LatLng

coordsToLatLngs

  • coordsToLatLngs(coords: Array<number>, levelsDeep?: number, coordsToLatLng?: function): LatLng[]
  • Creates a multidimensional array of LatLngs from a GeoJSON coordinates array. levelsDeep specifies the nesting level (0 is for an array of points, 1 for an array of arrays of points, etc., 0 by default). Can use a custom coordsToLatLng function.

    Parameters

    • coords: Array<number>
    • Optional levelsDeep: number
    • Optional coordsToLatLng: function
        • (coords: [number, number] | [number, number, number]): LatLng
        • Parameters

          • coords: [number, number] | [number, number, number]

          Returns LatLng

    Returns LatLng[]

eachLayer

  • eachLayer(fn: function, context?: Object)
  • Iterates over the layers of the group, optionally specifying context of the iterator function.

    Parameters

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

          • layer: Layer

          Returns void

    • Optional context: Object

filterFeatures

  • filterFeatures(geoJSON: IGenericGeoJSONFeature<GeometryObject, T>): boolean

fire

  • fire(type: string, data?: Object, propagate?: boolean)
  • Fires an event of the specified type. You can optionally provide a data object — the first argument of the listener function will contain its properties. The event might can optionally be propagated to event parents.

    Parameters

    • type: string
    • Optional data: Object
    • Optional propagate: boolean

fireEvent

  • fireEvent(type: string, data?: Object, propagate?: boolean)
  • Alias for fire(...)

    Fires an event of the specified type. You can optionally provide a data object — the first argument of the listener function will contain its properties. The event might can optionally be propagated to event parents.

    Parameters

    • type: string
    • Optional data: Object
    • Optional propagate: boolean

geometryToLayer

  • geometryToLayer(featureData: Feature<GeometryObject>, options?: GeoJSONOptions): Layer
  • Creates a Layer from a given GeoJSON feature. Can use a custom pointToLayer and/or coordsToLatLng functions if provided as options.

    Parameters

    • featureData: Feature<GeometryObject>
    • Optional options: GeoJSONOptions

    Returns Layer

getAttribution

  • getAttribution(): string
  • Returns string

getBounds

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

    Returns LatLngBounds

getEvents

  • getEvents(): object
  • Returns object

    • [name: string]: function
        • (event: Event): void
        • Parameters

          • event: Event

          Returns void

getLayer

  • getLayer(id: number): Layer
  • Returns the layer with the given internal ID.

    Parameters

    • id: number

    Returns Layer

getLayerId

  • getLayerId(layer: Layer): number
  • Returns the internal ID for a layer

    Parameters

    • layer: Layer

    Returns number

getLayers

  • getLayers(): Array<Layer>
  • Returns an array of all the layers added to the group.

    Returns Array<Layer>

getPane

  • getPane(name?: string): HTMLElement
  • Parameters

    • Optional name: string

    Returns HTMLElement

getPopup

  • getPopup(): Popup
  • Returns Popup

getTooltip

  • getTooltip(): Tooltip
  • Returns Tooltip

hasEventListeners

  • hasEventListeners(type: string): boolean
  • Alias for listens(...)

    Returns true if a particular event type has any listeners attached to it.

    Parameters

    • type: string

    Returns boolean

hasLayer

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

    Parameters

    • layer: Layer

    Returns boolean

invoke

  • invoke(methodName: string, ...params: Array<any>)
  • Calls methodName on every layer contained in this group, passing any additional parameters. Has no effect if the layers contained do not implement methodName.

    Parameters

    • methodName: string
    • Rest ...params: Array<any>

isPopupOpen

  • isPopupOpen(): boolean
  • Returns boolean

isTooltipOpen

  • isTooltipOpen(): boolean
  • Returns boolean

latLngToCoords

  • latLngToCoords(latlng: LatLng): [number, number] | [number, number, number]
  • Reverse of coordsToLatLng

    Parameters

    • latlng: LatLng

    Returns [number, number] | [number, number, number]

latLngsToCoords

  • latLngsToCoords(latlngs: Array<LatLng>, levelsDeep?: number, closed?: boolean): [number, number] | [number, number, number]
  • Reverse of coordsToLatLngs closed determines whether the first point should be appended to the end of the array to close the feature, only used when levelsDeep is 0. False by default.

    Parameters

    • latlngs: Array<LatLng>
    • Optional levelsDeep: number
    • Optional closed: boolean

    Returns [number, number] | [number, number, number]

listens

  • listens(type: string): boolean
  • Returns true if a particular event type has any listeners attached to it.

    Parameters

    • type: string

    Returns boolean

ngAfterViewInit

  • ngAfterViewInit(): void

ngOnDestroy

  • ngOnDestroy(): void

off

  • off(type: string, fn?: EventHandlerFn, context?: Object)
  • off(eventMap: EventHandlerFnMap)
  • off()
  • Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.

    Parameters

    • type: string
    • Optional fn: EventHandlerFn
    • Optional context: Object
  • Removes a set of type/listener pairs.

    Parameters

    • eventMap: EventHandlerFnMap
  • Removes all listeners to all events on the object.

on

  • on(type: string, fn: EventHandlerFn, context?: Object)
  • on(eventMap: EventHandlerFnMap)
  • Adds a listener function (fn) to a particular event type of the object. You can optionally specify the context of the listener (object the this keyword will point to). You can also pass several space-separated types (e.g. 'click dblclick').

    Parameters

    • type: string
    • fn: EventHandlerFn
    • Optional context: Object
  • Adds a set of type/listener pairs, e.g. {click: onClick, mousemove: onMouseMove}

    Parameters

    • eventMap: EventHandlerFnMap

onAdd

  • onAdd(map: Map)
  • Parameters

    • map: Map

onRemove

  • onRemove(map: Map)
  • Parameters

    • map: Map

once

  • once(type: string, fn: EventHandlerFn, context?: Object)
  • once(eventMap: EventHandlerFnMap)
  • Behaves as on(...), except the listener will only get fired once and then removed.

    Parameters

    • type: string
    • fn: EventHandlerFn
    • Optional context: Object
  • Behaves as on(...), except the listener will only get fired once and then removed.

    Parameters

    • eventMap: EventHandlerFnMap

openPopup

  • openPopup()
  • openPopup(latlng: LatLng)
  • openPopup(latlng: LatLngLiteral)
  • openPopup(latlng: LatLngTuple)
  • Parameters

    • latlng: LatLng
  • Parameters

    • latlng: LatLngLiteral
  • Parameters

    • latlng: LatLngTuple

openTooltip

  • openTooltip()
  • openTooltip(latlng: LatLng)
  • openTooltip(latlng: LatLngLiteral)
  • openTooltip(latlng: LatLngTuple)
  • Parameters

    • latlng: LatLng
  • Parameters

    • latlng: LatLngLiteral
  • Parameters

    • latlng: LatLngTuple

pointToLayer

  • pointToLayer(geoJSON: IGenericGeoJSONFeature<Point, T>, latLng: LatLng): Layer

remove

  • remove()

removeEventListener

  • removeEventListener(type: string, fn: EventHandlerFn, context?: Object)
  • removeEventListener(eventMap: EventHandlerFnMap)
  • Alias for off(...)

    Removes a previously added listener function. If no function is specified, it will remove all the listeners of that particular event from the object. Note that if you passed a custom context to on, you must pass the same context to off in order to remove the listener.

    Parameters

    • type: string
    • fn: EventHandlerFn
    • Optional context: Object
  • Alias for off(...)

    Removes a set of type/listener pairs.

    Parameters

    • eventMap: EventHandlerFnMap

removeEventParent

  • removeEventParent(obj: Evented)
  • Removes an event parent, so it will stop receiving propagated events

    Parameters

    • obj: Evented

removeFrom

  • removeFrom(map: Map)
  • Parameters

    • map: Map

removeLayer

  • removeLayer(layer: Layer)
  • removeLayer(id: number)
  • Removes the given layer from the group.

    Parameters

    • layer: Layer
  • Removes the layer with the given internal ID from the group.

    Parameters

    • id: number

resetStyle

  • resetStyle(layer: Layer): Layer
  • Resets the given vector layer's style to the original GeoJSON style, useful for resetting style after hover events.

    Parameters

    • layer: Layer

    Returns Layer

setData

  • setData(val: IGenericGeoJSONFeatureCollection<GeometryObject, T>)

setPopupContent

  • setPopupContent(content: string)
  • setPopupContent(content: HTMLElement)
  • setPopupContent(content: Popup)
  • Parameters

    • content: string
  • Parameters

    • content: HTMLElement
  • Parameters

    • content: Popup

setStyle

  • setStyle(style: StyleFunction)
  • Changes styles of GeoJSON vector layers with the given style function.

    Parameters

    • style: StyleFunction

setTooltipContent

  • setTooltipContent(content: string)
  • setTooltipContent(content: HTMLElement)
  • setTooltipContent(content: Tooltip)
  • Parameters

    • content: string
  • Parameters

    • content: HTMLElement
  • Parameters

    • content: Tooltip

setZIndex

  • setZIndex(zIndex: number)
  • Calls setZIndex on every layer contained in this group, passing the z-index.

    Parameters

    • zIndex: number

styler

  • styler(geoJSON: IGenericGeoJSONFeature<GeometryObject, T>, defaultStyle: PathOptions): PathOptions
  • Parameters

    • geoJSON: IGenericGeoJSONFeature<GeometryObject, T>
    • defaultStyle: PathOptions

    Returns PathOptions

toGeoJSON

  • toGeoJSON(): FeatureCollection<GeometryObject>
  • Returns a GeoJSON representation of the layer group (as a GeoJSON Feature).

    Returns FeatureCollection<GeometryObject>

togglePopup

  • togglePopup()

toggleTooltip

  • toggleTooltip()

unbindPopup

  • unbindPopup()

unbindTooltip

  • unbindTooltip()

Generated using TypeDoc