Livemap
This class represents an Embed of a Livemap and allows the developper to interact with it.
Table of contents
Constructors
Methods
- addEventListener
- addMarker
- animateMarker
- aroundMe
- centerTo
- changeFloor
- closeEvent
- closeList
- closePinpoint
- closePopin
- disableAnalytics
- disablePositioningSystem
- disableSidebar
- drawPolyline
- easeTo
- enableAnalytics
- enableSidebar
- findNearestPinpoints
- fitBounds
- getCenter
- getCurrentFloor
- getDeviceAttitude
- getDeviceHeading
- getFloors
- getIndoorLevel
- getIndoorLevels
- getUserLocation
- getZoom
- highlightPinpoints
- navigateFromPinpointToPinpoint
- navigateToPinpoint
- openEvent
- openList
- openPinpoint
- removeEventListener
- removeMarker
- removePolyline
- setBearing
- setCenter
- setDeviceAttitude
- setEvents
- setFilters
- setIndoorFeatureState
- setIndoorLevel
- setPinpoints
- setSourceLists
- setUserAttitude
- setUserLocation
- setZoom
- signInByToken
- signOut
- stopNavigation
- waitForReady
Constructors
constructor
• new default(container
, options
, iframeEmbed?
)
This class is used to create a new livemap
When you do wemap.v1.createLivemap(container, options, useIframe)
, this is the class used behind,
then you are allowed to use this class to interact with the livemap
Parameters
Name | Type | Default value | Description |
---|---|---|---|
container | any | undefined | Container of the livemap |
options | any | undefined | Options of the Livemap (emmid & token entries are mandatory) |
iframeEmbed | boolean | true | Set to false if you want the livemap in the dom |
Methods
addEventListener
▸ addEventListener(eventName
, callback
): any
Register a listener for a specific event type. You can find every listener below with the data it receives.
Example
contentUpdated
livemap.addEventListener('contentUpdated', function(data) {
// data: {
// type: 'pinpoints' | 'events'
// items: Array<Pinpoint | Event>,
// query: {
// query: string
// minaltitude: number
// maxaltitude: number
// tags: Array<string>
// bounds: BoundingBox
// }
// }
});
Example
pinpointClick
livemap.addEventListener('pinpointClick', function() {
});
Example
floorChanged
livemap.addEventListener('floorChanged', function(data) {
// data: {
// floor: Floor
// }
});
Example
permissionsDenied
livemap.addEventListener('permissionsDenied', function(data) {
// data: {
// permissions: string[]
// }
});
Example
deviceAttitudeUpdated
livemap.addEventListener('deviceAttitudeUpdated', function(data) {
// data: {
// attitude: Attitude
// }
});
Example
userLocationUpdated
livemap.addEventListener('userLocationUpdated', function(data) {
// data: {
// userLocation: UserLocation
// }
});
Example
actionButtonClick
livemap.addEventListener('actionButtonClick', function(data) {
// data: {
// item: Pinpoint | Event,
// actionType: 'NAME_OF_ACTION',
// itemType: 'pinpoint' | 'event'
// }
});
Example
pinpointOpen
livemap.addEventListener('pinpointOpen', function(data) {
// data: { pinpoint: Pinpoint }
});
Example
pinpointClose
livemap.addEventListener('pinpointClose', function() {
});
Example
eventOpen
livemap.addEventListener('eventOpen', function(data) {
// data: { event: Event }
});
Example
eventClose
livemap.addEventListener('eventClose', function() {
});
Example
multipointOpen
livemap.addEventListener('multipointOpen', function(data) {
// data: {
// latitude: number,
// longitude: number,
// pinpoints: Array<Pinpoint>,
// events: Array<Event>
// }
});
Example
multipointClose
livemap.addEventListener('multipointClose', function() {
});
Example
listOpen
livemap.addEventListener('listOpen', function(data) {
// data: { list: List }
});
Example
listClose
livemap.addEventListener('listClose', function() {
});
Example
mapMoved
livemap.addEventListener('mapMoved', function(data) {
// data: {
// zoom: number,
// bounds: {
// northEast: {
// latitude: number,
// longitude: number
// },
// southWest: {
// latitude: number,
// longitude: number
// }
// },
// latitude: number,
// longitude: number
// }
});
Example
mapClick
livemap.addEventListener('mapClick', function(data) {
// data: {
// latitude: number,
// longitude: number
// }
});
Example
mapLongClick
livemap.addEventListener('mapLongClick', function(data) {
// data: {
// latitude: number,
// longitude: number
// }
});
Example
guidingStarted
livemap.addEventListener('guidingStarted', function() {
});
Example
guidingUpdated
livemap.addEventListener('guidingUpdated', function(data) {
// data: {
// remainingDistance: number
// }
});
Example
guidingStopped
livemap.addEventListener('guidingStopped', function() {
});
Example
fullscreenEnter
livemap.addEventListener('fullscreenEnter', function() {
});
Example
fullscreenExit
livemap.addEventListener('fullscreenExit', function() {
});
Parameters
Name | Type | Description |
---|---|---|
eventName | string | Name of event |
callback | any | Callback to receive the events |
Returns
any
a promise that resolves if no exception is raised.
addMarker
▸ addMarker(marker
): Promise
<Marker
& { id
: string
}>
Add marker to the map
Example
const marker = {
coordinates: {
latitude: 43.609138,
longitude: 3.884193
},
img: 'http://1.bp.blogspot.com/_2IU2Nt4rD1k/S7NYdiVpUeI/AAAAAAAABRY/YWJbdCPlllI/s400/Eiffel_Tower.JPG'
};
livemap.addMarker(marker);
See
removeMarker to remove the marker with its id.
Parameters
Name | Type | Description |
---|---|---|
marker | Marker | marker to add on map |
Returns
Promise
<Marker
& { id
: string
}>
a promise which resolves with the marker with the id generated for the marker This id can be used to remove the marker
animateMarker
▸ animateMarker(ppid
, animation
, duration
): Promise
<void
>
Animate a marker
Example
var ppid = 1234;
var animation = "bounce";
var duration = 2000;
livemap.animateMarker(ppid, animation, duration);
Parameters
Name | Type | Description |
---|---|---|
ppid | number | Id of pinpoint |
animation | "scale" | "bounce" | name of animation, currently available (bounce|scale) |
duration | number | duration of animation in ms |
Returns
Promise
<void
>
a promise that resolves when animation is fired
aroundMe
▸ aroundMe(): Promise
<void
>
Center the map on the user's location.
Example
livemap.aroundMe();
Returns
Promise
<void
>
a promise that resolves if no exception is raised.
centerTo
▸ centerTo(center
, zoom
, animate
): Promise
<void
>
Center the map on the given position and set the zoom level.
Example
var center = { latitude: 43.609395, longitude: 3.884215 };
var zoom = 13;
livemap.centerTo(center, zoom);
Parameters
Name | Type | Description |
---|---|---|
center | Coordinates | New center |
zoom | number | New zoom level |
animate | boolean | Whether to animate the map movement |
Returns
Promise
<void
>
a promise that resolves if no exception is raised.
changeFloor
▸ changeFloor(floor
): Promise
<void
>
Change the floor displayed on the map.
Example
const floor = '1';
livemap.changeFloor(floor);
Parameters
Name | Type |
---|---|
floor | string |
Returns
Promise
<void
>
a promise which resolves when the action has been sent to the Livemap.
closeEvent
▸ closeEvent(): Promise
<void
>
Close the current opened event. Go to the search view.
Example
livemap.closeEvent();
Returns
Promise
<void
>
a promise that resolves if no exception is raised.
closeList
▸ closeList(): Promise
<void
>
Close the current opened list. Go to the search view.
Example
livemap.closeList();
Returns
Promise
<void
>
a promise that resolves if no exception is raised.
closePinpoint
▸ closePinpoint(): Promise
<void
>
Close the current opened pinpoint. Go to the search view.
Example
livemap.closePinpoint();
Returns
Promise
<void
>
a promise that resolves if no exception is raised.
closePopin
▸ closePopin(): Promise
<void
>
Close the current opened popin
Example
livemap.closePopin();
Returns
Promise
<void
>
a promise that resolves if no exception is raised.
disableAnalytics
▸ disableAnalytics(): Promise
<void
>
Disable analytics tracking
Example
livemap.disableAnalytics()
Returns
Promise
<void
>
disablePositioningSystem
▸ disablePositioningSystem(): Promise
<void
>
Disable the inner positioning system You can still use setUserLocation to set the user location and use your own positioning system
Returns
Promise
<void
>
a promise that resolves if no exception is raised.
disableSidebar
▸ disableSidebar(): Promise
<void
>
Disable sidebar.
Example
livemap.disableSidebar()
Returns
Promise
<void
>
drawPolyline
▸ drawPolyline(coordinates
, options?
): any
Description
Draw a polyline on the map between multiple coordinates. You can either draw a raw array of coordinates or use our itinerary service to draw a route between multiple points.
Example
Draw basic raw polyline
livemap.drawPolyline([{latitude: 43.3, longitude: 3.2}, {latitude: 43.2, longitude: 3.1}, {latitude: 43.3, longitude: 3.1}]);
Example
Draw polyline between 2 coordinates with itinerary service
livemap.drawPolyline([{latitude: 43.3, longitude: 3.2}, {latitude: 43.2, longitude: 3.1}], { useNetwork: true });
Example
Draw polyline with custom width, opacity, color
livemap.drawPolyline([{latitude: 43.3, longitude: 3.2}, {latitude: 43.2, longitude: 3.1}], { color: '#FF0000', width: 5, opacity: 0.5 });
See
removePolyline to remove the polyline with its id.
Parameters
Name | Type | Description |
---|---|---|
coordinates | Coordinates [] | Array of coordinates |
options? | Object | Options for the polyline |
options.color? | string | Color of the polyline. Default is wemap color (#2F7DE1) |
options.opacity? | number | Opacity of the polyline. Default is 0.8 |
options.useNetwork? | boolean | If true, the itinerary service will be used to draw the polyline. |
options.width? | number | Width of the polyline. Default is 4 |
Returns
any
a promise that resolves with the id and the geometry (geojson LineString) of the polyline created if no error is raised. This is a temporary unique id that can be used to remove the polyline.
easeTo
▸ easeTo(options
): Promise
<void
>
Set the map's geographical center.
Example
livemap.easeTo({center: {latitude: 43, longitude: 3}, zoom: 9, duration: 5000});
Parameters
Name | Type | Description |
---|---|---|
options | EaseToOptions | Ease to options |
Returns
Promise
<void
>
a promise that resolves if no exception is raised.
enableAnalytics
▸ enableAnalytics(): Promise
<void
>
Enable analytics tracking
Example
livemap.enableAnalytics()
Returns
Promise
<void
>
enableSidebar
▸ enableSidebar(): Promise
<void
>
Enable sidebar.
Example
livemap.enableSidebar()
Returns
Promise
<void
>
findNearestPinpoints
▸ findNearestPinpoints(options
): Promise
<Pinpoint
[]>
Find the nearest pinpoints from a point.
Example
var center = { latitude: 43.609395, longitude: 3.884215 };
livemap.findNearestPinpoints({ center: center })
.then(function(pinpoints) {
// do something
});
Parameters
Name | Type | Description |
---|---|---|
options | Object | Options for the search. Available options are: center. |
options.center | Coordinates | center for the search. |
Returns
Promise
<Pinpoint
[]>
a promise that resolves with the nearest pinpoints.
fitBounds
▸ fitBounds(bounds
, options?
): any
Fit the map on given bounds.
Example
var bounds = [2.294481, 43.609138, 3.884193, 48.85837];
var options = {
padding: {
top: 65
}
};
livemap.fitBounds(bounds, options);
Parameters
Name | Type | Description |
---|---|---|
bounds | [number , number , number , number ] | [W,S,E,N] Coordinates bounds to fit on. |
options? | Object | Options for the action. Available options are: padding. |
options.animate? | boolean | If animation should occur |
options.padding? | Object | {bottom, top, left, right} padding to add to bounds. |
options.padding.bottom | number | - |
options.padding.left | number | - |
options.padding.right | number | - |
options.padding.top | number | - |
Returns
any
a promise that resolves if no exception is raised.
getCenter
▸ getCenter(): Promise
<Coordinates
>
Return the map's geographical center.
Example
livemap.getCenter().then(function(center) {
// Do something with center
});
Returns
Promise
<Coordinates
>
a promise that resolves with the map center.
getCurrentFloor
▸ getCurrentFloor(): Promise
<undefined
| Floor
>
Get current floor displayed
Example
livemap.getCurrentFloor().then(function(floor) {
console.log(floor);
});
Returns
Promise
<undefined
| Floor
>
a promise which resolves with the current floor or null if the map has no floors.
getDeviceAttitude
▸ getDeviceAttitude(): any
Get the device attitude. The promise resolve with null if the livemap is not listening on device attitude.
Example
livemap.getDeviceAttitude().then(function(attitude) {
// Do something with attitude
});
Returns
any
a promise which resolves with the device heading if no error occured.
getDeviceHeading
▸ getDeviceHeading(): any
Get the user heading. The promise resolve with null if the livemap is not listening on user heading.
Example
livemap.getDeviceHeading().then(function(heading) {
// Do something with heading
});
Returns
any
a promise which resolves with the user heading if no error occured.
getFloors
▸ getFloors(): Promise
<Floor
[]>
Get floors available on the map
Example
livemap.getFloors().then(function(floors) {
console.log(floors);
});
Returns
Promise
<Floor
[]>
a promise which resolves with the floors available on the map.
getIndoorLevel
▸ getIndoorLevel(): Promise
<IndoorLevelType
>
Get current indoor level
Example
livemap.getIndoorLevel().then(function(indoorLevel) {
console.log(indoorLevel);
});
Returns
Promise
<IndoorLevelType
>
a promise which resolves with current indoor level if no error occured
getIndoorLevels
▸ getIndoorLevels(): Promise
<IndoorLevelType
[]>
Get all indoor levels
Example
livemap.getIndoorLevels().then(function(indoorLevels) {
console.log(indoorLevels);
});
Returns
Promise
<IndoorLevelType
[]>
a promise which resolves with all indoor levels if no error occured
getUserLocation
▸ getUserLocation(): Promise
<UserLocation
>
Get the user location. Return a promise with the user location if the user accepts to share his location.
Example
livemap.getUserLocation().then(function(location) {
// Do something with location
});
Returns
Promise
<UserLocation
>
a promise which resolves with the user location is no error occured.
getZoom
▸ getZoom(): Promise
<number
>
Return the map's zoom level.
Example
livemap.getZoom().then(function(zoom) {
// Do something with zoom
});
Returns
Promise
<number
>
a promise that resolves with the current zoom level.
highlightPinpoints
▸ highlightPinpoints(pinpointsId
): any
Highlight pinpoints on the map
Parameters
Name | Type | Description |
---|---|---|
pinpointsId | number [] | Pinpoints to highlight the map. |
Returns
any
navigateFromPinpointToPinpoint
▸ navigateFromPinpointToPinpoint(startPinpoint
, endPinpoint
): Promise
<void
>
Start the navigation between two given pinpoints.
Example
var startPinpoint = {
id: 1234,
latitude: 43.609395,
longitude: 3.884215
};
var endPinpoint = {
id: 1234,
latitude: 43.6094,
longitude: 3.884789
};
livemap.navigateFromPinpointToPinpoint(startPinpoint, endPinpoint);
Parameters
Name | Type | Description |
---|---|---|
startPinpoint | Pinpoint | Pinpoint representing the start location. |
endPinpoint | Pinpoint | Destination pinpoint |
Returns
Promise
<void
>
navigateToPinpoint
▸ navigateToPinpoint(ppid
, startLocation?
, initialHeading?
): Promise
<void
>
Start navigation to a pinpoint. Can be an absolute navigation (start location based on phone sensors) or a relative navigation (given start location & heading). If start location and initialHeading are not provided, the navigation will start with the user location
Example
var pinpointId = 1234;
livemap.navigateToPinpoint(pinpointId)
Example
var pinpointId = 1234;
var startLocation = { latitude: 43.609395, longitude: 3.884215 };
var initialHeading = 190;
livemap.navigateToPinpoint(pinpointId, startLocation, initialHeading)
Parameters
Name | Type | Default value | Description |
---|---|---|---|
ppid | number | undefined | Id of the destination pinpoint. |
startLocation? | null | null | For relative navigation only. Navigation start location { lat, lng, alt }. |
initialHeading? | null | null | For relative navigation only. Navigation start heading (in degrees). |
Returns
Promise
<void
>
a promise that resolves once the navigation is correctly started.
openEvent
▸ openEvent(eid
): Promise
<void
>
Open an event on the map. This can only be used for maps which use events.
Example
var eid = 1234;
livemap.openEvent(eid);
Parameters
Name | Type | Description |
---|---|---|
eid | number | Event ID |
Returns
Promise
<void
>
a promise that resolves if no exception is raised.
openList
▸ openList(lid
): Promise
<void
>
Open a list on the map.
Example
var lid = 1234;
livemap.openList(lid);
Parameters
Name | Type | Description |
---|---|---|
lid | number | List ID |
Returns
Promise
<void
>
a promise that resolves if no exception is raised.
openPinpoint
▸ openPinpoint(pid
, options?
): Promise
<void
>
Open a pinpoint on the map.
Example
var pid = 1234;
livemap.openPinpoint(pid);
Parameters
Name | Type | Description |
---|---|---|
pid | number | Pinpoint ID |
options? | OpenPinpointOptions | options to open pinpoint |
Returns
Promise
<void
>
a promise that resolves if no exception is raised.
removeEventListener
▸ removeEventListener(eventName
, callback
): any
Remove the given listener for a specific event type.
Example
var myCallback = function(pinpoint) {
// Do something
};
// Add listener
livemap.addEventListener('contentUpdated', myCallback);
// Remove listener
livemap.removeEventListener('contentUpdated', myCallback);
Parameters
Name | Type | Description |
---|---|---|
eventName | string | Name of event |
callback | any | Callback to remove |
Returns
any
a promise that resolves if no exception is raised.
removeMarker
▸ removeMarker(id
): Promise
<void
>
Remove marker to the map
Example
const marker = {
coordinates: {
latitude: 43.609138,
longitude: 3.884193
},
img: 'http://1.bp.blogspot.com/_2IU2Nt4rD1k/S7NYdiVpUeI/AAAAAAAABRY/YWJbdCPlllI/s400/Eiffel_Tower.JPG'
};
livemap.addMarker(marker).then(function(marker) {
livemap.removeMarker(marker.id)
});
Example
With async/await
const marker = {
coordinates: {
latitude: 43.609138,
longitude: 3.884193
},
img: 'http://1.bp.blogspot.com/_2IU2Nt4rD1k/S7NYdiVpUeI/AAAAAAAABRY/YWJbdCPlllI/s400/Eiffel_Tower.JPG'
};
const marker = await livemap.addMarker(marker);
livemap.removeMarker(marker.id);
Parameters
Name | Type | Description |
---|---|---|
id | string | Marker id to remove |
Returns
Promise
<void
>
a promise which resolves if no exception is raised.
removePolyline
▸ removePolyline(id
): Promise
<void
>
Remove a polyline from the map
Example
livemap.drawPolyline([{latitude: 43.3, longitude: 3.2}, {latitude: 43.2, longitude: 3.1}], { useNetwork: true }).then(function(polyline) {
// Now that you have the id you can remove it when you want
livemap.removePolyline(polyline.id);
});
Example
With async/await
const polyline = await livemap.drawPolyline([{latitude: 43.3, longitude: 3.2}, {latitude: 43.2, longitude: 3.1}], { useNetwork: true });
livemap.removePolyline(polyline.id);
Parameters
Name | Type | Description |
---|---|---|
id | string | id of polyline |
Returns
Promise
<void
>
a promise that resolves if no error is raised
setBearing
▸ setBearing(bearing
, options?
): Promise
<void
>
Set the map's bearing.
Example
var bearing = 90;
livemap.setBearing(bearing);
Example
var bearing = 10;
var options = {
duration: 1000
};
livemap.setBearing(bearing, options);
Parameters
Name | Type | Description |
---|---|---|
bearing | number | New bearing (in degrees) |
options? | Object | - |
options.duration? | number | Duration of animation in ms |
Returns
Promise
<void
>
a promise which resolves when the action has been sent to the Livemap.
setCenter
▸ setCenter(center
): Promise
<void
>
Set the map's geographical center.
Example
var center = { latitude: 43.609395, longitude: 3.884215 };
livemap.setCenter(center);
Parameters
Name | Type | Description |
---|---|---|
center | Coordinates | New center |
Returns
Promise
<void
>
a promise that resolves if no exception is raised.
setDeviceAttitude
▸ setDeviceAttitude(attitude
): Promise
<void
>
Set the user attitude.
Parameters
Name | Type |
---|---|
attitude | any |
Returns
Promise
<void
>
a promise that resolves if no exception is raised.
setEvents
▸ setEvents(events
): Promise
<void
>
Populates the map with given events.
Example
const container = document.getElementById('wemap-container');
const options = {
emmid: 7087,
token: 'at5819f0d0844cd5.60578643'
};
const livemap = wemap.v1.createLivemap(container, options);
const pinpoint = {
id: 1,
name: 'Wemap Office',
latitude: 43.609138,
longitude: 3.884193,
description: 'Where magic happens'
};
const events = [{
id: 1,
name: 'First event',
pinpoint: pinpoint,
description: 'The description of my great event',
dates: [
{
start: '2018-09-15T08:00:00.000Z',
end: '2018-09-16T08:00:00.000Z'
}
]
}];
livemap.setEvents(events)
.then(() => {
// now you can open one of the created events
livemap.openEvent(1);
});
Parameters
Name | Type | Description |
---|---|---|
events | Event [] | Events to populate the map. |
Returns
Promise
<void
>
a promise which resolves if no exception is raised. The resolved object contains the bounds property that encompasses all the pinpoints of the events given as input. Facilitates the use of the fitBounds method.
setFilters
▸ setFilters(filters
, options?
): Promise
<void
>
Update search filters (dates, tags, text).
Example
var filters = {
startDate: '2017-02-01',
endDate: '2017-02-05',
query: 'arts décoratifs',
tags: ['monument-historique', 'musee-de-france']
};
* livemap.setFilters(filters);
*
*
Parameters
Name | Type | Description |
---|---|---|
filters | Filters | Filters to apply to the search * |
options? | Object | Object of options * |
options.type? | "add" | "replace" | Object of options * |
Returns
Promise
<void
>
a promise that resolves if no exception is raised.
setIndoorFeatureState
▸ setIndoorFeatureState(id
, state
): Promise
<void
>
Set state selected or not of an indoor feature
Example
livemap.setIndoorFeatureState(1234, {selected: true});
Parameters
Name | Type | Description |
---|---|---|
id | number | id of pinpoint |
state | IndoorFeatureState | New state |
Returns
Promise
<void
>
a promise that resolves if no exception is raised.
setIndoorLevel
▸ setIndoorLevel(level
): Promise
<void
>
Set indoor level
Example
livemap.setIndoorLevel(1);
Parameters
Name | Type |
---|---|
level | number |
Returns
Promise
<void
>
a promise which resolves if no error occured
setPinpoints
▸ setPinpoints(pinpoints
, options?
): Promise
<void
>
Populates the map with given pinpoints.
Example
Simple usage
var container = document.getElementById('wemap-container');
var options = {
emmid: 7087,
token: 'at5819f0d0844cd5.60578643'
};
var livemap = wemap.v1.createLivemap(container, options);
var pinpoints = [
{
id: 1,
name: 'Wemap Office',
latitude: 43.609138,
longitude: 3.884193,
description: 'Where magic happens'
},
{
id: 2,
name: 'Effeil Tower',
latitude: 48.858370,
longitude: 2.294481,
description: 'What is that ?',
media_url: 'http://1.bp.blogspot.com/_2IU2Nt4rD1k/S7NYdiVpUeI/AAAAAAAABRY/YWJbdCPlllI/s400/Eiffel_Tower.JPG',
media_type: 'image'
}
];
livemap.setPinpoints(pinpoints)
.then(function() {
// now you can open one of the created pinpoints
livemap.openPinpoint(2);
});
Example
Usage of add type option
var container = document.getElementById('wemap-container');
var options = {
emmid: 7087,
token: 'at5819f0d0844cd5.60578643'
};
var livemap = wemap.v1.createLivemap(container, options);
var pinpoint1 = {
id: 1,
name: 'Wemap Office',
latitude: 43.609138,
longitude: 3.884193,
description: 'Where magic happens'
};
var pinpoint2 = {
id: 2,
name: 'Effeil Tower',
latitude: 48.858370,
longitude: 2.294481,
description: 'What is that ?',
media_url: 'http://1.bp.blogspot.com/_2IU2Nt4rD1k/S7NYdiVpUeI/AAAAAAAABRY/YWJbdCPlllI/s400/Eiffel_Tower.JPG',
media_type: 'image'
};
var options = {
type: 'add'
};
livemap.setPinpoints([pinpoint1], options);
livemap.setPinpoints([pinpoint2], options);
// Both pinpoints are on the map as we add pinpoint instead of replacing currents
Parameters
Name | Type | Description |
---|---|---|
pinpoints | AtLeast <Pinpoint , "latitude" | "longitude" | "name" | "id" >[] | Pinpoints to populate the map. |
options? | Object | options how to populate the map. |
options.type? | "add" | "replace" | Type of how the map is populated. |
Returns
Promise
<void
>
a promise which resolves if no exception is raised. The resolved object contains the bounds property that encompasses all the points given as input. Facilitates the use of the fitBounds method.
setSourceLists
▸ setSourceLists(lists
): Promise
<void
>
Define lists in which the map will source its content in addition of current points of the map
Example
livemap.setSourceLists([1234, 5678]);
Parameters
Name | Type |
---|---|
lists | number [] |
Returns
Promise
<void
>
a promise that resolves if no exception is raised.
setUserAttitude
▸ setUserAttitude(attitude
): Promise
<void
>
Deprecated
Use setDeviceAttitude instead. Set the user attitude.
Parameters
Name | Type |
---|---|
attitude | any |
Returns
Promise
<void
>
a promise that resolves if no exception is raised.
setUserLocation
▸ setUserLocation(location
): Promise
<void
>
Set the user’s location.
A marker will be added to show the user’s location on the map. If the map features multiple floors, the marker will only be visible on the corresponding floor.
Parameters
Name | Type |
---|---|
location | UserLocation |
Returns
Promise
<void
>
a promise that resolves if no exception is raised.
setZoom
▸ setZoom(zoom
): Promise
<void
>
Set the map's zoom level.
Example
var zoom = 8;
livemap.setZoom(zoom);
Parameters
Name | Type | Description |
---|---|---|
zoom | number | New zoom |
Returns
Promise
<void
>
a promise which resolves when the action has been sent to the Livemap.
signInByToken
▸ signInByToken(accessToken
): Promise
<void
>
Sign user with token.
Example
// Sign user with token.
livemap.signInByToken(accessToken);
Parameters
Name | Type | Description |
---|---|---|
accessToken | string | access token |
Returns
Promise
<void
>
a promise that resolves if no exception is raised.
signOut
▸ signOut(): Promise
<void
>
Sign out the current user
Example
livemap.signOut();
Returns
Promise
<void
>
a promise that resolves if no exception is raised.
stopNavigation
▸ stopNavigation(): Promise
<void
>
Stop the currently running navigation.
Example
livemap.stopNavigation();
Returns
Promise
<void
>
a promise that resolves if no error occurs.
waitForReady
▸ waitForReady(): Promise
<void
>
Simply resolve when the Livemap is ready. Use this function to ensure that the livemap is ready before interacting with.
Example
livemap.waitForReady().then(function() {
// You can safely interact with the livemap object
});
Returns
Promise
<void
>
A promise which resolves when the Livemap is ready.
Types
Coordinates
Coordinates: Object
Type declaration
Name | Type |
---|---|
latitude | number |
longitude | number |
EaseToOptions
EaseToOptions: MapboxEaseToOptions
& { center?
: Coordinates
}
Event
Event: Object
Type declaration
Name | Type |
---|---|
dates | { end : string ; start : string }[] |
description | string |
external_data | object |
id | number |
name | string |
pinpoint | Pinpoint |
Filters
Filters: Object
Type declaration
Name | Type |
---|---|
endDate? | string |
query? | string |
startDate? | string |
tags? | string [] |
Floor
Floor: Object
Type declaration
Name | Type |
---|---|
bounds? | { northEast : { latitude : number ; longitude : number } ; southWest : { latitude : number ; longitude : number } } |
bounds.northEast | { latitude : number ; longitude : number } |
bounds.northEast.latitude | number |
bounds.northEast.longitude | number |
bounds.southWest | { latitude : number ; longitude : number } |
bounds.southWest.latitude | number |
bounds.southWest.longitude | number |
maxaltitude | number |
minaltitude | number |
name | string |
Marker
Marker: Object
Type declaration
Name | Type |
---|---|
anchor? | "center" | "top" | "bottom" | "left" | "right" | "top-left" | "top-right" | "bottom-left" | "bottom-right" |
coordinates | { latitude : number ; longitude : number } |
coordinates.latitude | number |
coordinates.longitude | number |
img | string |
label? | string |
Pinpoint
Pinpoint: Object
Type declaration
Name | Type |
---|---|
address | string |
altitude | number |
description | string |
external_data | object |
id | number |
image_url | string |
latitude | number |
link_url | string |
longitude | number |
name | string |
UserLocation
UserLocation: Object
Type declaration
Name | Type |
---|---|
accuracy | number |
altitude | number |
latitude | number |
longitude | number |