import Viewpoint from "@arcgis/core/Viewpoint.js";const Viewpoint = await $arcgis.import("@arcgis/core/Viewpoint.js");- Inheritance:
- Viewpoint→
Accessor
- 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.
Constructors
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
Properties
| Property | Type | Class |
|---|---|---|
| | ||
declaredClass readonly inherited | ||
| | ||
| | ||
| |
camera
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.
rotation
- 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 viewviewpoint.rotation = 90;// due north is rotated 180 degrees, pointing to the bottom of the viewviewpoint.rotation = 180;// due north is rotated 270 degrees, pointing to the left side of the viewviewpoint.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. targetGeometry
- 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
fromJSON
- Signature
-
fromJSON (json: any): any
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
| Parameter | Type | Description | Required |
|---|---|---|---|
| json | 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.
toJSON
- Signature
-
toJSON (): any
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.