Skip to content
ESM
import "@arcgis/map-components/components/arcgis-shadow-cast";
Inheritance:
ArcgisShadowCastPublicLitElement
Since
ArcGIS Maps SDK for JavaScript 4.28

The Shadow Cast component displays the cumulative shadows of 3D features in a arcgis-scene. This type of analysis is helpful in urban development, where new projects have to satisfy certain shadow duration constraints.

The component calculates the cumulative shadows for a time range during a single day. The user can configure the time range and select a calendar date. This time range and calendar date are only used for the shadow analysis and are not connected to the lighting in the scene. To control the lighting in the scene, use the arcgis-daylight component. Changing the timezone in the component updates the visualization by interpreting the time range as being in that timezone. This behavior is different from the arcgis-daylight component, where selecting a timezone updates the arcgis-scene.environment date and time according to the camera position.

The component provides three mode: minimum duration, total duration, and discrete mode.

Minimum duration mode displays shadows only in areas where shading accumulates for longer than a specified duration within the selected time range. Areas that receive less shading than the minimum show no shadow. In the image below, on May 1, 2021, shadows are displayed only where shading exceeds 4 hours between 10AM and 4PM.

minimum-duration mode

Total shadow duration mode displays the cumulative duration of shadow within the selected time range using opacity: areas that receive no shadow remain fully transparent, while areas receiving the highest accumulated shadow duration use a default opacity of 0.7. Intermediate values are interpolated. This mode can visualize shadows continuously or in 1-hour intervals.

total-duration mode

Discrete shadows mode displays individual shadows at regular intervals within the selected time range. For example, with a time range from 10AM to 11AM and an interval set to 30 minutes, the shadows at 10AM, 10

and 11
will be displayed.

discrete mode

Hovering over the Scene will display a tooltip showing the amount of time that location is in shadow, rounded to 15-minute intervals.

The defaults for the time range and visualization settings can be changed using the startTimeOfDay, endTimeOfDay, and mode properties.

Known limitations

  • Shadow Cast is only supported in a 3D arcgis-scene component.
  • Terrain does not cast shadows in this analysis. As a result, to avoid incorrect shadow visualization, startTimeOfDay should be set after local sunrise and endTimeOfDay before local sunset. If these times fall outside daylight hours, shadows may be missing in areas where terrain would normally block sunlight.
  • The analysis does not take daylight savings into account. Use the timezone dropdown to adjust the offset from the Coordinated Universal Time (UTC) and account for the daylight saving time.
  • The timezone is automatically detected by the component based on the camera location. In some situations, this might not be accurate. In case of an inaccurate timezone, users can set it manually using the timezone dropdown.

See also

Demo

Properties

PropertyAttributeType
auto-destroy-disabled
date
discrete-interval
end-time-of-day
heading-level
hide-date-picker
hide-discrete-color-picker
hide-discrete-interval
hide-discrete-options
hide-min-duration-color-picker
hide-min-duration-context-color-picker
hide-min-duration-context-interval
hide-min-duration-context-options
hide-min-duration-context-toggle
hide-min-duration-options
hide-min-duration-slider
hide-shadow-duration-tooltip
hide-time-range-slider
hide-timezone
hide-total-duration-color-picker
hide-total-duration-mode-select
hide-total-duration-options
hide-visualization
hide-visualization-options
icon
reflected
icon
Icon["icon"] | undefined
label
max-min-duration
min-duration
min-duration-context-enabled
min-duration-context-interval
min-min-duration
mode
reference-element
start-time-of-day
state
readonly
"disabled" | "ready"
total-duration-mode
utc-offset
visualScale
reflected
visual-scale
"l" | "m" | "s"

analysis

Property
Type
ShadowCastAnalysis
Since
ArcGIS Maps SDK for JavaScript 5.0

The ShadowCastAnalysis created or modified by the component.

When connecting the Shadow Cast component to the arcgis-scene component, it automatically creates an empty analysis and adds it to the arcgis-scene.analyses collection. You can then wait for the ShadowCastAnalysisView3D to be created before accessing the analysis results.

// Get the Scene component and the Shadow Cast component, and wait until both are ready.
const viewElement = document.querySelector("arcgis-scene");
await viewElement.viewOnReady();
const shadowCastElement = document.querySelector("arcgis-shadow-cast");
await shadowCastElement.componentOnReady();
// Get the ShadowCastAnalysis created by the Shadow Cast component.
const analysis = shadowCastElement.analysis;
// Get the ShadowCastAnalysisView3D.
const analysisView = await viewElement.whenAnalysisView(analysis);
// Click in the Scene and get the shadow duration in that specific point.
viewElement.addEventListener("arcgisViewClick", async (event) => {
const screenPoint = { x: event.detail.x, y: event.detail.y };
const duration = await analysisView.getDurationAtScreen(screenPoint);
console.log("Shadow duration (minutes):", duration);
});

Whenever the component is destroyed, the analysis is automatically removed from the collection.

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

