Map Viewer - Date Filter (today/after today/Date Range)

1732
11
09-20-2023 11:15 AM
Status: Open
SteveCole
Frequent Contributor

The new Map Viewer (both AGOL and Enterprise) should have the ability to filter a layer's data by a date relative to the current date. For example, I have a layer of construction closures that have a start and endate as attributes. I want to apply a filter such that only records where the closing date occurs in the future would be displayed. With Map Viewer Classic, I believe you could edit the map's JSON in AGOL Assistant to implement this but I don't know if this is still possible with the new Map Viewer. Either way, users should have to hack their maps for a pretty standard date filter option.

The choices would be something like:

"occurs on.."   <Specific Date | Today>

"occurs on or after.." <Specific Date | Today>

"occurs on or before.." <Specific Date | Today>

It would be nice to also have some addition variants like "within the next week | within the next month" but a relative option like "today" should be the absolute minimum.

11 Comments
JörgMoosmeier

Perhaps I read your idea wrong, but isn't that already possible?: https://doc.arcgis.com/en/arcgis-online/create-maps/apply-filters-mv.htm 

ChristosP

This feature is desperately needed to filter large, time-enabled datasets to show only the most recent data.

It looks like Experience Builder offers some more functionality but it's needed in the web map viewer as well!

The article referenced below states that "You can use the in the last and not in the last operators", which would be great, but we don't see it in our Portal for ArcGIS 11.0. Maybe a versioning thing?

JörgMoosmeier

I have checked with my AGE 11.1 installation. For Filter it has the same options (see screenshot). 

I don't have a 11.0 installation at hand, but at least the help for 11.0 says the same as for 11.1.

Something seems to be wrong

Screenshot 2023-09-21 145707.png

 

SteveCole

@JörgMoosmeier I'm using Enterprise 10.9.1 but, to my knowledge and experience, no, you cannot do what I have described either in Portal of AGOL.  I just logged into AGOL and then added an earthquake layer to my map. For a filter, I tried to just filter that layer for records from today and it's still asking me for the specific date. There is no relative "today" option- you must select or specify an actual date.

The Help document you linked to mentions options such as "is on" or "is after" but in all these cases, you have to supply a hard date value (9/21/2023). I want a relative value ("today") so that the map is smart enough to adjust rather than me having to manually update it.

JörgMoosmeier

Allright, I have done the same with this map (in ArcGIS Online, don't know if it is possible in 10.9.1): 
https://www.arcgis.com/apps/mapviewer/index.html?webmap=d98f65bc89884e94821cf1815a73cd78

this is the filter for the layer:

JrgMoosmeier_0-1695310196993.png

The feature layer refreshes every 30 seconds.

And while I'm looking at the map, features come and go, dependent on Event Time. There seems to be a little lag time in updating the table.

So for me relative time filter into the past are working. There is no filter for '1 hour in the future' (for planed events in the future), I think this has to be done with a little Arcade Scripting.

 

 

 

SteveCole

@JörgMoosmeier So you would agree that the filtering options are available when speaking about past events but not for events in the future? That seems to validate my Idea. I'm more concerned about filtering *future* events than I am the past (road closures, etc).

JörgMoosmeier

Hi @SteveCole ,

yes, in Map Viewer there is currently no relative filter for events in the future (from now). 

You can do this in Dashboards, not directly for the map, but you can set relative filters (also into the future) for eg. lists or you can define data expressions.  

SteveCole

@JörgMoosmeier  Well, as someone who work's on the Portal side of the equation, I know I have a long wait for a lot of the functionality I need (Q4 2024 for WAB->EB parity for example) so I'm stuck for now.

I am able to edit the JSON of my map and, for now, I'll just have to use this AGOL ASSISTANT workaround. Here's the definition expression to use for an end date which is today, or in the future:

"definitionExpression": "endDate >= CURRENT_TIMESTAMP"
WilliamRockwell1

I don't know how "in the last" and "not in the last" (minutes, hours, days, weeks, months, years) is an option, but going forward in time isn't.

Do people not plan things in the future? Are there not future events and the needs to weed out past events? Crazy. 

Please implement this. It shouldn't be a huge lift programmatically. 

DavidSolari

Tweaking a layer based on the current datetime relative to a field in the layer is a common request in my org. Usually it's a symbol that we set using Arcade but filtering comes up too and jumping into AGOL Assistant is less than ideal.