ESM
import "@arcgis/map-components/components/arcgis-scene";
Inheritance
ArcgisScene→HTMLElement
Since
ArcGIS Maps SDK for JavaScript 4.28

The ArcGIS Scene component is used to add 3D maps to web applications. For 2D maps, use the arcgis-map.

The Scene component creates a SceneView and loads a WebScene item from either ArcGIS Online or ArcGIS Enterprise portal.

<arcgis-scene item-id="e2da7564e4f24eaaa918ffd70378056a"></arcgis-scene>

Alternatively, the Scene component can be initialized without a WebScene item:

<arcgis-scene
basemap="satellite"
ground="world-elevation"
camera-position="12.3808, 46.3959, 4400"
camera-tilt="75"
camera-heading="300">
</arcgis-scene>

Further components can be added and connected to the Scene component:

<arcgis-scene item-id="e2da7564e4f24eaaa918ffd70378056a">
<arcgis-layer-list slot="bottom-right"></arcgis-layer-list>
</arcgis-scene>

The Scene component can be customized further using any of the core API functionalities of the ArcGIS Maps SDK for JavaScript.

const viewElement = document.querySelector("arcgis-scene");
await viewElement.viewOnReady();
// The view is now ready to be used.
const layer = new GraphicsLayer({ title: "My layer"});
viewElement.map.add(layer);

See also

Demo

Properties

PropertyAttributeType
readonly
alpha-compositing-enabled
animations-disabled
SceneView["aria"]
readonly
SceneView["attributionItems"]
attribution-mode
auto-destroy-disabled
basemap
camera-fov
camera-heading
camera-position
camera-tilt
readonly
readonly
center
SceneView["center"]
display-filter-disabled
SceneView["extent"]
readonly
SceneView["focusRegion"]
focus-region-shortcut-enabled
focus-region-visible
readonly
ground
Ground
readonly
hide-attribution
readonly
reflected
item-id
readonly
readonly
map
readonly
readonly
deprecated
popup-component-enabled
popup-disabled
readonly
quality-profile
"low" | "medium" | "high"
readonly
readonly
scale
readonly
readonly
readonly reflected
suspended
time-zone
readonly
readonly
viewing-mode
"global" | "local"
readonly
zoom

allLayerViews

readonly Property
Type
ReadonlyCollection<LayerView>

Collection containing a flat list of all the created LayerViews related to the basemap, operational layers, and group layers in this view.

See also

alphaCompositingEnabled

Property
Type
boolean

Allows the view to be partially or fully transparent when composited with the webpage elements behind it.

This property can only be set once at construction time. When alpha compositing is enabled, web scenes are less performant. It is important to set this property to true only when you need to apply transparency on the view.

Attribute
alpha-compositing-enabled
Default value
false
Example
// create a view with a fully transparent background
let view = new SceneView({
map: map,
alphaCompositingEnabled: true,
environment: {
background: {
type: "color",
color: [0, 0, 0, 0]
},
starsEnabled: false,
atmosphereEnabled: false
}
})

analyses

Property
Type
Collection<Analysis>

A collection of analyses associated with the view.

Examples
// Adds an analysis to the View
view.analyses.add(lineOfSightAnalysis);
// Removes an analysis from the View
view.analyses.remove(lineOfSightAnalysis);

animationsDisabled

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

Indicates whether animations are disabled in the view. This includes animated symbols (animated CIMSymbol, PictureMarkerSymbol from a GIF/animated PNG), animated renderers (FlowRenderer), animated layers (MediaLayer, VideoLayer), and animations triggered by view navigation (for example, goTo()). Setting this property to true disables all animations in the view.

Attribute
animations-disabled
Default value
false

aria

Property
Type
SceneView["aria"]
Since
ArcGIS Maps SDK for JavaScript 4.34

The ARIA attributes for the view container. Provides accessibility information to assistive technologies such as screen readers. Supports the following properties: label, description, describedByElements, and labelledByElements.

attributionItems

readonly Property
Type
SceneView["attributionItems"]
Since
ArcGIS Maps SDK for JavaScript 5.0

The attribution items displayed in the view's attribution.

attributionMode

Property
Type
AttributionMode
Since
ArcGIS Maps SDK for JavaScript 5.0

The display mode used for the attribution. Defaults to null.

Set this property to "auto" to automatically synchronize the attribution with the nearest Calcite mode. If no Calcite mode is detected, the attribution defaults to light mode. The "auto" mode was added in version 5.2.

Set this property to "light" or "dark" to explicitly use that mode without synchronization.

Attribute
attribution-mode

autoDestroyDisabled

Property
Type
boolean

If true, the component will not be destroyed automatically when it is disconnected from the document. This is useful when you want to move the component to a different place on the page, or temporarily hide it. If this is set, make sure to call the destroy() method when you are done to prevent memory leaks.

Attribute
auto-destroy-disabled
Default value
false
Example
<arcgis-scene auto-destroy-disabled></arcgis-scene>
sceneElement.autoDestroyDisabled = true;

basemap

Property
Type
Basemap | string | undefined

Specifies a basemap for the map. The basemap is a set of layers that give geographic context to the view and the other operational layers in the map. It can either be set using a basemap ID string (see values), Basemap or BasemapStyle.

Read more

Attribute
basemap

basemapView

Property
Type
BasemapView<LayerView>

Represents the view for a single basemap after it has been added to the map.

camera

Property
Type
Camera

The camera allows to set the observation point from which the visible portion (or perspective) of the view is determined. When set in the constructor, this property overrides the center, extent, scale, viewpoint, and zoom properties.

Setting the camera immediately changes the current view. For animating the view, see this component's goTo() method.

