> For the complete documentation index, see [llms.txt](https://nostramap-doc.fatos.biz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://nostramap-doc.fatos.biz/fatos-api/map/map-control/polyline.md).

# Polyline

## Polyline

Sets latitude/longitude, color, transparency, line thickness. Draws a line on the map by combining the set value. Collects the values of multiple coordinates and express them as lines.

```javascript
new fatosmap.maps.Polyline({ option })
```

### Parameter

| Required Parameter | Description                       | Type       |
| ------------------ | --------------------------------- | ---------- |
| path               | Each {lat, lng} behaves as a node | JSON Array |

| Optional Parameter    | Description                                                                                                                                                                                                | Type          |
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- |
| strokeColor           | specifies a hexadecimal HTML color of the format "#FFFFFF", The default is '#000000'                                                                                                                       | Hex           |
| strokeOpacity         | specifies a numerical value between 0.0 and 1.0 to determine the opacity of the line's color. The default is 1.0                                                                                           | Numeric       |
| strokeWeight          | specifies the width of the line in pixels. The default is 1                                                                                                                                                | Numeric       |
| message (popup)       | Set the message of popup, type is string or HTML                                                                                                                                                           | String / HTML |
| event                 | popup mouse event click or mouseover. The default click                                                                                                                                                    | String        |
| anchor (popup)        | A string indicating the part of the Marker that should be positioned closest to the coordinate set via Marker#setLngLat. Options are 'center' , 'top' , 'bottom' , 'left' , 'right'. The default is bottom | String        |
| offset (popup)        | The offset in pixels as a PointLike object to apply relative to the element's center. Negatives indicate left and up. default 15                                                                           | Numeric       |
| closeButton (popup)   | If true, a close button will appear in the top right corner of the popup. The default is false                                                                                                             | Bool          |
| coloseOnClick (popup) | If true, the popup closes when the map is clicked. The default is false                                                                                                                                    | Bool          |

### Example

```javascript
let line = [    
    {lat: 37.772, lng: -122.214},    
    {lat: 21.291, lng: -157.821},    
    {lat: -18.142, lng: 178.431},    
    {lat: -27.467, lng: 153.027}    
];    
let polyline = new fatosmap.maps.Polyline({    
    path:            line,                     
    strokeColor:     '#0000FF',         
    strokeOpacity:   0.5,           
    strokeWeight:    10,
    message:         'FATOS',
    anchor:          'bottom',
    offset:          15,
    closeButton:     true,
    closeOnClick:    true,                
});    

polyline.setMap(mapInstance);
```

## How to clear the polyline

Clears the path drawn on the map.

### Example

```javascript
polyline.setMap(null);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://nostramap-doc.fatos.biz/fatos-api/map/map-control/polyline.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