// Create the ShadowCastAnalysis.
const analysis = new ShadowCastAnalysis();
// Get the Scene component and the Shadow Cast component, and wait until both are ready.
const viewElement = document.querySelector("arcgis-scene");
await viewElement.viewOnReady();
const shadowCastElement = document.querySelector("arcgis-shadow-cast");
await shadowCastElement.componentOnReady();
// Add the analysis to the analyses collection of the Scene component.
viewElement.analyses.add(analysis);
// Connect the analysis to the shadow cast component.
shadowCastElement.analysis = analysis;

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

date

autocast Property
Type
Date

The calendar date used to calculate the shadow cast. This date excludes the time. If a date with a time is set, the time value will be set to midnight (00:00:00) of that date in local system time. If no date is set, then it defaults to the current date in local system time.

See also

Attribute
date

discreteColor

Property
Type
Color
Since
ArcGIS Maps SDK for JavaScript 5.0

Color of the shadow visualization in "discrete" mode. The opacity of the visualization is mapped to the number of overlapping shadows. No shadow corresponds to opacity 0 and maximum number of shadows corresponds to the opacity set in this color value.

discreteInterval

Property
Type
number
Since
ArcGIS Maps SDK for JavaScript 5.0

Individual shadows are displayed at this time interval in "discrete" mode, starting with the start time of day. The interval is expressed in milliseconds. If set to 0, we'll use the smallest possible interval, up to a maximum of 255 samples.

Attribute
discrete-interval

endTimeOfDay

Property
Type
number

Time (in milliseconds from midnight of the date) when the shadow cast computation should stop.

Read more

Attribute
end-time-of-day

headingLevel

Property
Type
HeadingLevel

Indicates the heading level to use for the component title.

Attribute
heading-level
Default value
4

hideDatePicker

Property
Type
boolean

If true, the date picker will be hidden.

Attribute
hide-date-picker
Default value
false

hideDiscreteColorPicker

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

If true, the color picker will be hidden in the discrete mode options.

Attribute
hide-discrete-color-picker
Default value
false

hideDiscreteInterval

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

If true, the interval selector will be hidden in the discrete mode options.

Attribute
hide-discrete-interval
Default value
false

hideDiscreteOptions

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

If true, the visualization options will be hidden in discrete mode.

Attribute
hide-discrete-options
Default value
false

hideMinDurationColorPicker

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

If true, the color picker will be hidden in the minimum duration mode options.

Attribute
hide-min-duration-color-picker
Default value
false

hideMinDurationContextColorPicker

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

If true, the color picker will be hidden in the context options in minimum duration mode.

Attribute
hide-min-duration-context-color-picker
Default value
false

hideMinDurationContextInterval

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

If true, the interval selector will be hidden in the context options in minimum duration mode.

Attribute
hide-min-duration-context-interval
Default value
false

hideMinDurationContextOptions

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

If true, the context options will be hidden in the minimum duration mode options.

Attribute
hide-min-duration-context-options
Default value
false

hideMinDurationContextToggle

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

If true, the toggle used to show or hide the context options will be hidden.

Attribute
hide-min-duration-context-toggle
Default value
false

hideMinDurationOptions

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

If true, the visualization options will be hidden in minimum duration mode.

Attribute
hide-min-duration-options
Default value
false

hideMinDurationSlider

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

If true, the minimum duration slider will be hidden in the minimum duration mode options.

Attribute
hide-min-duration-slider
Default value
false

hideShadowDurationTooltip

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

If true, the tooltip which displays the amount of shadow at a certain location will be hidden.

Attribute
hide-shadow-duration-tooltip
Default value
false

hideTimeRangeSlider

Property
Type
boolean

If true, the time range slider will be hidden.

Attribute
hide-time-range-slider
Default value
false

hideTimezone

Property
Type
boolean

If true, the timezone picker will be hidden.

Attribute
hide-timezone
Default value
false

hideTotalDurationColorPicker

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

If true, the color picker will be hidden in the total duration mode options.

Attribute
hide-total-duration-color-picker
Default value
false

hideTotalDurationModeSelect

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

If true, the mode selector will be hidden in the total duration mode options.

Attribute
hide-total-duration-mode-select
Default value
false

hideTotalDurationOptions

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

If true, the visualization options will be hidden in the total duration mode.

Attribute
hide-total-duration-options
Default value
false

hideVisualization

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

Indicates whether the component's visualization is hidden in the view.

Attribute
hide-visualization
Default value
false

hideVisualizationOptions

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

If true, the visualization options will be hidden.

Attribute
hide-visualization-options
Default value
false

icon

reflected Property
Type
Icon["icon"] | undefined

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
"measure-building-height-shadow"

label

Property
Type
string | undefined

The component's default label.

Attribute
label

maxMinDuration

Property
Type
number
Since
ArcGIS Maps SDK for JavaScript 5.0

Maximum allowed value for the minDuration property, in milliseconds.

Attribute
max-min-duration

minDuration