cameraFov

Property
Type
null | undefined | number

The diagonal field of view (fov) angle for the camera. The range of angles must be between 1 and 170 degrees.

Setting the camera fov immediately changes the current view. For animating the view, see this component's goTo() method.

Read more

Attribute
camera-fov

cameraHeading

Property
Type
null | undefined | number

The compass heading of the camera in degrees.

Setting the camera heading immediately changes the current view. For animating the view, see this component's goTo() method.

Read more

Attribute
camera-heading

cameraPosition

Property
Type
null | undefined | number[] | Point | string

The position of the camera defined by a map point. It can either be set with a Point instance or a string in the format: longitude, latitude, elevation. E.g. "12.3808, 46.3959, 4400".

Setting the camera position immediately changes the current view. For animating the view, see this component's goTo() method.

Read more

Attribute
camera-position

cameraTilt

Property
Type
null | undefined | number

The tilt of the camera in degrees with respect to the surface as projected down from the camera position.

Setting the camera tilt immediately changes the current view. For animating the view, see this component's goTo() method.

Read more

Attribute
camera-tilt

canZoomIn

readonly Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

Indicates if the view component can zoom in.

Default value
false

canZoomOut

readonly Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

Indicates if the view component can zoom out.

Default value
false

center

autocast Property
Type
SceneView["center"]

Represents the center point of the view. It can be a string with the format "<longitude>, <latitude>" or a Point instance.

Setting the center immediately changes the current view. For animating the view, see this component's goTo() method.

Read more

Attribute
center

clippingArea

Property
Type
Extent | null | undefined

Represents an optional clipping area used to define the visible extent of a Scene in local viewingMode.

Read more

See also
Example
let extent = view.extent.clone();
// Expand the extent in place, reducing it to 50% of its original size and set it as the clippingArea
view.clippingArea = extent.expand(0.5);

constraints

Property
Type
Constraints

Specifies constraints for the camera's tilt, altitude, and view's clip distance.

Read more

See also

displayFilterDisabled

Property
Type
boolean

Indicates whether a layer's displayFilter is honored when rendering layers in the view. If true, the display filters are ignored and all features are rendered.

Attribute
display-filter-disabled
Default value
false

environment

Property
Type
Environment

Specifies various properties of the environment's visualization within the view, including lighting, background, weather, and more. The Scene will redraw automatically when any property of environment changes.

Modifying the lighting:

viewElement.environment.lighting = {
type: "sun", // autocasts as new SunLighting()
date: new Date(), // sets the lighting to reflect the current time of day
directShadowsEnabled: true,
};

Setting the background:

viewElement.environment = {
background: {
type: "color",
color: [255, 252, 244, 1]
},
starsEnabled: false,
atmosphereEnabled: false
};

Changing the weather in the scene:

viewElement.environment.weather = {
type: "rainy", // autocasts as new RainyWeather({ cloudCover: 0.7, precipitation: 0.3 })
cloudCover: 0.7,
precipitation: 0.3
};

See also

Read more

extent

Property
Type
SceneView["extent"]

The extent represents the visible portion of a map within the view as an instance of Extent.

Setting the extent immediately changes the view without animation. To animate the view, see this component's goTo() method. When the view is rotated, the extent does not update to include the newly visible portions of the map.

Read more

fatalError

Property
Type
Error<any> | null | undefined

A rejected view indicates a fatal error making it unable to display.

Read more

See also
Example
reactiveUtils.when(
() => view.fatalError,
() => {
console.error("Fatal Error! View has lost its WebGL context. Attempting to recover...");
view.tryFatalErrorRecovery();
}
);

floors

Property
Type
Collection<string>

Applies a display filter on the view for a specific set of floor levels. It can filter the map display on floor-aware layers by zero or more level IDs.

focusAreas

Property
Type
FocusAreas
Since
ArcGIS Maps SDK for JavaScript 4.33

A container of all focus areas present in the map.

focusRegion

readonly Property
Type
SceneView["focusRegion"]
Since
ArcGIS Maps SDK for JavaScript 5.2

The screen rectangle of the active focus region, or null when focusRegionVisible is false. This screen rectangle represents the area of the view that is currently in focus and can be used with methods that require a screen rectangle as input, such as hitTest().

ActionKeyboard Shortcut / Property
Enable or disable focus regionUse the Shift + Alt/Option + O keyboard shortcut while the view component is in focus or set the focusRegionVisible property to true or false.
Resize focus regionUse the Shift + Alt/Option + Up/Down arrow keys while the focus region is enabled.
Open the popup for features in the focus regionPress Enter or Spacebar while the focus region is enabled.

Notes:

See also

focusRegionShortcutEnabled

Property
Type
boolean | undefined
Since
ArcGIS Maps SDK for JavaScript 5.2

Enables the Shift + Alt/Option + O keyboard shortcut for showing the focusRegion. When undefined, the shortcut is enabled only when a popup component is slotted into the ArcgisScene component, or when popupComponentEnabled is set, and when the popupDisabled property is false. Set to true to handle focus-region selection in a custom application, or false to disable the shortcut. When false, the shortcut does not change the focusRegionVisible property.

See also
Attribute
focus-region-shortcut-enabled
Default value
false

focusRegionVisible

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.2

Indicates whether the focusRegion is visible. Set this property to true to show the centered focus region, or false to hide it. The focus region can also be shown or hidden by focusing on the ArcgisScene component and pressing the Shift + Alt/Option + O keyboard shortcut. By default, this shortcut is available only when a popup component is available and popupDisabled is false. Use focusRegionShortcutEnabled to explicitly enable or disable it.

