如何在对 ESRI REST 服务器的 json url 查询中格式化 esriFieldTypeDate 参数
How to format a esriFieldTypeDate parameter in a json url query to an ESRI REST server
我正在尝试查询此 API,按 RptDt
字段过滤,类型为 esriFieldTypeDate
.
基本查询如下所示:
https://dhsgis.wi.gov/server/rest/services/DHS_COVID19/COVID19_WI_V2/MapServer/11/query?where=1%3D1&outFields=*&outSR=4326&f=json
过滤像POS_CUM_SUM
这样的数字变量很容易,像这样:
"https://dhsgis.wi.gov/server/rest/services/DHS_COVID19/COVID19_WI_V2/MapServer/11/query?where=%20(POS_CUM_CP%20%3D%200%20OR%20POS_CUM_CP%20%3D%2010)%20&outFields=*&outSR=4326&f=json"
我不知道如何格式化日期字段的最小和最大参数 RptDt
。
- 因为
RptDt
的属性被格式化为unix时间戳:1642255200000、1642428000000。但是那个returns错误码400。
https://dhsgis.wi.gov/server/rest/services/DHS_COVID19/COVID19_WI_V2/MapServer/11/query?where=%20(RptDt%20%3D%20'1642255200000'%20OR%20RptDt%20%3D%20'1642428000000')%20&outFields=*&outSR=4326&f=json
然后,我注意到 RptDt
的字段长度为 8,因此我尝试将 unix 时间戳四舍五入为 8 位数字(16422552、16424280),但这也给出了错误代码 400 .
我试过使用YYYYMMDD格式(20210101到20211231),这个没有报错,但是响应没有任何特征。大多数日期都在这个时期。
https://dhsgis.wi.gov/server/rest/services/DHS_COVID19/COVID19_WI_V2/MapServer/11/query?where=%20(RptDt%20%3D%20%2720210101%27%20OR%20RptDt%20%3D%20%2720211231%27)%20&outFields=*&outSR=4326&f=json
我未能在 ArcGIS REST APIs 文档中找到解决方案。有人了解我的查询中遗漏了什么吗?
正确的格式是'YYYY-MM-DD'
。此查询有效。相关位是 where=RptDt>'2022-01-01'
.
https://dhsgis.wi.gov/server/rest/services/DHS_COVID19/COVID19_WI_V2/MapServer/11/query?where=RptDt>'2022-01-01'&outFields=*&outSR=4326&f=json
感谢JamieKelly1 at the Esri Community Forum for answering this question。
我正在尝试查询此 API,按 RptDt
字段过滤,类型为 esriFieldTypeDate
.
基本查询如下所示:
https://dhsgis.wi.gov/server/rest/services/DHS_COVID19/COVID19_WI_V2/MapServer/11/query?where=1%3D1&outFields=*&outSR=4326&f=json
过滤像POS_CUM_SUM
这样的数字变量很容易,像这样:
"https://dhsgis.wi.gov/server/rest/services/DHS_COVID19/COVID19_WI_V2/MapServer/11/query?where=%20(POS_CUM_CP%20%3D%200%20OR%20POS_CUM_CP%20%3D%2010)%20&outFields=*&outSR=4326&f=json"
我不知道如何格式化日期字段的最小和最大参数 RptDt
。
- 因为
RptDt
的属性被格式化为unix时间戳:1642255200000、1642428000000。但是那个returns错误码400。
https://dhsgis.wi.gov/server/rest/services/DHS_COVID19/COVID19_WI_V2/MapServer/11/query?where=%20(RptDt%20%3D%20'1642255200000'%20OR%20RptDt%20%3D%20'1642428000000')%20&outFields=*&outSR=4326&f=json
然后,我注意到
RptDt
的字段长度为 8,因此我尝试将 unix 时间戳四舍五入为 8 位数字(16422552、16424280),但这也给出了错误代码 400 .我试过使用YYYYMMDD格式(20210101到20211231),这个没有报错,但是响应没有任何特征。大多数日期都在这个时期。
https://dhsgis.wi.gov/server/rest/services/DHS_COVID19/COVID19_WI_V2/MapServer/11/query?where=%20(RptDt%20%3D%20%2720210101%27%20OR%20RptDt%20%3D%20%2720211231%27)%20&outFields=*&outSR=4326&f=json
我未能在 ArcGIS REST APIs 文档中找到解决方案。有人了解我的查询中遗漏了什么吗?
正确的格式是'YYYY-MM-DD'
。此查询有效。相关位是 where=RptDt>'2022-01-01'
.
https://dhsgis.wi.gov/server/rest/services/DHS_COVID19/COVID19_WI_V2/MapServer/11/query?where=RptDt>'2022-01-01'&outFields=*&outSR=4326&f=json
感谢JamieKelly1 at the Esri Community Forum for answering this question。