import "@arcgis/map-components/components/arcgis-shadow-cast";The Shadow Cast component displays the cumulative shadows of 3D features in a 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, the Daylight component can be used. 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 Daylight component, where selecting a timezone updates the environment lighting's date and time according to the camera position.
The component provides three visualization modes: threshold, duration, and discrete mode.
In the threshold mode, only the areas that receive shadows for more than a certain amount of time are displayed. In the image below, on May 1, 2021 the red areas receive shadow for more than 4 hours within the time interval of 10AM to 4PM.
Total shadow duration mode displays the duration of the cumulative shadow using opacity: areas that don't receive any shadow are fully transparent and areas that receive a maximum amount of shadow have a default opacity of 0.7. The values in between are interpolated. Hovering over the Scene will display a tooltip showing the amount of time that location is in shadow, rounded to 15-minute intervals. In this mode, the visualization can display shadow cast in a continuous way or in 1-hour intervals.
Discrete shadows is a third visualization mode which displays individual shadows at a given time interval. For example, setting the time range to 10AM-11AM and the visualization time interval to 30 minutes will display shadows for 10AM, 10:30AM and 11:00AM.
The defaults for the time range and visualization settings can be changed using the startTimeOfDay, endTimeOfDay, and visualizationType properties.
Known limitations
- Shadow Cast is only supported in a 3D Scene component.
 - Terrain does not cast shadows and it is therefore not taken into account in this analysis. This influences the results when the start time of the range is before sunrise or when the end time is after the sunset.
 - The component does not take into account the daylight savings. 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
| Property | Attribute | Type | 
|---|---|---|
autoDestroyDisabled | auto-destroy-disabled | boolean | 
date | date | Date | number | string | 
discreteOptions |  | DiscreteOptions | 
durationOptions |  | DurationOptions | 
endTimeOfDay | end-time-of-day | number | 
headingLevel | heading-level | number | 
hideColorPicker | hide-color-picker | boolean | 
hideDatePicker | hide-date-picker | boolean | 
hideThresholdContext | hide-threshold-context | boolean | 
hideThresholdContextColor | hide-threshold-context-color | boolean | 
hideThresholdContextTimeInterval | hide-threshold-context-time-interval | boolean | 
hideThresholdContextToggle | hide-threshold-context-toggle | boolean | 
hideTimeRangeSlider | hide-time-range-slider | boolean | 
hideTimezone | hide-timezone | boolean | 
hideTooltip | hide-tooltip | boolean | 
hideVisualizationOptions | hide-visualization-options | boolean | 
icon | icon | string | 
label | label | string | 
positiondeprecated  | position | "bottom-leading" | "bottom-left" | "bottom-right" | "bottom-trailing" | "manual" | "top-leading" | "top-left" | "top-right" | "top-trailing" | 
referenceElement | reference-element | HTMLArcgisLinkChartElement | HTMLArcgisMapElement | HTMLArcgisSceneElement | string | 
startTimeOfDay | start-time-of-day | number | 
statereadonlyreflected  | state | "disabled" | "ready" | 
thresholdOptions |  | ThresholdOptions | 
utcOffset | utc-offset | number | 
view |  | SceneView | 
visualizationType | visualization-type | "discrete" | "duration" | "threshold" | 
autoDestroyDisabled
autoDestroyDisabled: booleanIf 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
date: Date | number | stringThe 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
 
discreteOptions
discreteOptions: DiscreteOptionsThe configuration used when the component's visualizationType is set to "discrete".
durationOptions
durationOptions: DurationOptionsThe configuration used when the component's visualizationType is set to "duration".
endTimeOfDay
endTimeOfDay: numberTime (in milliseconds from midnight of the date) when the shadow cast computation should stop.
- Attribute
 - end-time-of-day
 - Default value
 - 16 * 3600 * 1000
 
headingLevel
headingLevel: numberIndicates the heading level to use for the titles "Time range" and "Visualization".
- Attribute
 - heading-level
 - Default value
 - 4
 
hideThresholdContext
hideThresholdContext: boolean- Attribute
 - hide-threshold-context
 - Default value
 - false
 