Note: When the focus region is enabled, the popupElement or slotted popup component will be docked with the dock button hidden by default to prevent it from overlapping the focus region.

See also
Attribute
focus-region-visible
Default value
false

gamepad

readonly Property
Type
GamepadSettings

Gamepad input specific configuration settings.

graphics

Property
Type
Collection<Graphic>

Allows for adding graphics directly to the default graphics in the view.

See also
Example
// Adds a graphic to the View
graphics.add(pointGraphic);
// Removes a graphic from the View
graphics.remove(pointGraphic);

ground

autocast Property
Type
Ground

Specifies the surface properties for the map. It can be either a Ground instance or a string with one of the following values:

  • "world-elevation"
  • "world-topobathymetry"

Read more

See also
Attribute
ground
Examples
// Use the world elevation service
const map = new Map({
basemap: "topo-vector",
ground: "world-elevation"
});
// Create a map with the world elevation layer overlaid by a custom elevation layer
const worldElevation = new ElevationLayer({
url: "//elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"
});
const customElevation = new ElevationLayer({
url: "https://my.server.com/arcgis/rest/service/MyElevationService/ImageServer"
});
const map = new Map({
basemap: "topo-vector",
ground: new Ground({
layers: [ worldElevation, customElevation ]
})
});

groundView

readonly Property
Type
GroundView

The view for the ground of the map.

hideAttribution

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

Indicates whether the attribution is hidden in the view.

Esri requires that when you use an ArcGIS Online basemap in your app, the map must include Esri attribution and you must be licensed to use the content. For detailed guidelines on working with attribution, please visit the official attribution in your app documentation. For information on terms of use, see the Terms of Use FAQ.

Attribute
hide-attribution
Default value
false

highlights

Property
Type
Collection<HighlightOptions>
Since
ArcGIS Maps SDK for JavaScript 4.32

Represents a collection of HighlightOptions objects which can be used to highlight features throughout an application. Highlighting works by applying highlight options to one or more features. You can configure these options (such as color or opacity) to define how a feature will be visually emphasized.

A maximum of six HighlightOptions objects are supported in the collection, and they can be added, removed, and reordered freely. Their order in the collection determines priority, with the last object having the highest priority. If you apply more than one highlight to a feature, the one that is last within the collection will be applied. The HighlightOptions object must be part of this collection in order to be applied to features.

To highlight a feature, use the highlight method on the relevant LayerView instance. To apply specific HighlightOptions, include the name in the highlight() method's options parameter. If no name is provided, the feature will use the default highlight options.

The table below shows the default highlight options in the View's highlights collection if the collection has not been modified:

Highlight options nameDescriptionDefault settings
defaultThe default highlight options. Used when layerView.highlight() is called without specifying any particular highlight options. { name: "default", color: "cyan", haloOpacity: 1, fillOpacity: 0.25, shadowColor: "black", shadowOpacity: 0.4, shadowDifference: 0.2}
temporaryThe temporary highlight options, pre-configured for common use cases such as hovering over a feature in the view.{ name: "temporary", color: "yellow", haloOpacity: 1, fillOpacity: 0.25, shadowColor: "black", shadowOpacity: 0.4, shadowDifference: 0.2 }
See also
Examples
// Use the default highlights collection to apply a highlight to features when you hover over them
// A handler can be used to remove any previous highlight when applying a new one
let hoverHighlight;
view.on("pointer-move", (event) => {
// Search for the first feature in the featureLayer at the hovered location
view.hitTest(event, { include: featureLayer }).then((response) => {
if (response.results[0]) {
const graphic = response.results[0].graphic;
view.whenLayerView(graphic.layer).then((layerView) => {
// Remove any previous highlight, if it exists
hoverHighlight?.remove();
// Highlight the hit features with the temporary highlight options, which are pre-configured for this use case
hoverHighlight = layerView.highlight(graphic, { name: "temporary"});
});
}
});
});
// Override the default highlights collection
const view = new SceneView({
map: map,
container: "viewDiv",
// Set the highlight options to be used in the view
highlights: [
{ name: "default", color: "orange" },
{ name: "temporary", color: "magenta" },
{ name: "table", color: "cyan", fillOpacity: 0.5, haloOpacity: 0}
]
});
// Add highlight options to the collection after initialization
const selectionHighlightOptions = {
name: "selection",
color: "#ff00ff", // bright fuchsia
haloOpacity: 0.8,
fillOpacity: 0.2
};
// Add the options to the highlights collection at the first position
view.highlights.add(selectionHighlightOptions, 0);

interacting

readonly Property
Type
boolean

Indicates whether the view is being interacted with (for example when panning or by an interactive tool).

Default value
false

itemId

reflected Property
Type
null | undefined | string

The ID of a WebScene item from either ArcGIS Online or ArcGIS Enterprise portal.

To configure the portal url you must set the config.portalUrl property before the Scene component loads.

Attribute
item-id

layerViews

readonly Property
Type
Collection<LayerView>

A collection containing a hierarchical list of all the created LayerViews of the operational layers in the map.

See also

loadErrorSources

Property
Type
LoadErrorSource[] | undefined
Since
ArcGIS Maps SDK for JavaScript 4.34

An array of objects that encountered an error while loading the component or any of its dependencies (e.g., basemap, ground, layers, tables). You may inspect the errors by accessing each object's loadError property.

magnifier

readonly Property
Type
Magnifier

The magnifier allows for showing a portion of the view as a magnifier image on top of the view.

map

Property
Type
Map | null | undefined

An instance of a Map object to display in the view.

readonly Property
Type
boolean

Indicates whether the view is being navigated (for example when panning).

Default value
false
Property
Type
Navigation

