Symbolise by Age with a Live Feature Class

724
4
Jump to solution
08-16-2020 09:24 PM
by Anonymous User
Not applicable

Hi all,

Is it possible to symbolise by age in ArcGIS Online Map Viewer on a Live Feature Class.

I can symbolise by age, however it requries that you set a date for the symbology to apply to, unfortunately you cannot select latest date for example.

If not possible I'll submit as an idea.


Cheers,

Cam

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MehdiPira1
Esri Contributor

Hi Cameron McArtney‌,

This is an example arcade expression which classifies features based on current date.

if (DateDiff(Now(), Date($feature.Date_Stamp), 'days') <= 1) {
     return "Features captured within the last day" }
else if (DateDiff(Now(), Date($feature.Date_Stamp), 'days') > 2 &&
DateDiff(Now(), Date($feature.Date_Stamp), 'days') < 5) {
    return "Features captured between 2 to 5 days ago" }
else if (DateDiff(Now(), Date($feature.Date_Stamp), 'days') >= 5) {
     return "Features captured more than 5 days ago" }
else {
     return "None of these conditions" }‍‍‍‍‍‍‍‍‍

you can change days to hours, minutes, months, ....

More information is in the link below:

Date Functions | ArcGIS for Developers 

View solution in original post

4 Replies
VictorTey
Esri Contributor

Cameron McArtney‌, never done it before and just a suggestion, can you use arcade expression to get the age then apply the symbology? Similar to

https://community.esri.com/thread/235976-arcade-symbology 

0 Kudos
MehdiPira1
Esri Contributor

Hi Cameron McArtney‌,

This is an example arcade expression which classifies features based on current date.

if (DateDiff(Now(), Date($feature.Date_Stamp), 'days') <= 1) {
     return "Features captured within the last day" }
else if (DateDiff(Now(), Date($feature.Date_Stamp), 'days') > 2 &&
DateDiff(Now(), Date($feature.Date_Stamp), 'days') < 5) {
    return "Features captured between 2 to 5 days ago" }
else if (DateDiff(Now(), Date($feature.Date_Stamp), 'days') >= 5) {
     return "Features captured more than 5 days ago" }
else {
     return "None of these conditions" }‍‍‍‍‍‍‍‍‍

you can change days to hours, minutes, months, ....

More information is in the link below:

Date Functions | ArcGIS for Developers 

by Anonymous User
Not applicable

thanks Mehdi Pira‌ I just used the same code for a different scenario last week! thanks for digging this up and adding the solution!

0 Kudos
MehdiPira1
Esri Contributor

Cameron McArtney

Not a problem, Cam.