# setCenter

## Description

Set the center position based on the latitude and longitude provided.

## Input / Parameter

| Name       | Description                                                                          | Input Type | Default | Options | Required |
| ---------- | ------------------------------------------------------------------------------------ | ---------- | ------- | ------- | -------- |
| component  | The name of the map component.                                                       | Text       | -       | -       | Yes      |
| coordinate | The latitude and longitude of the point to set as center. Format: latitude,longitude | Text       | -       | -       | -        |

## Output

N/A

## Example

In this example, we will set the map component coordinate using the setCenter function.

### Steps

1. Make sure Map component is exist on the page and add a button component on that page.

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-fe0edfc3c394b35960a7061384e35193a1591caf%2FsetCenter-step-1.png?alt=media)
2. Select the event `press` for the button and drag the function `Map.setCenter` to the event flow. Fill in the parameters of the function.

   ![](https://399701567-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwmJ1RKjM2uNFaL6fO3Xu%2Fuploads%2Fgit-blob-75fef19fe1be590d447279e1ff063deaba36ec20%2FsetCenter-step-2.png?alt=media)

### Result

1. The center of the map component will be moved following the coordinate from `Map.setCenter` function