Options to configure the navigation behavior of the view.

Read more

Example
// Disable the gamepad usage, single touch panning, panning momentum and mouse wheel zooming.
const view = new SceneView({
container: "viewDiv",
map: new Map({
basemap: "satellite"
}),
center: [176.185, -37.643],
zoom: 13,
navigation: {
gamepad: {
enabled: false
},
actionMap: {
dragSecondary: "none", // Disable rotating the view with the right mouse button
mouseWheel: "none" // Disable zooming with the mouse wheel
},
browserTouchPanEnabled: false,
momentumEnabled: false,
}
});

options

Property
Type
ViewOptions
Since
ArcGIS Maps SDK for JavaScript 5.2
beta

Configures snapping, tooltips, display units, and input units for supported components, view models, and analyses. See ViewOptions for supported options, exceptions, and opt-in requirements.

These options are not saved in a WebMap or WebScene.

padding

Property
Type
ViewPadding

Use the padding property to make the center, and extent, etc. work off a subsection of the full view.

Read more

Default value
{left: 0, top: 0, right: 0, bottom: 0}

performanceInfo

readonly Property
Type
SceneViewPerformanceInfo

This property contains performance information of the view, e.g. global memory usage and additional details for layers about memory consumption and number of features.

deprecated Property
Type
Popup | null | undefined

A Popup widget object that displays general content or attributes from layers in the map. Consider using the popupElement (beta), which represents the Popup component, instead.

By default, the popup property is an empty object that allows you to set the popup options. A Popup instance is automatically created and assigned to the view's popup when the user clicks on the view and popupEnabled is true, when the openPopup() method is called, or when some widgets need the popup, such as Search. If popup is null, the popup instance will not be created.

See also

popupComponentEnabled

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0
beta

Indicates whether the popup component (beta) is enabled as the default popup. When set to true, the popupElement property (representing the component) will be used for popups instead of the popup property (representing the widget).

Note: This is a beta feature and may change in future releases. At version 6.0, the Popup component will be used by default instead of the Popup widget and the popup-component-enabled attribute will no longer be necessary.

See also
Attribute
popup-component-enabled
Default value
false
Example
<arcgis-map item-id="WEBMAP-ID" popup-component-enabled></arcgis-map>

popupDisabled

Property
Type
boolean

Controls whether the default popup opens automatically when users click on the view. This controls both the popupElement and popup properties. When set to true, the popup will not open on click or when triggered programmatically.

See also
Attribute
popup-disabled
Default value
false

popupElement

readonly Property
Type
ArcgisPopup | null
Since
ArcGIS Maps SDK for JavaScript 5.0
beta

A reference to the current arcgis-popup (beta). The popupComponentEnabled property must be set to true to use this property.

Note: This is a beta feature and may change in future releases.

See also
Example
<arcgis-map item-id="WEBMAP-ID" popup-component-enabled></arcgis-map>
<script type="module">
const viewElement = document.querySelector("arcgis-map");
await viewElement.viewOnReady();
viewElement.popupElement.dockEnabled = true;
viewElement.popupElement.dockOptions = {
buttonEnabled: false,
breakpoint: false,
position: "top-right",
};
</script>

qualityProfile

Property
Type
"low" | "medium" | "high"

Scenes can be drawn in three different quality modes: high, medium and low.

Read more

Attribute
quality-profile
Example
let view = new SceneView({
qualityProfile: "high"
});

ready

readonly Property
Type
boolean

When true, this property indicates whether the view successfully satisfied all dependencies, signaling that the necessary conditions are met.

Read more

See also
Default value
false

resolution

readonly Property
Type
number

Represents the current value of one pixel in the unit of the view's spatialReference. The resolution is calculated by dividing the Scene component's extent width by its width.

scale

Property
Type
number

Represents the map scale at the center of the view.

Setting the scale immediately changes the view. For animating the view, see this component's goTo() method.

Read more

Attribute
scale

selectionManager

readonly Property
Type
SelectionManager
Since
ArcGIS Maps SDK for JavaScript 5.0
beta

The default SelectionManager for this view. Used to manage selections of features across layers.

spatialReference

Property
Type
SpatialReference

The spatial reference of the view. This indicates the projected or geographic coordinate system used to locate geographic features in the map. In a Scene, the following coordinate systems are available.

The spatial reference can either be set explicitly or automatically derived from the following:

Notes

  • In case the spatial reference is determined from the map layers or the ground layers and they are in WGS84 or Web Mercator, the following rule also applies: the first layer that does not support server side reprojection (tiled layers) determines the spatial reference of the view and all the other layers are reprojected.
  • If no spatial reference can be derived, then the view does not resolve and the ready property is false.
  • Prior to changing the spatial reference, check if the projectOperator is loaded by calling projectOperator.isLoaded() method. If it is not yet loaded, call projectOperator.load() method.
Example
const viewElement = document.querySelector("arcgis-scene");
// Check if the projectOperator is loaded
if (!projectOperator.isLoaded()) {
await projectOperator.load();
}
// Change the spatial reference of the scene component to GCS2000
viewElement.spatialReference = new SpatialReference({
wkid: 4490 //GCS2000
});

stationary

readonly Property
Type
boolean

Indicates whether the view is stationary, meaning it is not animating, being navigated, or resizing.

Default value
false

suspended

readonlyreflected Property
Type
boolean

Indicates whether rendering in the view is suspended.

Read more

Attribute
suspended
Default value
false

theme

Property
Type
Theme | null | undefined

This property specifies the base colors used by some components to render graphics and labels. This only affects those elements that would otherwise use the default orange pattern.

