Scandit.Ui.Map

new Map(options: object)

Creates new instance of Map

Parameters:
Name Type Description
options object

Map configuration

Properties
Name Type Attributes Default Description
size float <optional>
1.0

Determines size of the map. Value ranges from 0.0 - 1.0 and denotes the space reserved for the map.

position string <optional>
top

Position of the map. Possible values: top, bottom

mapType string <optional>
normal

Type of the map. Possible values: normal, hybrid, satellite, terrain

location double[] <optional>
null

Position of the map view.

zoom integer <optional>
5

View zoom level.

uiZoomControls boolean <optional>
false

Controls whether zoom controls are enabled or disabled.

uiCompass boolean <optional>
false

Controls whether the compass button is enabled or disabled.

uiZoomGestures boolean <optional>
false

Controls whether zoom gestures are enabled or disabled. If enabled, users may double tap, two-finger tap, or pinch to zoom the camera. Note that double tapping or pinching when scrollGestures are enabled may pan the camera to the specified point.

uiScrollGestures boolean <optional>
false

Controls whether scroll gestures are enabled or disabled. If enabled, users may swipe to pan the camera.

uiRotateGestures boolean <optional>
false

Controls whether rotate gestures are enabled or disabled. If enabled, users may use a two-finger rotate gesture to rotate the camera.

uiTiltGestures boolean <optional>
false

Controls whether tilt gestures are enabled or disabled. If enabled, users may use a two-finger vertical down or up swipe to tilt the camera.

uiMapToolbar boolean <optional>
false

Controls whether the map toolbar is enabled or disabled.

uiMyLocationButton boolean <optional>
false

Controls whether the "My Location" button is enabled or disabled.

uiIndoorLevelPicker boolean <optional>
false

Controls whether the indoor level picker is enabled or disabled.

Examples
  • JavaScript
  • ES6
var map = new Scandit.Ui.Map({
  size: 0.5
});
let map = new Scandit.Ui.Map({
  size: 0.5
});

Classes

Marker

Methods

(static) openGoogleMapsApp(options?: object): Promise

Opens Google Maps application

Parameters:
Name Type Attributes Default Description
options object <optional>
{}
Properties
Name Type Attributes Default Description
location double[] <optional>
null
zoom integer <optional>
auto
query string <optional>

Query for map search. If location is provided it will search nearby

Returns:
Promise

Can return an error with code:

Examples
  • JavaScript
  • ES6
Scandit.Ui.Map.openGoogleMapsApp();
Scandit.Ui.Map.openGoogleMapsApp();

(static) openGoogleMapsStreetViewApp(options: object): Promise

Opens Google Street View application

Parameters:
Name Type Description
options object
Properties
Name Type Attributes Description
location double[]

The app will display the panorama photographed closest to this location

bearing integer <optional>
zoom integer <optional>
tilt integer <optional>
Returns:
Promise

Can return an error with code:

Examples
  • JavaScript
  • ES6
Scandit.Ui.Map.openGoogleMapsStreetViewApp();
Scandit.Ui.Map.openGoogleMapsStreetViewApp();

(static) openGoogleNavigationApp(options: object): Promise

Opens Google Navigation application

Parameters:
Name Type Description
options object
Properties
Name Type Attributes Default Description
destination string

Sets the end point for navigation searches. This can be a latitude,longitude or a query formatted address. If it is a query string that returns more than one result, the first result will be selected.

mode string <optional>
drive

Method of transportation. Possible values: drive, walk, bicycle

Returns:
Promise

Can return an error with code:

Examples
  • JavaScript
  • ES6
Scandit.Ui.Map.openGoogleNavigationApp();
Scandit.Ui.Map.openGoogleNavigationApp();

addMarkers(markers: Scandit.Ui.Map.Marker[]): Promise

Adds markers to the map

Parameters:
Name Type Description
markers Scandit.Ui.Map.Marker[]

Markers to add

Returns:
Promise

Can return an error with code:

Examples
  • JavaScript
  • ES6
var map = new Scandit.Ui.Map();
var marker = new Scandit.Ui.Map.Marker({position: [47.38241507969929,8.534339480102062]});
map.addMarkers([marker]);
let map = new Scandit.Ui.Map();
let marker = new Scandit.Ui.Map.Marker({position: [47.38241507969929,8.534339480102062]});
map.addMarkers([marker]);

