We have a feature service for gates that have fields for when the gates will be under construction and closed. There are 2 date fields, one for the start of the closure and one for the end of the closure. Only a few gates are being upgraded so not all features have the field populated and they are not all closed for the same duration. For now I've been able to customize an expression solely based on the Now() function which is for the current time. We would like to be able to have the function based on when we have time enabled on the layer in AGOL so that as someone moves the temporal slider, if the time frame depicts when closures are, the color would change to show which points would be closed.

Is this even possible?

This is the current code which works, but only based on current time.

var started = $feature["Closure_Schedule_Start"]
var closed = $feature["Closure_Schedule_End"]
var present = Now()

If (present >= started && present <= closed) { 
         return "Closed"
} else {
        return "Open"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.