See also
Example
// Update the theme to use purple graphics
// and slightly transparent green text
view.theme = new Theme({
accentColor: "purple",
textColor: [125, 255, 13, 0.9]
});

timeExtent

Property
Type
TimeExtent | null | undefined

The view's time extent. Time-aware layers display their temporal data that falls within the view's time extent. Setting the view's time extent is similar to setting the spatial extent because once the time extent is set, the view updates automatically to conform to the change.

Example
// Create a csv layer from an online spreadsheet.
let csvLayer = new CSVLayer({
url: "http://test.com/daily-magazines-sold-in-new-york.csv",
timeInfo: {
startField: "SaleDate" // The csv field contains date information.
}
});
// Create a scene view showing sales for the last week of March 2019 only.
const view = new SceneView({
map: map,
container: "viewDiv",
timeExtent: {
start: new Date(2019, 2, 24),
end: new Date(2019, 2, 31)
}
});

timeZone

Property
Type
string
Since
ArcGIS Maps SDK for JavaScript 5.2

Defines the time zone of the view. The time zone property determines how dates and times are represented to the user, but the underlying data is unchanged.

This property does not apply to the arcgis-daylight or arcgis-shadow-cast components. They use their own utcOffset properties. Support for using the scene's time zone in these components is planned for a future release.

The time zone can be set to one of the following values:

Possible Values

ValueDescription
systemDates and times will be displayed in the time zone of the device or browser.
unknownDates and times will be displayed based on the time zone that has been defined for the layer. No adjustments are made to the display of date info. The arcgis-time-bar component is disabled.
Specified IANA time zoneDates and times will be displayed in the specified IANA time zone. See wikipedia - List of tz database time zones.
See also
Attribute
time-zone
Default value
"system"
Example
// Date and time will be displayed in Pacific/Auckland (NZ) time zone
const viewElement = document.querySelector("arcgis-scene");
viewElement.timeZone = "Pacific/Auckland";

updating

readonly Property
Type
boolean

Indicates whether the view is being updated by additional data requests to the network, or by processing received data.

Default value
false

view

readonly Property
Type
SceneView

The SceneView instance created and managed by the component. Accessible once the component is fully loaded.

viewingMode

Property
Type
"global" | "local"

The viewing mode sets whether the view renders the earth as a sphere (global mode) or on a flat plane (local mode).

Note that the viewing mode must be set before the Scene component loads. Depending on the viewing mode different supported coordinate systems are available.

Read more

See also
Attribute
viewing-mode
Default value
"global"

viewpoint

Property
Type
Viewpoint

Represents the current view as a Viewpoint or point of observation on the view.

Setting the viewpoint immediately changes the current view. For animating the view, see this component's goTo() method.

Read more

Examples
// Set the initial viewpoint toward the Empire State Building in New York City
const viewElement = document.querySelector("arcgis-scene");
viewElement.viewpoint = new Viewpoint({
camera: new Camera({
position: {
longitude: -73.9857,
latitude: 40.7444,
z: 500,
},
heading: 0,
tilt: 60,
}),
});
// Get the initial viewpoint of the view once the view is ready
const viewElement = document.querySelector("arcgis-scene");
await viewElement.viewOnReady();
const initialViewpoint = viewElement.viewpoint.clone();

visibleArea

readonly Property
Type
null | undefined | Polygon
Since
ArcGIS Maps SDK for JavaScript 4.31

The visibleArea represents the visible portion of a map within the view as an instance of a Polygon.

Read more

See also

zoom

Property
Type
number

Represents the level of detail (LOD) at the center of the view.

Setting the zoom immediately changes the current view. For animating the view, see this component's goTo() method. Setting this property in conjunction with center is a convenient way to set the initial extent of the view.

Read more

Attribute
zoom

Methods

MethodSignature
closePopup(): Promise<void>
inherited
componentOnReady(): Promise<this>
destroy(): Promise<void>
fetchPopupFeatures(hitTarget: ScreenPoint | ScreenRect, options?: FetchPopupFeaturesOptions): Promise<AsyncGenerator<Graphic>>
goTo(target: GoToTarget3D, options?: GoToOptions3D): Promise<unknown>
hitTest(hitTarget: MouseEvent | ScreenPoint | ScreenPolygon | ScreenRect, options?: HitTestOptions3D): Promise<SceneViewHitTestResult>
openPopup(options?: ViewPopupOpenOptions): Promise<void>
takeScreenshot(options?: UserSettings): Promise<Screenshot>
toMap(screenPoint: MouseEvent | ScreenPoint, options?: HitTestOptions3D): Point | null | undefined
toScreen(point: Point): ScreenPoint
tryFatalErrorRecovery(): Promise<void>
viewOnReady(callback?: () => void, errback?: (error: Error) => void): Promise<void>
whenAnalysisView<AnalysisType extends Analysis>(analysis: AnalysisType): Promise<AnalysisView3DFor<AnalysisType>>
whenLayerView<TLayer extends Layer>(layer: TLayer): Promise<Layer extends TLayer ? LayerView : LayerView3DFor<TLayer>>
zoomIn(): Promise<void>
zoomOut(): Promise<void>

closePopup

Method
Signature
closePopup (): Promise<void>

Closes the popup.

Returns
Promise<void>

componentOnReady

inherited Method
Signature
componentOnReady (): Promise<this>

Creates a promise that resolves once the component is fully loaded.

Returns
Promise<this>
Example
const arcgisScene = document.createElement("arcgis-scene");
document.body.append(arcgisScene);
await arcgisScene.componentOnReady();
console.log("arcgis-scene is ready to go!");

destroy

Method
Signature
destroy (): Promise<void>

