# Class: FlowCoreMap

Core functionality for Flo.w maps. Wrapped by the <flow-map> web component.

# Hierarchy

  • EventEmitter

    FlowCoreMap

# Constructors

# constructor

+ new FlowCoreMap(id: string, flowContextId: string): FlowCoreMap

Constructs a new FlowCoreMap.

# Parameters:

Name Type Description
id string Map ID.
flowContextId string ID of associated Flo.w context object.

Returns: FlowCoreMap

# Properties

# context

context: FlowCoreContext

The associated Flo.w Context object.


# flowContextId

Readonly flowContextId: string

ID of associated Flo.w context object.


# id

Readonly id: string

Map ID.


# maplibreMap

maplibreMap: Map

The underlying Maplibre GL JS map instance. Use this property to access the full MaplibreGL JS map API (opens new window).

# Accessors

# mapStyle

• get mapStyle(): any

Get the full expanded MaplibreGL Style Specification (opens new window) for this map.

Reactive

Returns: any

# Methods

# export

export(options: FlowMapExportOptions): Promise<string>

Export the current map view as a PNG image.

The image will be downloaded by the browser.

# Parameters:

Name Type Description
options FlowMapExportOptions Export options.

Returns: Promise<string>

A promise that resolves with the filename when the map has been exported.


# getDataSource

getDataSource(id: string): FlowCoreDataSource

Returns the specified map data source.

# Parameters:

Name Type Description
id string Data source ID.

Returns: FlowCoreDataSource


# getPopupOptions

getPopupOptions(id: string): FlowCoreMapPopupOptions

Returns the specified registered popup options.

# Parameters:

Name Type Description
id string Registered popup options ID.

Returns: FlowCoreMapPopupOptions


# initialize

initialize(styleUrl: string, sync: boolean, options: FlowCoreMapOptions): Promise<void>

Initialize the map.

This method is called automatically by the flow-map web component. If instantiating a FlowCoreMap directly, the developer is responsible for calling this method.

# Parameters:

Name Type Description
styleUrl string Base map style URL
sync boolean Specify true to synchronize browser address bar with map location and zoom level.
options FlowCoreMapOptions MaplibrexGL instantiation options.

Returns: Promise<void>


# openPopup

openPopup(lngLat: maplibregl.LngLatLike, optionsOrPopupName?: FlowCoreMapPopupOptions | string): FlowCoreMapPopup

Open a map popup at the specified location.

# Parameters:

Name Type Description
lngLat maplibregl.LngLatLike Map location to open popup.
optionsOrPopupName? FlowCoreMapPopupOptions | string Popup options or ID of registered map popup.

Returns: FlowCoreMapPopup


# registerPopupOptions

registerPopupOptions(popupOptions: FlowCoreMapPopupOptions[]): void

Register named popup options. Used internally to display automatic popups.

# Parameters:

Name Type Description
popupOptions FlowCoreMapPopupOptions[] Popup options.

Returns: void


# removeFeatureState

removeFeatureState(feature: FeatureIdentifier | maplibregl.MapboxGeoJSONFeature, key?: string): void

Programmatically remove feature state properties from a map feature.

# Parameters:

Name Type Description
feature FeatureIdentifier | maplibregl.MapboxGeoJSONFeature Feature to modify. Specify null to modify all map features.
key? string Feature state key to remove. Specify null to remove all feature state for specified feature(s).

Returns: void


# setDataSources

setDataSources(dataSources: FlowCoreDataSource[]): void

Set map data sources.

This method is called internally by the <flow-map> web component. If modified programmatically, any modification will be overwritten by <flow-map>.

# Parameters:

Name Type Description
dataSources FlowCoreDataSource[] Map data sources.

Returns: void


# setFeatureState

setFeatureState(feature: FeatureIdentifier | maplibregl.MapboxGeoJSONFeature, state: FeatureStateProperties): void

Programmatically set feature state properties for a map feature.

# Parameters:

Name Type Description
feature FeatureIdentifier | maplibregl.MapboxGeoJSONFeature Feature to modify.
state FeatureStateProperties Feature state properties to set.

Returns: void


# setLayers

setLayers(layers: FlowCoreMapLayer[]): void

Set map layers.

This method is called internally by the <flow-map> web component. If modified programmatically, any modification will be overwritten by <flow-map>.

# Parameters:

Name Type Description
layers FlowCoreMapLayer[] Map layers.

Returns: void


# uninitialize

uninitialize(): void

Uninitialize the map.

This method is called automatically by the flow-map web component. If instantiating a FlowCoreMap directly, the developer is responsible for calling this method.

Returns: void


# updateBaseStyle

updateBaseStyle(styleUrlOrId: string): Promise<void>

Update the base map style and redraw the map.

# Parameters:

Name Type Description
styleUrlOrId string Base map style URL or ID

Returns: Promise<void>


# zoomBy

zoomBy(increment: number): Promise<void>

Zoom the map by the specified increment.

# Parameters:

Name Type Description
increment number Zoom increment. Specify positive values to zoom in and negative values to zoom out.

Returns: Promise<void>