---
title: setViewpoint
slug: viewer-2d/methods/setViewpoint
docTags: 
createdAt: 2024-02-21T14:33:53.990Z
---

Sets the location and orientation of the **Viewpoint**.

:::hint{type="info"}
The **Viewpoint** is an optional visual indicator that includes an arrow icon. The **Viewpoint** accepts mouse and touch events so that users can move it within the 2D viewer. The **Viewpoint** is typically used in conjunction with the 3D viewer to show the location and orientation of the 3D viewer camera within the 2D viewer.
:::

## Example

::codepen{url="https://codepen.io/Catenda/embed/BagJxjj"}

## Usage

```javascript
const viewpoint = {
  direction: 90,
  location: {
    x: 1,
    y: 1
  }
};

viewer2d.setViewpoint(viewpoint);
```

```javascript
const viewpoint = {
  direction: {
    x: 1,
    y: 0
  },
  location: {
    x: 1,
    y: 1
  }
};

viewer2d.setViewpoint(viewpoint);
```

## Parameters

### viewpoint

Location and orientation of the **Viewpoint**.

| **Type** | **Required** |
| -------- | ------------ |
| Object   | Yes          |

**Properties**

| **Name**    | **Type**                                          | **Required** | **Description**                                                  |
| ----------- | ------------------------------------------------- | ------------ | ---------------------------------------------------------------- |
| `direction` | Number or [Vector2](docId\:HfHNmbFsrRrISUBE9WgGy) | Yes          | Orientation of the **Viewpoint** in degrees or normalized vector |
| `location`  | [Vector2](docId\:HfHNmbFsrRrISUBE9WgGy)           | Yes          | Position of the **Viewpoint**                                    |