Destroys the Scene component, and any associated resources, including its map, popup, and removes components or other UI DOM elements added to it.

Returns
Promise<void>

fetchPopupFeatures

Method
Signature
fetchPopupFeatures (hitTarget: ScreenPoint | ScreenRect, options?: FetchPopupFeaturesOptions): Promise<AsyncGenerator<Graphic>>
Since
ArcGIS Maps SDK for JavaScript 5.1

Use this method to query for features at a given screen location. These features come from origins (layers and sublayers) configured with a PopupTemplate and have its FeatureLayer.popupEnabled set. One example could be a custom side panel that displays feature-specific information based on an end user's click location. This method allows a developer to control how the input location is handled, and then subsequently, what to do with the results.

Using ScreenRect as the hit target is considered beta functionality.

Parameters

ParameterTypeDescriptionRequired
hitTarget
options
Returns
Promise<AsyncGenerator<Graphic>>
Examples
const viewElement = document.querySelector("arcgis-map");
// Get viewElement's click event
viewElement.addEventListener("arcgisViewClick", async (event) => {
const screenPoint = { x: event.detail.x, y: event.detail.y };
const generator = await viewElement.fetchPopupFeatures(screenPoint, {
pointerType: event.detail.pointerType
});
// Access the features returned from the generator
for await (const feature of generator) {
console.log(feature);
}
});
// Wait for all the features to be available
view.on("click", async (event) => {
const generator = view.fetchPopupFeatures({ x: event.x, y: event.y }, {
pointerType: event.pointerType
});
const features = await Array.fromAsync(generator);
});

goTo

Method
Signature
goTo (target: GoToTarget3D, options?: GoToOptions3D): Promise<unknown>

Sets the view to a given target.

Read more

Parameters

ParameterTypeDescriptionRequired
target
options
Returns
Promise<unknown>

hitTest

Method
Signature
hitTest (hitTarget: MouseEvent | ScreenPoint | ScreenPolygon | ScreenRect, options?: HitTestOptions3D): Promise<SceneViewHitTestResult>

Returns hit test results from each layer that intersects the specified screen coordinates.

viewElement.addEventListener("arcgisViewClick", (event) => {
viewElement.hitTest(event.detail).then((response) => {
const result = response.results[0];
if (result?.type === "graphic") {
const { longitude, latitude } = result.mapPoint;
console.log("Hit graphic at (" + longitude + ", " + latitude + ")", result.graphic);
} else {
console.log("Did not hit any graphic");
}
});
});

Read more

See also

Parameters

ParameterTypeDescriptionRequired
hitTarget
options
Returns
Promise<SceneViewHitTestResult>

openPopup

Method
Signature
openPopup (options?: ViewPopupOpenOptions): Promise<void>

Opens the popup based on input options.

Read more

Parameters

ParameterTypeDescriptionRequired
options
Returns
Promise<void>

takeScreenshot

Method
Signature
takeScreenshot (options?: UserSettings): Promise<Screenshot>

Creates a screenshot of the current view.

Read more

Parameters

ParameterTypeDescriptionRequired
options
Returns
Promise<Screenshot>

toMap

Method
Signature
toMap (screenPoint: MouseEvent | ScreenPoint, options?: HitTestOptions3D): Point | null | undefined

Converts the given screen point to a map point.

Parameters

ParameterTypeDescriptionRequired
screenPoint
options
Returns
Point | null | undefined

toScreen

Method
Signature
toScreen (point: Point): ScreenPoint

Converts the given map point to a screen point.

Parameters

ParameterTypeDescriptionRequired
point
Returns
ScreenPoint

tryFatalErrorRecovery

Method
Signature
tryFatalErrorRecovery (): Promise<void>

Call this method to clear any fatal errors resulting from a lost WebGL context.

Returns
Promise<void>

viewOnReady

Method
Signature
viewOnReady (callback?: () => void, errback?: (error: Error) => void): Promise<void>
Since
ArcGIS Maps SDK for JavaScript 4.33

viewOnReady() may be leveraged once an instance of the component and its underlying view is created and ready. This method takes two input parameters, a callback function and an errback function, and returns a promise. The callback executes when the promise resolves, and the errback executes if the promise is rejected.

See also

Parameters

ParameterTypeDescriptionRequired
callback
() => void
errback
(error: Error) => void
Returns
Promise<void>
Example
const viewElement = document.querySelector("arcgis-scene");
await viewElement.viewOnReady();
// The view is now ready to be used.
viewElement.map.add(new FeatureLayer({...}));

whenAnalysisView

Method
Signature
whenAnalysisView <AnalysisType extends Analysis>(analysis: AnalysisType): Promise<AnalysisView3DFor<AnalysisType>>
Type parameters
<AnalysisType extends Analysis>

Gets the analysis view created for the given analysis object.

Read more

Parameters

ParameterTypeDescriptionRequired
analysis
AnalysisType
Returns
Promise<AnalysisView3DFor>

whenLayerView

Method
Signature
whenLayerView <TLayer extends Layer>(layer: TLayer): Promise<Layer extends TLayer ? LayerView : LayerView3DFor<TLayer>>
Type parameters
<TLayer extends Layer>

Gets the layer view created on the view for the given layer.

Read more

Parameters

ParameterTypeDescriptionRequired
layer
TLayer
Returns
Promise<Layer extends TLayer ? LayerView : LayerView3DFor>

zoomIn

Method
Signature
zoomIn (): Promise<void>
Since
ArcGIS Maps SDK for JavaScript 5.0

Zooms in the view component by a factor of 2.

Returns
Promise<void>

zoomOut

Method
Signature
zoomOut (): Promise<void>
Since
ArcGIS Maps SDK for JavaScript 5.0

