Select to view content in your preferred language

Shadow Analysis default color, slider duration 0

405
8
02-23-2025 12:46 PM
TedZhou
Occasional Contributor

Shadow Analysis seems to be a very complex to me. ArcGIS team implemented it successfully should be not easy for them. 

It is a good feature our surveyors wanted. 

I configured the default color as below:

        sceneView.environment.lighting.directShadowsEnabled = false;
        const widget = new ShadowCast({
            view,
            container: panel
            headingLevel: 2
        });
        widget.viewModel.thresholdOptions.color.setColor(pink);
        widget.viewModel.durationOptions.color.setColor(purple);
        widget.viewModel.discreteOptions.color.setColor(blue);
        widget.viewModel.thresholdOptions.maxValue = 14;
        widget.viewModel.visualizationType = 'duration';

 

1. Not sure the reason behind 

        sceneView.environment.lighting.directShadowsEnabled = false;

I tried to set to true. I did not notice any differences. I wish I could learn from you.

2. I set the default color as below: 

        widget.viewModel.thresholdOptions.color.setColor(pink);
        widget.viewModel.durationOptions.color.setColor(purple);
        widget.viewModel.discreteOptions.color.setColor(blue);
 
However, when the ShadowAnalysis appear the first time, the color for threshold still is red, probably the default color ArcGIS team set, not the color I set through view model.
 
I believe I may need to call the ShadowAnalysis to re-render to get it right. However, I reckon if I set the color through view model, the widget or the view should respond. 
 
This issue I will try to find a way to get around myself.
 
3. Slider duration zero seems to be no effect at all?
 
Normal duration is correct probably. ArcGIS team did a good job.
 
TedZhou_0-1740342816677.png

 

the maximum duration I assume to be correct:

TedZhou_1-1740342943170.png

 

Move the slider to zero duration, then it still has some shadow? I need to confirm with our Surveyor otherwise I will get into trouble now. I cannot understand the fact zero duration still has shadow ?

TedZhou_2-1740343043750.png

 

TedZhou_3-1740343095141.png

 

4. How to properly set the date?

Using the default date?

Or just do as below:

             widget.viewModel.date = new Date();
 
What are the differences? Shadow analysis relies on the timing and sun light. 
 
I am under pressure with the slider with zero duration, which I really cannot understand why zero duration still have shadow.
 
I hope I could learn from you.
 
Thanks for your tips and advice.
 
Ted
 
 
 

 

 

 

 

 

 

Tags (1)
0 Kudos
8 Replies
TedZhou
Occasional Contributor

TedZhou_0-1740346974894.png

1. The words should be updated when the slider changes, it should be:

          Areas in shadow for more than 4 hours

The label is not updated when the slider moves? 

2. The duration when the duration is zero seems to be corret.

3. The color when the duration is zero still in red, not sure the reason.

ArcGIS team did great work as usual indeed. 

 

 

0 Kudos
TedZhou
Occasional Contributor

Shadow Cast component | Sample | ArcGIS Maps SDK for JavaScript 4.32

If the trivial bugs with color for sliders got fixed, then it should be fantastic feature for our customers. 

Probably it is a bug, probably I am wrong. Please rectify my misfiring. 

 

0 Kudos
GreteSoosalu
Esri Contributor

Hi @TedZhou thank you for your report! 

Here are replies to your first 4 points: 

1. sceneView.environment.lighting.directShadowsEnabled is used to toggle general shadows and has no effect on the Shadow Cast analysis. To avoid the confusion, the sample disables those shadows. 

2. Colors can be configured as following: https://codepen.io/gsoosalu/pen/ZYEJNrK 

3. Slider 0 shows shadows at that exact time. Therefore, the rendered shadow is correct, but the text in the tooltip "Total time in shadow: 0 seconds" is misleading. We'll look into making it clearer. 

Update: also, I now understand that what confuses you is also that that duration of e.g. 15 mins shows no analysis but duration 0 shows something. We'll look into fixing that as well. Thanks for reporting this!

4. The date shown in the ShadowCast widget needs to be set with widget.viewModel.date and widget.viewModel.utcOffset  properties. sceneView.environment.lighting.date has no effect on the Shadow Cast widget. 

 

And regarding you further comments:

1. It is by design that the title of this slider does not include the value - the value comes from the slider itself. But we'll bring the feedback to our team and will review your comment. 

2. Not clear what you mean here. 

3. Note that the time slider is set to midnight and as the Shadow Cast analysis doesn't take the terrain into account (documented here under Known Limitations), the results show up unexpected.
In general, I advise you not to use the Shadow Cast widget if 
a. the slider is set to time that is before sunrise or after sunset
b. for viewing shadows with duration 0. For shadows at a certain time point you can use the Daylight widget instead. 

 

Thanks again and let us know if this helps you further. 

0 Kudos
GreteSoosalu
Esri Contributor

Additionally, could you explain what do you expect to see when the shadow duration is 0? Do I get it correctly that it would help you if no shadow was shown in that state? 

0 Kudos
TedZhou
Occasional Contributor

Dear Grete:

Many thanks for your kind response and assistance. 

Shadow Analysis is a fantastic feature for our customers and very complicated and actually a successful implementation for such complex and dynamic environments. If there are bugs, only a few trivial UI defects probably.

 

TedZhou_0-1741727584308.png


        sceneView.environment.lighting.directShadowsEnabled = false;
        const widget = new ShadowCast({
            view,
            container: parentContainer,
            headingLevel: 6
        });

        widget.viewModel.thresholdOptions.color.setColor(green);
        widget.viewModel.visualizationType = 'threshold';
 
Based on view model, the initial color for Shadow should be "green" rather than "red". ArcGIS seems to have fixed the initial color as "red". 
 
With the date settings, we may need to change the default dropdown item as below:
 
TedZhou_1-1741728547454.png

 

If the view model could provide such configurations then resolve my issues. I tried to hook on, but I failed this moment.

 

Thanks again for your kind assistance and efforts.

 

Kind regards,

 

Ted

 

 

 

 

0 Kudos
TedZhou
Occasional Contributor

Sorry, headingLevel is 2 rather than 6. I did not check. 

0 Kudos
GreteSoosalu
Esri Contributor

[Updated]

Hi again Ted, 

Thanks for your kind words and it is nice to hear that you and your customers find this tool useful!

Firstly, about the initial color, try setting the color as following (I also updated my app ) : 
widget.viewModel.thresholdOptions.color = new Color("green");

Using the Color class's setColor method directly on the thresholdOptions.color doesn't work. Looks like a bug but I need to investigate further. Thanks for for reporting this! 

Regarding the time zone - to my knowledge it is not possible to configure which of the options is shown when the dropdown opens. Could it be a workaround for you not to show the time zone at all? You can do that with (also added to my app ) : 

widget.visibleElements = { timezone: false };

Hope this helps you further and in case you have more questions, let me know!

Best regards, 

Grete

0 Kudos
GreteSoosalu
Esri Contributor

I double checked with the team and got the confirmation that the color needs to be set using new Color(). Using setColor directly on threshold options' color is not reactive so it is expected that the shadows in the view don't update. 

Your report that the widget's color picker changes to green is a bug and we'll have it fixed. Thanks again for pointing this out! 
Update: A
fter investigating this further, this seems to be a technical limitation. But, as pointed out above, this doesn't occur when the color is correctly set using new Color().

 

0 Kudos