Property
Type
number
Since
ArcGIS Maps SDK for JavaScript 5.0

The minimum duration (in milliseconds) used in "min-duration" mode to determine which shadow areas are displayed.

Attribute
min-duration

minDurationColor

Property
Type
Color
Since
ArcGIS Maps SDK for JavaScript 5.0

Color of the shadow visualization in "min-duration" mode. The areas with cumulative shadow time longer than the minimum duration value are displayed with this color.

minDurationContextColor

Property
Type
Color
Since
ArcGIS Maps SDK for JavaScript 5.0

The color used when showing additional context in "min-duration" mode when minDurationContextEnabled is true.

minDurationContextEnabled

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 5.0

Whether to enable additional context showing discrete shadows at the same time as displaying shadows above a minimum duration when in the "min-duration" mode. The minDurationContextColor and minDurationContextInterval properties are used to configure the visualization of the discrete shadows when context is enabled.

Attribute
min-duration-context-enabled
Default value
false

minDurationContextInterval

Property
Type
number
Since
ArcGIS Maps SDK for JavaScript 5.0

The interval in milliseconds used when showing additional context in "min-duration" mode when minDurationContextEnabled is true.

Attribute
min-duration-context-interval

minMinDuration

Property
Type
number
Since
ArcGIS Maps SDK for JavaScript 5.0

Minimum allowed value for the minDuration property, in milliseconds.

Attribute
min-min-duration
Default value
0

mode

Property
Type
ShadowCastMode
Since
ArcGIS Maps SDK for JavaScript 5.0

Mode of analysis to use when computing and displaying the shadows. There are 3 types:

  • "discrete": Displays individual shadow snapshots at regular time intervals within the selected time range.
  • "min-duration": Displays shadows only in areas where accumulated shading exceeds a user‑defined minimum duration within the selected time range. Optional discrete shadow overlays can provide additional context.
  • "total-duration": Displays total shadow accumulation within the selected time range using opacity: areas with longer shadow duration appear more opaque. Supports continuous or 1‑hour aggregated modes.
Attribute
mode

referenceElement

Property
Type
ArcgisReferenceElement | string | undefined

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

startTimeOfDay

Property
Type
number

Time (in milliseconds from midnight of the date) when the shadow cast computation should start.

Read more

Attribute
start-time-of-day

state

readonly Property
Type
"disabled" | "ready"

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

  • disabled - component is being created
  • ready - component is ready

totalDurationColor

Property
Type
Color
Since
ArcGIS Maps SDK for JavaScript 5.0

Color of the shadow visualization in "total-duration" mode. The opacity is mapped to the time spent in shadow. Areas that don't receive any shadow are displayed with zero opacity and areas that receive shadows for the entire time range are displayed with the opacity specified in this property.

totalDurationMode

Property
Type
ShadowCastTotalDurationMode
Since
ArcGIS Maps SDK for JavaScript 5.0

Mode in which the cumulative shadow duration should be displayed in "total-duration" mode: as a continuous surface or as an hourly aggregation of values.

Attribute
total-duration-mode

utcOffset

Property
Type
number | null | undefined

The difference in hours between UTC time and the times displayed in the component.

Attribute
utc-offset

view

Property
Type
SceneView | undefined

The view associated with the component.

Note: The recommended approach is to fully migrate applications to use map and scene components and avoid using MapView and SceneView directly. However, if you are migrating a large application from widgets to components, you might prefer a more gradual transition. To support this use case, the SDK includes this view property which connects a component to a MapView or SceneView. Ultimately, once migration is complete, the arcgis-shadow-cast component will be associated with a map or scene component rather than using the view property.

visualScale

reflected Property
Type
"l" | "m" | "s"
Since
ArcGIS Maps SDK for JavaScript 5.0
experimental

Specifies the size of the component.

Attribute
visual-scale
Default value
"m"

Methods

MethodSignature
componentOnReady
inherited
componentOnReady(): Promise<this>
destroy(): Promise<void>
getDurationAtScreen(point: Point): Promise<number>

componentOnReady

inherited Method
Signature
componentOnReady (): Promise<this>
Inherited from: PublicLitElement

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

Returns
Promise<this>
Example
const arcgisShadowCast = document.querySelector("arcgis-shadow-cast");
document.body.append(arcgisShadowCast);
await arcgisShadowCast.componentOnReady();
console.log("arcgis-shadow-cast is ready to go!");

destroy

Method
Signature
destroy (): Promise<void>

Permanently destroy the component.

Returns
Promise<void>

getDurationAtScreen

Method
Signature
getDurationAtScreen (point: Point): Promise<number>
Since
ArcGIS Maps SDK for JavaScript 5.0

Returns the time (in milliseconds) spent in shadow for a certain point on the screen.

Read more

Parameters
ParameterTypeDescriptionRequired
point
Returns
Promise<number>

Events

arcgisPropertyChange

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

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

bubbles composed cancelable

arcgisReady

Event
arcgisReady: CustomEvent<void>

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

bubbles composed cancelable