Zooms out the view component by a factor of 2.

Returns
Promise<void>

Events

arcgisLoadError

Event
arcgisLoadError: CustomEvent<void>
Since
ArcGIS Maps SDK for JavaScript 4.34

Fires when an arcgis-scene fails to load or if one of its dependencies fails to load (e.g., basemap, ground, layers).

See also
bubbles composed cancelable
Example
viewElement.addEventListener("arcgisLoadError", () => {
console.log(viewElement.loadErrorSources);
});

arcgisViewAnalysisViewCreate

Event
arcgisViewAnalysisViewCreate: CustomEvent<AnalysisViewCreateEvent>

Fires when the view for an analysis is created.

Read more

bubbles composed cancelable

arcgisViewAnalysisViewCreateError

Event
arcgisViewAnalysisViewCreateError: CustomEvent<AnalysisViewCreateErrorEvent>

Fires when an error occurs during the creation of an analysis view after an analysis is added to the view.

Read more

bubbles composed cancelable

arcgisViewAnalysisViewDestroy

Event
arcgisViewAnalysisViewDestroy: CustomEvent<AnalysisViewDestroyEvent>

Fires after an analysis view is destroyed.

Read more

bubbles composed cancelable

arcgisViewChange

Event
arcgisViewChange: CustomEvent<void>

Fires when the view's stationary property changes, including when navigation starts or stops. It also fires when the component loads.

The arcgisViewChange event may be emitted before the view is fully ready. This means the event can fire before the component's stationary property is true or before the view has completed its initial setup. For actions that require the view to be ready and stationary, combine this event with checks on the component's stationary and ready properties.

bubbles composed cancelable

arcgisViewClick

Event
arcgisViewClick: CustomEvent<ClickEvent>

Fires after a user clicks on the view.

viewElement.addEventListener("arcgisViewClick", (event) => {
viewElement.hitTest(event.detail).then((response) => {
const result = response.results[0];
// ....
});
});

Read more

bubbles composed cancelable

arcgisViewDoubleClick

Event
arcgisViewDoubleClick: CustomEvent<DoubleClickEvent>

Fires after double-clicking on the view.

Read more

bubbles composed cancelable

arcgisViewDoubleTapDrag

Event
arcgisViewDoubleTapDrag: CustomEvent<DoubleTapDragEvent>
Since
ArcGIS Maps SDK for JavaScript 5.0

Fires while the pointer is dragged following a double-tap gesture on the view.

Read more

bubbles composed cancelable
Example
viewElement.addEventListener("arcgisViewDoubleTapDrag", (event) => {
// Display the distance moved from the drag origin.
console.log("x distance:", event.detail.x, "y distance:", event.detail.y);
});

arcgisViewDrag

Event
arcgisViewDrag: CustomEvent<DragEvent>

Fires during a pointer drag on the view.

Read more

bubbles composed cancelable

arcgisViewFocusRegionSelect

Event
arcgisViewFocusRegionSelect: CustomEvent<FocusRegionSelectEvent>
Since
ArcGIS Maps SDK for JavaScript 5.2

Fires when the focus region is selected using the Enter or Space key. Use this event to react to the selection of the focusRegion via keyboard input and perform any necessary actions based on that selection, such as performing a hitTest() on the focusRegion and passing the returned graphics to the selectionManager.

Call event.detail.preventDefault() to suppress the default behavior of the popup opening with the features in the focus region.

See also
bubbles composed cancelable
Example
viewElement.addEventListener("arcgisViewFocusRegionSelect", async (event) => {
// prevent the default popup from appearing
event.detail.preventDefault();
// get the focus region and fetch the popup features for it
const focusRegion = viewElement.focusRegion;
const generator = await viewElement.fetchPopupFeatures(focusRegion, {
pointerType: event.detail.pointerType,
});
// process the features as needed
const features = await Array.fromAsync(generator);
});

arcgisViewHold

Event
arcgisViewHold: CustomEvent<HoldEvent>

Fires after holding either a mouse button or a single finger on the view for a short amount of time.

Read more

bubbles composed cancelable

arcgisViewImmediateClick

Event
arcgisViewImmediateClick: CustomEvent<ImmediateClickEvent>

Fires right after a user clicks on the view.

Read more

bubbles composed cancelable

arcgisViewImmediateDoubleClick

Event
arcgisViewImmediateDoubleClick: CustomEvent<ImmediateDoubleClickEvent>

Is emitted after two consecutive immediate-click events.

Read more

bubbles composed cancelable

arcgisViewKeyDown

Event
arcgisViewKeyDown: CustomEvent<KeyDownEvent>

Fires after a keyboard key is pressed.

Read more

bubbles composed cancelable

arcgisViewKeyUp

Event
arcgisViewKeyUp: CustomEvent<KeyUpEvent>

Fires after a keyboard key is released.

Read more

bubbles composed cancelable

arcgisViewLayerviewCreate

Event
arcgisViewLayerviewCreate: CustomEvent<LayerViewCreateEvent>

Fires after a LayerView is created for a layer in the map.

Read more

bubbles composed cancelable

arcgisViewLayerviewCreateError

Event
arcgisViewLayerviewCreateError: CustomEvent<LayerViewCreateErrorEvent>

Fires when an error emits during the creation of a LayerView after a layer has been added to the map.

Read more

bubbles composed cancelable

arcgisViewLayerviewDestroy

Event
arcgisViewLayerviewDestroy: CustomEvent<LayerViewDestroyEvent>

Fires after a LayerView is destroyed and is no longer rendered in the view.

Read more

bubbles composed cancelable

arcgisViewMouseWheel

