Slice

ESM:
Use dark colors for code blocksCopy
1
import "@arcgis/map-components/components/arcgis-slice";
CDN:
No specific import is needed for this component.

The Slice component is a 3D analysis tool that can be used to reveal occluded content in a Scene. It applies slice analysis to any layer type, making it possible to see inside buildings or to explore geological surfaces.

slice

The slicing shape is always a plane. By default, the plane is either horizontal or vertical. To allow a tilt angle for the plane, set tiltEnabled to true. The slice hides any content in front of the surface. The handles on the sides of the plane can be used to adjust the size, heading, tilt, and position of the slice plane. The SlicePlane can be set or retrieved using the shape property.

Once the slice plane is applied, layers can be excluded from the slicing. For example, by excluding the sublayers which include columns and floor slabs, the inner structure of a building can investigated.

slice-exclude

Holding the Shift key while creating a new slice applies it vertically.

Known limitation

Slice is only supported in a 3D Scene component.

See also

Demo

Properties

PropertyAttributeType
auto-destroy-disabled
boolean
exclude-ground-surface
boolean
heading-level
1 | 2 | 3 | 4 | 5 | 6
icon
string
label
string
Record<string, unknown>
position
"bottom-leading" | "bottom-left" | "bottom-right" | "bottom-trailing" | "manual" | "top-leading" | "top-left" | "top-right" | "top-trailing"
reference-element
state
readonly
state
"disabled" | "excludingLayer" | "ready" | "sliced" | "slicing"
tilt-enabled
boolean

analysis

Property
analysis: SliceAnalysis

The SliceAnalysis created or modified by the component.

When connecting the Slice component to the Scene component, it automatically creates an empty analysis and adds it to the Scene's analyses collection. Whenever the component is destroyed, the analysis is automatically removed from the collection.

Alternatively, a programmatically created analysis can be provided to the component. Then, the application itself needs to add it to and later remove it from the Scene's analyses collection.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Create the analysis.
const sliceAnalysis = new SliceAnalysis({
   shape: new SlicePlane({
     position: new Point({
       spatialReference: { latestWkid: 3857, wkid: 102100 },
       x: -13624925.727820931,
       y: 4550341.695170021,
       z: 56
     }),
     tilt: 270,
     width: 310,
     height: 190,
     heading: 45
   })
});
// Get the Scene and Slice component and wait until they are ready.
const viewElement = document.querySelector("arcgis-scene");
await viewElement.viewOnReady();
const slice = document.querySelector("arcgis-slice");
await slice.componentOnReady();
// Add the analysis to the Scene component.
viewElement.analyses.add(sliceAnalysis);
// Connect the analysis to the slice component:
slice.analysis = sliceAnalysis;

autoDestroyDisabled

Property
autoDestroyDisabled: 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

excludedLayers

Property

Add layers to this collection to exclude them from the slice. Layers that are draped on the ground surface are not affected by this property

excludeGroundSurface

Property
excludeGroundSurface: boolean

Indicates whether the Ground and layers that are draped on the ground surface are excluded from the slice.

Attribute
exclude-ground-surface
Default value
false

headingLevel

Property
headingLevel: 1 | 2 | 3 | 4 | 5 | 6
Attribute
heading-level
Default value
3

icon

reflected

Attribute changes are reflected on the DOM.

Property
icon: string

Icon which represents the component. Typically used when the component is controlled by another component (e.g. by the Expand component).

See also
Attribute
icon
Default value
"slice"

label

Property
label: string

The component's default label.

Attribute
label

messageOverrides

Property
messageOverrides: Record<string, unknown>

Replace localized message strings with your own strings.

Note: Individual message keys may change between releases.

position

Property
position: "bottom-leading" | "bottom-left" | "bottom-right" | "bottom-trailing" | "manual" | "top-leading" | "top-left" | "top-right" | "top-trailing"
Attribute
position
Default value
"bottom-left"

referenceElement

Property

By assigning the id attribute of the Map or Scene component to this property, you can position a child component anywhere in the DOM while still maintaining a connection to the Map or Scene.

See also
Attribute
reference-element

shape

Property
shape: SlicePlane

The shape used to slice elements in a 3D scene. Currently the only supported shape is a plane.

Example
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
// Clone the shape to modify its properties
const shape = slice.shape.clone();
// Set new values for heading and tilt
shape.heading = 180;
shape.tilt = 45;
// Apply the new shape to the slice component's shape
slice.shape = shape;

state

readonlyreflected

Attribute changes are reflected on the DOM.

Property
state: "disabled" | "excludingLayer" | "ready" | "sliced" | "slicing"

The component's state. The values mean the following:

  • disabled - not ready yet
  • ready - ready for slicing
  • slicing - currently slicing
  • sliced - finished slicing
Attribute
state

tiltEnabled

Property
tiltEnabled: boolean

Enable tilting the slice shape. If set to true, the slice shape will orient itself as best as possible to the surface under the cursor when first placing the shape. If set to false, the slice shape is restricted to be either horizontal or vertical.

Attribute
tilt-enabled
Default value
false

Slots

No slots to display.

Events

EventType
CustomEvent<{ name: "state" | "analysis"; }>

arcgisPropertyChange

Event
arcgisPropertyChange: CustomEvent<{ name: "state" | "analysis"; }>

Emitted when the value of a property is changed. Use this to listen to changes to properties.

bubbles

Events triggered on this element will be propagated to their outermost elements.

composed

The event is composable and will propagate across the shadow DOM into the standard DOM.

cancelable

The event's default behavior can be canceled, allowing for custom behavior to be implemented instead.

arcgisReady

Event
arcgisReady: CustomEvent<void>

Emitted when the component associated with a map or scene view is is ready to be interacted with.

bubbles

Events triggered on this element will be propagated to their outermost elements.

composed

The event is composable and will propagate across the shadow DOM into the standard DOM.

cancelable

The event's default behavior can be canceled, allowing for custom behavior to be implemented instead.

Methods

MethodSignature
clear(): Promise<void>
componentOnReady(): Promise<void>
destroy(): Promise<void>
start(): Promise<void>

clear

Method
clear(): Promise<void>

Clear the shape of the slice, effectively removing it from the view. Other properties like excludedLayers and excludeGroundSurface are not modified.

Returns
Promise<void>

componentOnReady

Method
componentOnReady(): Promise<void>

Create a promise that resolves once component is fully loaded.

Example
Use dark colors for code blocksCopy
1
2
3
4
const arcgisSlice = document.querySelector("arcgis-slice");
document.body.append(arcgisSlice);
await arcgisSlice.componentOnReady();
console.log("arcgis-slice is ready to go!");
Returns
Promise<void>

destroy

Method
destroy(): Promise<void>

Permanently destroy the component.

Returns
Promise<void>

start

Method
start(): Promise<void>

Start the interactive creation of a new slice, clearing the previous shape.

Returns
Promise<void>

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.