Members

Instance member functions of the Marker object.

getId

marker.getId();

Parameters

Parameter (Required)
Description
Remark

not required

Returns

Parameter
Description
Remark

Example

// one marker 
marker.getId();

// markers
let ids = [];
for(let i = 0; i < markers.length; i++) {
    ids.push(markers[i].getId());
}

Returns

Parameter
Description
Remark

setLngLat

marker.setLngLat(markerID, coord);

Parameters

Parameter (Required)
Description
Remark

markerID

The ID that created the marker.

String

coord

Latitude and longitude {lat, lng}.

Object

Returns

Parameter
Description
Remark

Example

const lnglat = { lat: 37.482630, lng: 126.899893};
marker.setLngLat(markerID, lnglat);

getLngLat

marker.getLngLat(markerID);

Parameters

Parameter (Required)
Description
Remark

markerID

The ID that generated the marker.

String

Returns

Parameter
Description
Remark

coord

marker's location {longitude, latitude}.

Object

Example

const lnglat = marker.getLngLat(markerID);

setMessage

marker.setMessage(id, message);

Parameters

Parameter (Required)
Description
Remark

id

The ID that generated the marker.

String

message

The message to show on the marker.

HTML

Returns

Parameter
Description
Remark

Example

const message = `<div>Change Message</div>`;
marker.setMessage(id, message);

setZIndex

marker.setZIndex(markerID, index);

Parameter

Parameter (Required)
Description
Remark

markerID

The ID that generated the marker.

Boolean

index

The z-index CSS property sets the z-order of a positioned element and its descendants or flex items.

Numeric

Returns

Parameter
Description
Remark

Example

// sample code

getZIndex

marker.getZIndex(markerID);

Parameters

Parameter (Required)
Description
Remark

markerID

The ID that generated the marker.

String

Returns

Parameter
Description
Remark

Example

// Some code

setOffset

marker.setOffset(markerID, offset);

Parameters

Parameter (Required)
Description
Remark

markerID

The ID that generated the marker.

String

offset

Move the selected element to a specific location.

Numeric Array

Returns

Parameter
Description
Remark

Example

const offset = [0, -20];
marker.setOffset(markerID, offset);

getOffset

marker.getOffset(markerID);

Parameters

Parameter (Required)
Description
Type

markerID

The ID that generated the marker.

String

Returns

Parameter
Description
Remark

Example

// Some code

setDraggable

marker.setDraggable(markerID, bool);

Parameters

Parameter (Required)
Description
Type

markerID

The ID that generated the marker.

String

bool

Whether to move by clicking on the marker.

boolean

Returns

Return Value
Description
Type

Example

const bool = true;
marker.setDraggable(markerID, bool);

isDraggable

marker.isDraggable(markerID);

Parameters

Parameter (Required)
Description
Type

markerID

The ID that generated the marker.

String

Returns

Return Value
Description
Type

Example

// Some code

setPopupOffset

marker.setPopupOffset(markerID, offset);

Parameters

Parameter (Required)
Description
Type

markerID

The ID that generated the marker.

String

offset

Move the selected element to a specific location.

Numeric Array

Returns

Return Value
Description
Type

Example

const offset = [0, -20];
marker.setPopupOffset(markerID, offset);

getPopupOffset

marker.getPopupOffset(markerID);

Parameters

Parameter (Required)
Description
Type

markerID

The ID that generated the marker.

String

Returns

Return Value
Description
Type

Example

// Some code

togglePopup

marker.togglePopup();

Parameters

Parameter (Required)
Description
Type

Returns

Return Value
Description
Type

Example

// marker
marker.togglePopup();

// markers
markers[i].togglePopup();

The MOGOS Maps API requires an API Key, which can be obtained from the MOGOS Console website or contact [email protected].

Last updated