Event
arcgisViewMouseWheel: CustomEvent<ViewMouseWheelEvent>

Fires when a wheel button of a pointing device (typically a mouse) is scrolled on the view.

Read more

bubbles composed cancelable

arcgisViewPointerDown

Event
arcgisViewPointerDown: CustomEvent<PointerDownEvent>

Fires after a mouse button is pressed, or a finger touches the display.

Read more

bubbles composed cancelable

arcgisViewPointerEnter

Event
arcgisViewPointerEnter: CustomEvent<PointerEnterEvent>

Fires after a mouse cursor enters the view, or a display touch begins.

Read more

bubbles composed cancelable

arcgisViewPointerLeave

Event
arcgisViewPointerLeave: CustomEvent<PointerLeaveEvent>

Fires after a mouse cursor leaves the view, or a display touch ends.

Read more

bubbles composed cancelable

arcgisViewPointerMove

Event
arcgisViewPointerMove: CustomEvent<PointerMoveEvent>

Fires after the mouse or a finger on the display moves.

Read more

bubbles composed cancelable

arcgisViewPointerUp

Event
arcgisViewPointerUp: CustomEvent<PointerUpEvent>

Fires after a mouse button is released, or a display touch ends.

Read more

bubbles composed cancelable

arcgisViewReadyChange

Event
arcgisViewReadyChange: CustomEvent<void>

Fires when the ready property changes, or when the component loads if the view is already ready.

bubbles composed cancelable

arcgisViewReadyError

Event
arcgisViewReadyError: CustomEvent<void>
Since
ArcGIS Maps SDK for JavaScript 4.34

Fires if the view encounters a content or rendering error.

bubbles composed cancelable
Example
viewElement.addEventListener("arcgisViewReadyError", () => {
// handle error
});

arcgisViewVerticalTwoFingerDrag

Event
arcgisViewVerticalTwoFingerDrag: CustomEvent<VerticalTwoFingerDragEvent>
Since
ArcGIS Maps SDK for JavaScript 5.0

Fires while the two pointers are dragged vertically on the view.

Read more

bubbles composed cancelable
Example
viewElement.addEventListener("arcgisViewVerticalTwoFingerDrag", (event) => {
// Display the distance moved vertically from the drag origin.
console.log("y distance:", event.detail.y);
});

Slots

NameDescription

Default slot for adding components to the scene. User is responsible for positioning the content via CSS.

Slot for components positioned in the top-left corner.

Slot for components positioned in the top-right corner.

Slot for components positioned in the bottom-left corner.

Slot for components positioned in the bottom-right corner.

Slot for components positioned at the top-start (top-left in LTR, top-right in RTL).

Slot for components positioned at the top-end (top-right in LTR, top-left in RTL).

Slot for components positioned at the bottom-start (bottom-left in LTR, bottom-right in RTL).

Slot for components positioned at the bottom-end (bottom-right in LTR, bottom-left in RTL).

Slot for the arcgis-popup component to open automatically on click. Only the Popup component can be placed in this slot.

default (unnamed)

Slot

Default slot for adding components to the scene. User is responsible for positioning the content via CSS.

top-left

Slot

Slot for components positioned in the top-left corner.

top-right

Slot

Slot for components positioned in the top-right corner.

bottom-left

Slot

Slot for components positioned in the bottom-left corner.

bottom-right

Slot

Slot for components positioned in the bottom-right corner.

top-start

Slot

Slot for components positioned at the top-start (top-left in LTR, top-right in RTL).

top-end

Slot

Slot for components positioned at the top-end (top-right in LTR, top-left in RTL).

bottom-start

Slot

Slot for components positioned at the bottom-start (bottom-left in LTR, bottom-right in RTL).

bottom-end

Slot

Slot for components positioned at the bottom-end (bottom-right in LTR, bottom-left in RTL).

popup

Slot

Slot for the arcgis-popup component to open automatically on click. Only the Popup component can be placed in this slot.

Styles

NameDefaultDescription

Since 4.34 Specifies the top padding for the layout.

Since 4.34 Specifies the bottom padding for the layout.

Since 4.34 Specifies the left padding for the layout.

Since 4.34 Specifies the right padding for the layout.

Since 5.0 Specifies the focus outline color for the view.

Since 5.1 Specifies the background color for table rows.

Since 5.1 Specifies the background color for alternate table rows.

Since 5.2 Specifies the outer border color of the focus region.

Since 5.2 Specifies the inner border color of the focus region.

Since 5.2 Specifies the border width of the focus region.

--arcgis-layout-overlay-space-top

Style

Since 4.34 Specifies the top padding for the layout.

--arcgis-layout-overlay-space-bottom

Style

Since 4.34 Specifies the bottom padding for the layout.

--arcgis-layout-overlay-space-left

Style

Since 4.34 Specifies the left padding for the layout.

--arcgis-layout-overlay-space-right

Style

Since 4.34 Specifies the right padding for the layout.

--arcgis-view-color-focus

Style

Since 5.0 Specifies the focus outline color for the view.

--arcgis-table-row-background-color

Style

Since 5.1 Specifies the background color for table rows.

--arcgis-table-row-alt-background-color

Style

Since 5.1 Specifies the background color for alternate table rows.

--arcgis-focus-region-outer-border-color

Style

Since 5.2 Specifies the outer border color of the focus region.

--arcgis-focus-region-inner-border-color

Style

Since 5.2 Specifies the inner border color of the focus region.

--arcgis-focus-region-border-width

Style

Since 5.2 Specifies the border width of the focus region.

Type definitions

AttributionMode

Type definition
Type
SceneView["attributionMode"] | "auto"