英文:
Using CQL filter to query date relative to present
问题
我正在使用geoserver,并且想要按日期(WFS)筛选我的图层,
我有两列:Date_start和Date_end
我想要显示只有符合这个条件的要素:
Date_PRESENT > Date_start 且 Date_PRESENT < Date_end
其中Date_PRESENT是当前日期和时间。
我不想手动输入今天的日期,我想根据当前日期而无需调整CQL筛选。
根据有关时间谓词的文档,我可以接近实现:
https://docs.geoserver.org/latest/en/user/filter/ecql_reference.html#temporal-predicate
但我找不到如何获取当前日期的方法。
谢谢
英文:
I'm working with geoserver ,and i want to filter my layer by date (WFS),
i have two columns : Date_start and Date_end
i would like to display only feature that verify this condition :
Date_PRESENT >Date_start and Date_PRESENT<Date_end
where Date_PRESENT is the current date and time.
i dont wanna put today's date in manually,I want to do it based on the present without a need to adjust the CQL filter.
Following the docs regarding temporal predicates, I can get close:
https://docs.geoserver.org/latest/en/user/filter/ecql_reference.html#temporal-predicate
But i can't find how to get the current date
thanks
答案1
得分: 2
尝试使用 now() > Date_Start and now() < Date_End
。
详见完整的CQL函数参考链接:
https://docs.geoserver.org/stable/en/user/filter/function_reference.html#temporal-functions
英文:
Try with now() > Date_Start and now() < Date_End
See also the full CQL function reference:
https://docs.geoserver.org/stable/en/user/filter/function_reference.html#temporal-functions
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论