How to create a feature layer view of current features based on start and end time attribute fields

520
6
01-16-2022 11:16 PM
Labels (1)
ElizabethHale1
New Contributor II

I have a hosted feature layer in ArcGIS Online of features with a start time field and an end time field. How do I create a feature layer view that filters for current features based on start and end time? In other words, when features pass their end time they expire and drop out of the feature layer view. Alternately, when features pass their start time they become included in the feature layer view.

Tags (1)
0 Kudos
6 Replies
StuartMoore
Occasional Contributor III

i dont know how to do it in a view but we have a set of maps showing features based on a survey to and survey from dates

using the Arcgis online assistant (https://ago-assistant.esri.com/ )you can manually edit the feature service filters, i'll see if i can find the original post about it....

StuartMoore_0-1642413297001.png

Stu

StuartMoore
Occasional Contributor III
DallasCrow
New Contributor III

Hey Elizabeth,

You might be able to use a combination of "in the last..." conditions to make this kind of dynamic filter. I attached an example image - this displays features that have started in the last 100 years, but not ended in the last 100 years.

ElizabethHale1
New Contributor II

Thanks Dallas! A simple solution that I missed because I was thinking about the filtering logic in a very particular way. In concept this filter should work. But what actually happens with a filter based on in the last/not in the last 100 years is that it creates a data error in the hosted feature layer view. No features in the data table and a warning "this layer did not draw completely" in the visualization. Ugh.

DidNotDraw.JPG

Troubleshooting this further I discovered the magic number is 68. Filtering for greater than 68 years breaks the view. Totally inane. But at least 68 or less works. I'd prefer to not have to specify a limit at all (filter based on before/after now), but at least something finally works!

Filter.JPG

DallasCrow
New Contributor III

Glad to help! Strange that it bugs out past 68 years - I wonder if it's an issue with the filter or something related to the dates in the feature layer? Either way it's great that you got it working.

0 Kudos
Stefan_Thorn
Occasional Contributor

Hi @ElizabethHale1 ,

No need to make a view. 

When you create an instant app with slider from your webmap, it is possible to have this behavior. Be aware of the second interval length, there you can set the time steps within the total time duration.

Stefan_Thorn_0-1642589287712.png