操作方法

操作方法:使用 ArcGIS Pro 中的 Arcade 对日期范围进行符号化

Last Published: September 2, 2021

摘要

日期范围可以符号化,以表示特定时间段内已调查和尚未调查的区域。 诸如 DateDiff()、Date() 和 Now() 等 Arcade 函数可用于隔离和符号化日期数据类型字段中的特定范围。

下图显示了对美国犹他州自然保护区的研究。 属性表用于显示每个区域的调查日期。

Bear_Survey_Area 的图像
调查日期的图像。

本文介绍了根据三个日期范围对区域进行符号化的工作流:过去 30 天内调查的区域、调查日期在 30 天前但未超过 100 天的区域,以及调查日期在 100 天或更久之前的区域。

过程

以下说明介绍如何在 ArcGIS Pro 中使用 Arcade 对日期范围进行符号化。

显示 30 天、30 天以上和 100 天以下的日期范围

  1. 在 ArcGIS Pro 中,右键单击内容中的图层,然后单击符号系统
  2. 符号系统窗格中,从主符号系统下拉列表中选择唯一值
  3. 单击字段 1 下拉字段旁边的按钮以设置表达式。
表达式构建器 - Arcade 的图像
  1. 表达式构建器对话框中,使用以下表达式:
注: 请确保用于计算日期范围的字段在日期数据类型中。
//areas which are surveyed 30 days ago or less belong in the first group if (DateDiff(Now(), Date($feature.<field name>), 'days') <= 30) {      return "Surveyed within the last 30 days" } //areas which are surveyed more than 30 days but less than 100 days ago belong in the second group else if (DateDiff(Now(), Date($feature.<field name>), 'days') > 30 && DateDiff(Now(), Date($feature.<field name>), 'days') < 100) {     return "Surveyed between 30 to 100 days ago" } //areas which are surveyed 100 days ago or more belong in the third group else if (DateDiff(Now(), Date($feature.<field name>), 'days') >= 100) {      return "Surveyed more than 100 days ago" } //areas which do not satisfy any of the given conditions belong in the fourth group else {      return "None of these conditions" }
  1. 单击确定关闭表达式构建器对话框。 符号系统随即更新。
已更新符号系统的图像。
显示的输出的图像。

显示具有日期日差的日期范围

  1. 在 ArcGIS Pro 中,右键单击内容中的图层,然后单击符号系统
  2. 符号系统窗格中,从主符号系统下拉列表中选择唯一值
  3. 单击字段 1 下拉字段旁边的按钮以设置表达式。
  4. 表达式构建器对话框中,使用以下表达式:
: 手动填写 yyyy,mm,dd 和 mm/dd/yyyy。 对于 Date() 函数的输入,月份值使用数字 0-11 而不是 1-12。
var revegDate = Date($feature.Created_Date) if (revegDate >= Date(yyyy,mm,dd) && revegDate <= Date(yyyy,mm,dd)) { return "mm/dd/yyyy- mm/dd/yyyy" } else if (revegDate >= Date(yyyy,mm,dd) && revegDate <= Date(yyyy,mm,dd)) { return "mm/dd/yyyy- mm/dd/yyyy" } else{ return "Some other date range" }
  1. 单击确定关闭表达式构建器对话框。 符号系统随即更新。
已更新符号系统的图像。

文章 ID:000017958

从 ArcGIS 专家处获得帮助

联系技术支持部门

下载 Esri 支持应用程序

转至下载选项

相关信息

发现关于本主题的更多内容