# Instance Members

### getId()

Get the marker's id.

```
// one marker 
marker.getId();

// markers
let ids = [];
for(let i = 0; i < markers.length; i++) {
    ids.push(markers[i].getId());
}
console.log('Ids :', ids);
```

### setLngLat(markerId, lnglat)

Set the marker's geographical position and move it.

| Required Parameter | Description                       | Type   |
| ------------------ | --------------------------------- | ------ |
| markerID           | The ID that created the marker.   | String |
| lnglat             | Latitude and longitude {lat, lng} | Object |

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

### getLngLat(markerId) <a href="#getlnglat-markerid" id="getlnglat-markerid"></a>

Get the marker's geographical location.

| Required Parameter | Description                     | Type   |
| ------------------ | ------------------------------- | ------ |
| markerID           | The ID that created the marker. | String |

```javascript
const lnglat = marker.getLngLat(markerID);
console.log(lnglat);
```

### setMessage(markerId, message)

Sets the popup's content to a string of text.

| Required Parameter | Description                                 | Type   |
| ------------------ | ------------------------------------------- | ------ |
| markerID           | The ID that created the marker.             | String |
| message            | The message you want to show on the marker. | HTML   |

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

### setZIndex(markerId, index)

Change the marker's Z-lndex.

| Required Parameter | Description                                                                                          | Type    |
| ------------------ | ---------------------------------------------------------------------------------------------------- | ------- |
| markerID           | The ID that created the marker.                                                                      | String  |
| index              | The z-index CSS property sets the z-order of a positioned element and its descendants or flex items. | Numeric |

```
marker.setZIndex(markerID, index);
```

### getZIndex(markerId)

Get the marker's Z-lndex.

| Required Parameter | Description                     | Type   |
| ------------------ | ------------------------------- | ------ |
| markerID           | The ID that created the marker. | String |

```
marker.getZIndex(markerID);
```

### setOffset(markerId, offset)

Sets the offset of the marker.

| Required Parameter | Description                                       | Type            |
| ------------------ | ------------------------------------------------- | --------------- |
| markerID           | The ID that created the marker.                   | String          |
| offset             | Move the selected element to a specific location. | Array\<Numeric> |

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

### getOffset(markerId)

Get the marker's offset.

| Required Parameter | Description                     | Type   |
| ------------------ | ------------------------------- | ------ |
| markerID           | The ID that created the marker. | String |

```
marker.getOffset(markerID);
```

### setDraggable(markerId, bool)

Sets the draggble property and functionality of the marker.

| Required Parameter | Description                                | Type    |
| ------------------ | ------------------------------------------ | ------- |
| markerID           | The ID that created the marker.            | String  |
| bool               | Whether to move by clicking on the marker. | boolean |

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

### isDraggable(markerId)

Returns true if the marker can be dragged.

| Required Parameter | Description                     | Type   |
| ------------------ | ------------------------------- | ------ |
| markerID           | The ID that created the marker. | String |

```
marker.isDraggable(markerID);
```

### setPopupOffset(markerId, offset)

Sets the Popup offset of the marker.

| Required Parameter | Description                                       | Type            |
| ------------------ | ------------------------------------------------- | --------------- |
| markerID           | The ID that created the marker.                   | String          |
| offset             | Move the selected element to a specific location. | Array\<Numeric> |

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

### getPopupOffset(markerId)

Get the marker's Popup offset.

| Required Parameter | Description                     | Type   |
| ------------------ | ------------------------------- | ------ |
| markerID           | The ID that created the marker. | String |

```
marker.getPopupOffset(markerID)
```

### togglePopup()

Opens or closes the Popup instance that is bound to the Marker, depending on the current state of the Popup.

```javascript
// marker
marker.togglePopup();

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nostramap-doc.fatos.biz/fatos-api/map/map-control/marker/instance-members.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
