Filtering features in WebMaps based on current date

4270
8
Jump to solution
08-14-2013 11:26 PM
AnttiKajanus1
Regular Contributor II
We are planning a field solution based on ArcGIS Online hosted Feature Services, WebMaps and GeoColletor.

We are hosting inspection spots in Feature Service that includes the date when it needs to be inspected. What we would like to achieve is that endusers that are using GeoCollector can see their jobs for the day in the client. So is there possible to filter Features by current date in WebMap's?

If this is not possible to do this way, any ideas how we could get similar outcome? We try to get this solution done without coding but if there isn't any possible way to do this like that, then we might need to jump to the development side.
Tags (2)
1 Solution

Accepted Solutions
MikeMinami
Esri Notable Contributor
We can filter by date, but it's a specific date, not a relative date. It's a good idea, but there is no out-of-the-box ability to filter data by relative date. However, I could see creating filters like:


  • Today

  • Yesterday

  • Tomorrow

  • This week (today + 7)

  • Last week (today - 7)

  • A date range


Mike

View solution in original post

0 Kudos
8 Replies
MikeMinami
Esri Notable Contributor
We can filter by date, but it's a specific date, not a relative date. It's a good idea, but there is no out-of-the-box ability to filter data by relative date. However, I could see creating filters like:


  • Today

  • Yesterday

  • Tomorrow

  • This week (today + 7)

  • Last week (today - 7)

  • A date range


Mike

View solution in original post

0 Kudos
AnttiKajanus1
Regular Contributor II
Ok, so we need to do workaround in this case.

Solution that we're most likely implement at the fist place is to have extra attribute on features that defines if the feature is shown or filtered in the webmap. This attribute will be updated everyday to corresponding dates by maintenance service running on the server.

I think that dynamic filtering in some values like dates and username would be good enhancement for webmaps.

with regards,
Antti
0 Kudos
simoxu
by MVP Regular Contributor
MVP Regular Contributor

I'd like to resurrect this post. because this is a great question that many people may ask when they use collector:

after 2 years since the original post, I believe there's a great open source tool available for us:

Try ArcGIS Online Assistant

You can see the JSON data of your web map, and you can change the layer definition and save back.

In the layer definition, define your own expression and save.

"layerDefinition": {

.....

     "definitionExpression": "CreationDate >=DATEADD(day,-1,convert(date,GETDATE()))"

......

}

USING THIS TOOL WITH CARE AND AT YOUR OWN RISK, AS IT COULD CORRUPT YOUR CONTENT. so I strongly suggest make a copy before you change anything using ago-assistant.

AnttiKajanus1
Regular Contributor II

Mike Minami Any idea if filtering ended up to features list or has it been implemented some way?

0 Kudos
MikeMinami
Esri Notable Contributor

We are working on better drawing of date fields in the context of "smart mapping". So we want to use different symbols to represent different features both categorically and continuously. For example, draw features based on the day of the week they occurred, or time of day, or even season of the year. Similarly, be able to fade out features of older dates. We are actively working on this and I can see it getting released next year. I'm not sure at this point how it will impact actually filtering data, if we'll be able to filter by the same relative means.

Mike

simoxu
by MVP Regular Contributor
MVP Regular Contributor

when it is realised, it will be a great feature!

0 Kudos
ChristenWatts
New Contributor II

Thank you, that was super helpful!

I wanted to restrict closure and completion dates to current and beyond and inserted this code into the layer description :"ClosureDate >= CURRENT_DATE() OR CompletionDate >= CURRENT_DATE()"

0 Kudos
kmsmikrud
Occasional Contributor III

Hi,

I am currently creating offline maps with the new Collector for ArcGIS. Similar to the original post, we don't want features collected the day before to show up in the Collector map. Currently in the AGOL webmap, I have a filter to not show features in the last 8 hours which works in the webmap. We haven't figured out what works for the offline map and collecting data to not see data collected.

What is the best workflow so surveyors will be able to collect data with no features in the map. Currently I'm recreating the offline map with that filter on the feature layers so there are no features in the offline map area.

A surveyor downloads this offline map area -> collects and syncs features  with AGOL -> will the features be gone from the offline map on their device or will they need to again download that offline map area at the start of each day.

Thanks in advance!,
Kathy

0 Kudos