Hi all,
I am trying to produce a webmap in ArcGIS online from a hosted feature layer to show current event locations.
The point feature layer has 2 time-based fields - StartDate and EndDate representing each event.
I would like to produce a dynamic map of 'todays events' which will only show those events which are currently on.
So far I have tried creating a filter expression using the 'in the last' option, but this wont work as my data wont suit this approach.
I also tried using an Arcade expression as follows based on code i found here:
--------------------------------------------------------------------------------------------------------
var started = $feature.Start_Date
var closed = $feature.End_Date
var present = Now()
// if current date/time is greater than or equal to the start time
// AND current date/time is less than or equal to the close time
// return open, otherwise its closed
If (present >= started && present <= closed) {
return "Open today"
}
----------------------------------------------------------------------------------------------------------
However when I go to view this in my webmap I find that everything not returned as "Open today" is classified "Other" and is still selectable on my webmap popup, even if its visibility is removed.
Is there a way using Arcade expressions in ArcGIS online to remove or filter out these unwanted geometries?
Any help much appreciated,
Thanks
Andrew
Hi warringah ,
If you go into the options of the symbology, you can switch off "Other":
Thanks Xander,
However the problem I am seeing is that the "Other" objects I have switched off in the webmap are still selectable and produce a pop-up even though they are invisible.
In that case maybe a hosted feature layer view could work... Not sure though. Create hosted feature layer views—ArcGIS Online Help | ArcGIS
That's a pretty unique name
Anyway, I think I maybe be able to help you. Firstly, have you looked at Jake Skinner's post. As the post mention's this solution will require you to uncheck - "allow only standard SQL queries".
If that is not an option, you'll have to use "in the last" and "not in the last" dynamic date expressions on your webmap's filter or when defining a feature layer view.
The following expression will show features edited in the last day.
If you are to go with the 2nd option - you'll need to be a little creative
To show events after your Start_Date - write the following expression: Start_Date "in the last" 90 years (or a very large time period).
To show events before your End_Date - write the following expression: End_Date "not in the last" 90 years (or a very large time period).
Hope this is helpful,
Gee