> 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/bounds.md).

# Bounds

## fitBounds

takes bounds and opt as arguments and sets the center of the map with the given parameter. bounds parameter is a JSON object with two intercardinal directions (sw and ne), with latitude and longitude (lat, lng) respectively.

```javascript
mapInstance.fitBounds(bounds, opt);
```

### Parameter

| Required Parameter | Description                                                                                     | Type |
| ------------------ | ----------------------------------------------------------------------------------------------- | ---- |
| bounds             | Center these bounds in the viewport and use the highest zoom level up to and including the map. | JSON |

| Optional Parameter | Description                                                                                   | Type    |
| ------------------ | --------------------------------------------------------------------------------------------- | ------- |
| padding            | The amount of padding in pixels to add to the given bounds.                                   | Numeric |
| linear             | If true, the map transitions using Map#easeTo. If false, the map transitions using Map#flyTo. | Bool    |
| maxZoom            | The maximum zoom level to allow when the map view transitions to the specified bounds.        | Numeric |

### Example

```javascript
let bounds = {
        sw: {lat: 37.457464, lng: 126.899302},
        ne: {lat: 37.645804, lng: 127.161728}
}

let opt = {
    padding: {
           top: 5,
           bottom: 5,
           right: 15,
           left: 15
    },
    linear: true,         // true for “easeTo” false for “flyTo”
    maxZoom: 10
}

let opt2 = {
    padding: 10            // 10 for top, bottom, right, and left.
}

mapInstance.fitBounds(fit, opt);
mapInstance2.fitBounds(fit, opt2);
```

## getBounds

Retrieves the bounds attribute set in 'fitBounds()'

```javascript
mapInstance.getBounds();
```

### Return

Intercardinal coordinates (ne, sw) with latitude and longitude

```javascript
mapInstance.getBounds();
return : {
        ne : {lat: 37.645804, lng: 127.161728}
        sw : {lat: 37.457464, lng: 126.899302}
}
```


---

# 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/bounds.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.
