Skip to content
import Viewpoint from "@arcgis/core/Viewpoint.js";
Inheritance:
ViewpointAccessor
Since
ArcGIS Maps SDK for JavaScript 4.0

Describes a point of view for a 2D or 3D view. In a 2D view, the viewpoint is determined using a center point and scale value. In a 3D view, it is determined using a Camera position. The Viewpoint can be bookmarked for later use, or used for navigation purposes.

See also

Constructors

Constructor

Constructor
Parameters
ParameterTypeDescriptionRequired
properties
See the properties table for a list of all the properties that may be passed into the constructor.

Properties

Any properties can be set, retrieved or listened to. See the Watch for changes topic.

camera

autocast Property
Type
Camera | null | undefined

The viewpoint camera (3D only).

Z-values defined in a geographic or metric coordinate system are expressed in meters. However, in local scenes that use a projected coordinate system, vertical units are assumed to be the same as the horizontal units specified by the service.

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor
Since
ArcGIS Maps SDK for JavaScript 4.7

The name of the class. The declared class name is formatted as esri.folder.className.

rotation

Property
Type
number

The rotation of due north in relation to the top of the view in degrees.

See also
Default value
0
Examples
// due north is rotated 90 degrees, pointing to the right side of the view
viewpoint.rotation = 90;
// due north is rotated 180 degrees, pointing to the bottom of the view
viewpoint.rotation = 180;
// due north is rotated 270 degrees, pointing to the left side of the view
viewpoint.rotation = 270;
// due north is rotated 0 degrees, pointing to the top of the view (the default)
viewpoint.rotation = 0; // 360 or multiple of 360 (e.g. 720) works here as well.

scale

Property
Type
number

The scale of the viewpoint.

Default value
0

targetGeometry

autocast Property
Type
GeometryUnion | null | undefined

The target geometry framed by the viewpoint.

Z-values defined in a geographic or metric coordinate system are expressed in meters. However, in local scenes that use a projected coordinate system, vertical units are assumed to be the same as the horizontal units specified by the service.

Methods

MethodSignatureClass
fromJSON
inherited static
fromJSON(json: any): any
clone(): Viewpoint
toJSON
inherited
toJSON(): any

fromJSON

inheritedstatic Method
Signature
fromJSON (json: any): any
Inherited from: JSONSupportMixin

Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. The object passed into the input json parameter often comes from a response to a query operation in the REST API or a toJSON() method from another ArcGIS product. See the Using fromJSON() topic in the Guide for details and examples of when and how to use this function.

Parameters
ParameterTypeDescriptionRequired
json
any

A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects.

Returns
any

Returns a new instance of this class.

clone

Method
Signature
clone (): Viewpoint

Create a deep clone of the viewpoint.

Returns
Viewpoint

A deep clone of the Viewpoint object that called this method.

toJSON

inherited Method
Signature
toJSON (): any
Inherited from: JSONSupportMixin

Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() guide topic for more information.

Returns
any

The ArcGIS portal JSON representation of an instance of this class.