clearMarkers(): Promise

Removes all markers

Returns:
Promise

Can return an error with code:

Examples
  • JavaScript
  • ES6
var map = new Scandit.Ui.Map();
// ...
map.clearMarkers();
let map = new Scandit.Ui.Map();
// ...
map.clearMarkers();

hide(): Promise

Hides map

Returns:
Examples
  • JavaScript
  • ES6
var map = new Scandit.Ui.Map();
map.show();
// ...
map.hide();
let map = new Scandit.Ui.Map();
map.show();
// ...
map.hide();

off(event: string, callback?: function)

Unregisters event handler

Parameters:
Name Type Attributes Description
event string

Event name

callback function <optional>

Callback function

Examples
  • JavaScript
  • ES6
var map = new Scandit.Ui.Map();
map.off('click');
let map = new Scandit.Ui.Map();
map.off('click');

on(event: string, callback: function)

Registers event handler

Parameters:
Name Type Description
event string

Event name

callback function

Callback function

Examples
  • JavaScript
  • ES6
var map = new Scandit.Ui.Map();
map.on('click', function(location) {
  console.log(location);
});
let map = new Scandit.Ui.Map();
map.on('click', location => {
  console.log(location);
});

resize(size: float, position?: string): Promise

Changes map size and position

Parameters:
Name Type Attributes Default Description
size float

Determines size of the map. The value in range 0.0 - 1.0 which means how much space will be reserved for map.

position string <optional>
top

Position of the map, possible values: top, bottom.

Returns:
Promise

Can return an error with code:

Examples
  • JavaScript
  • ES6
var map = new Scandit.Ui.Map();
map.show();
map.resize(0.5, 'top');
let map = new Scandit.Ui.Map();
map.show();
map.resize(0.5, 'top');

setLocation(lat: double, lng: double): Promise

Changes position of the map view

Parameters:
Name Type Description
lat double

Latitude value

lng double

Longitude value

Returns:
Promise

Can return an error with code:

Examples
  • JavaScript
  • ES6
var map = new Scandit.Ui.Map();
map.show();
map.setLocation(47.383, 8.534);
let map = new Scandit.Ui.Map();
map.show();
map.setLocation(47.383, 8.534);

setType(mapType: string): Promise

Changes map type

Parameters:
Name Type Description
mapType string

Type of the map, possible values: normal, hybrid, satellite, terrain.

Returns:
Promise

Can return an error with code:

Examples
  • JavaScript
  • ES6
var map = new Scandit.Ui.Map();
map.show();
map.setType('hybrid');
let map = new Scandit.Ui.Map();
map.show();
map.setType('hybrid');

setZoom(zoom: integer): Promise

Changes zoom of the map view

Parameters:
Name Type Description
zoom integer

Zoom level value

Returns:
Promise

Can return an error with code:

Examples
  • JavaScript
  • ES6
var map = new Scandit.Ui.Map();
map.show();
map.setZoom(14);
let map = new Scandit.Ui.Map();
map.show();
map.setZoom(14);

show(): Promise

Shows map

Returns:
Examples
  • JavaScript
  • ES6
var map = new Scandit.Ui.Map();
map.show();
let map = new Scandit.Ui.Map();
map.show();

Type Definitions

Location

Location object specified by latitude and longitude.

Properties:
Name Type Description
lat double

Latitude

lng double

Longitude

Events

click

Click event

Returns:
Scandit.Ui.Map.Location

Location where the user triggered the event

Examples
  • JavaScript
  • ES6
var map = new Scandit.Ui.Map();
map.on('click', function(location) {
  console.log(location);
});
let map = new Scandit.Ui.Map();
map.on('click', location => {
  console.log(location);
});

longClick

Long click event

Returns:
Scandit.Ui.Map.Location

Location where the user triggered the event

Examples
  • JavaScript
  • ES6
var map = new Scandit.Ui.Map();
map.on('longClick', function(location) {
  console.log(location);
});
let map = new Scandit.Ui.Map();
map.on('longClick', location => {
  console.log(location);
});