hideThresholdContextColor
hideThresholdContextColor: boolean- Attribute
 - hide-threshold-context-color
 - Default value
 - false
 
hideThresholdContextTimeInterval
hideThresholdContextTimeInterval: boolean- Attribute
 - hide-threshold-context-time-interval
 - Default value
 - false
 
hideThresholdContextToggle
hideThresholdContextToggle: boolean- Attribute
 - hide-threshold-context-toggle
 - Default value
 - false
 
hideTimeRangeSlider
hideTimeRangeSlider: boolean- Attribute
 - hide-time-range-slider
 - Default value
 - false
 
hideVisualizationOptions
hideVisualizationOptions: boolean- Attribute
 - hide-visualization-options
 - Default value
 - false
 
icon
icon: stringIcon 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"
 
position
position: "bottom-leading" | "bottom-left" | "bottom-right" | "bottom-trailing" | "manual" | "top-leading" | "top-left" | "top-right" | "top-trailing"slot instead.- Attribute
 - position
 
referenceElement
referenceElement: HTMLArcgisLinkChartElement | HTMLArcgisMapElement | HTMLArcgisSceneElement | stringBy 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.
- Attribute
 - reference-element
 
startTimeOfDay
startTimeOfDay: numberTime (in milliseconds from midnight of the date) when the shadow cast computation should start.
- Attribute
 - start-time-of-day
 - Default value
 - 10 * 3600 * 1000
 
state
state: "disabled" | "ready"The component's state. The values mean the following:
disabled- component is being createdready- component is ready
- Attribute
 - state
 - Default value
 - "disabled"
 
thresholdOptions
thresholdOptions: ThresholdOptionsThe configuration used when the component's visualizationType is set to "threshold".
utcOffset
utcOffset: numberThe difference in hours between UTC time and the times displayed in the component.
- Attribute
 - utc-offset
 
view
view: SceneViewThe 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
viewproperty which connects a component to a MapView or SceneView. Ultimately, once migration is complete, the Shadow Cast component will be associated with a map or scene component rather than using theviewproperty.
visualizationType
visualizationType: "discrete" | "duration" | "threshold"Type of visualization to use when showing the shadows. There are 3 types of visualization:
threshold- only displays areas that receive shadows for a period longer than a given threshold valueduration- displays all areas that receive shadows either in a continuous mode or in 1 hour time intervalsdiscrete- displays individual shadows cast at a given time interval
- Attribute
 - visualization-type
 - Default value
 - "threshold"
 
Methods
| Method | Signature | 
|---|---|
componentOnReady | componentOnReady(): Promise<void> | 
destroy | destroy(): Promise<void> | 
getDuration | getDuration(point: __esri.Point): Promise<number> | 
start | start(): Promise<void> | 
stop | stop(): Promise<void> | 
componentOnReady
componentOnReady(): Promise<void>Create a promise that resolves once component is fully loaded.
Example
const arcgisShadowCast = document.querySelector("arcgis-shadow-cast");
document.body.append(arcgisShadowCast);
await arcgisShadowCast.componentOnReady();
console.log("arcgis-shadow-cast is ready to go!");- Returns
 - Promise<void>
 
getDuration
getDuration(point: __esri.Point): Promise<number>Returns the time (in milliseconds) spent in shadow for a certain point on the screen.
Parameters
| Parameter | Type | Optional? | 
|---|---|---|
| point | Point | 
- Returns
 - Promise<number>
 
start
start(): Promise<void>Starts the component. While running, it will automatically perform shadow accumulation.
- Returns
 - Promise<void>
 
Events
| Event | Type | 
|---|---|
arcgisPropertyChange | CustomEvent<{ name: "state"; }> | 
arcgisReady | CustomEvent<void> | 
arcgisPropertyChange
arcgisPropertyChange: CustomEvent<{ name: "state"; }>Emitted when the value of a property is changed. Use this to listen to changes to properties.
arcgisReady
arcgisReady: CustomEvent<void>Emitted when the component associated with a map or scene view is ready to be interacted with.


