Skip to content

Map

Panoramax.components.ui.Map ⇐ maplibregl.Map

Kind: static class of Panoramax.components.ui
Extends: maplibregl.Map
Emits: sequence-hover, sequence-click, picture-click, ready

new Map(parent, container, [options])

Map is the component showing pictures and sequences geolocation.

Note that all functions of MapLibre GL JS class Map are also available.

A more complete version of Map (with filters & themes) is available through MapMore class

ℹ️ Many style management is done in MapStyleComposer, which is available as a property of parent component.

⚠️ This class doesn't inherit from EventTarget, so it doesn't have addEventListener and dispatchEvent functions. It uses instead on and fire functions from MapLibre Map class. fire function doesn't take directly Event objects, but a string and object data. A shorthand addEventListener function is added for simpler usage.

Param Type Default Description
parent Basic The parent view
container Element The DOM element to create into
[options] object The map options (any of MapLibre GL settings or any supplementary option defined here)
[options.raster] object The MapLibre raster source for aerial background. This must be a JSON object following MapLibre raster source definition.
[options.basemaps] object List of complementary basemaps, as { id: {MapLibre Style JSON or URL} }. Note that special IDs streets and aerial are reserved for default backgrounds.
[options.background] string "streets" Choose default map background to display (streets or aerial, if raster aerial background available). Defaults to street.
[options.attributionControl.customAttribution] string To override default map attribution.
[options.picMarkerDraggable] boolean To make the picture marker draggable, default to false.
[options.indoor] object The indoor= MapLibre plugin options. This must be a JSON object following IndoorEqual parameters. Note that this is only available if maplibre-gl-indoorequal plugin is loaded in your web page.
[options.indoor.level] string (only if indoor= plugin is enabled) The initial indoor level to display. Defaults to ground or disabled depending on indoor map availability. Do not use if visible=false.
[options.indoor.visible] boolean true (only if indoor= plugin is enabled) The initial indoor visibility. Set to false to avoid data loading before user explicitly enables indoor through widgets. If set to false, you may not set any level option in component.

Example

const map = new Panoramax.components.ui.Map(viewer, mapNode, {center: {lat: 48.7, lng: -1.7}});

map.destroy()

Destroy any form of life in this component

Kind: instance method of Map

map.waitForEnoughMapLoaded() ⇒ Promise

Helper to know when enough map background and Panoramax tiles are loaded for a proper display.

Kind: instance method of Map
Returns: Promise - Resolves when enough is loaded

map.reloadVectorTiles()

Force refresh of vector tiles data

Kind: instance method of Map

map.displayPictureMarker(lon, lat, heading, [skipCenter], [picId])

Shows on map a picture position and heading.

If no longitude & latitude are set, marker is removed from map.

Kind: instance method of Map

Param Type Default Description
lon number The longitude
lat number The latitude
heading number The heading
[skipCenter] boolean false Set to true to avoid map centering on marker
[picId] string null The picture Id

map.addEventListener(type, listener)

Listen to map events. This is a binder to on and once MapLibre GL functions.

Kind: instance method of Map

Param Type Default Description
type string The event type to listen for
listener function The event handler
[options.once] boolean false Set to true to only listen to first event.

"ready"

Event when map is ready to display. This includes Maplibre initial load, enough map data display and styling.

Kind: event emitted by Map

"sequence-hover"

Event when a sequence on map is hovered (not selected)

Kind: event emitted by Map
Properties

Name Type Description
seqId string The hovered sequence ID

"sequence-click"

Event when a sequence on map is clicked

Kind: event emitted by Map
Properties

Name Type Description
seqId string The clicked sequence ID
coordinates maplibregl.LngLat The coordinates of user click

"picture-click"

Event when a picture on map is clicked

Kind: event emitted by Map
Properties

Name Type Description
picId string The clicked picture ID
seqId string The clicked picture's sequence ID
feature object The GeoJSON feature of the picture