Hi Andrea,
“now”, written like that, is a special keyword that works only in the WMS time support.
However, in CQL one case use all registered functions, and if you have a GeoServer that’s
recent enough (a release from the last couple of years),
there is a “now()” function instead… which I see you’re already trying to use.
What do you mean “does not work because it’s wrong”? What result do you get?
Internally the now function generates the current local date… wondering if you’re having a timezone problem?
Thank you, Andrea. I thought it was wrong for two reasons:
because I can’t find any help documentation to evaluate it;
because I had “Could not parse CQL filter list. Function not found. Parsing : data_end < now().”
And it was actually wrong because I used %20%3C%20now() and not %20%3C%20'now()'.
I take the opportunity to add a question: is there a way to say in the query between today and the last 30 days?
Something like CQL_FILTER=field_name <= 'now()' AND data_fine >= 'now() - 30 days'.
GeoMesa supports this functionality, with the currentDatefunction, for example, currentDate('-P1D'). The functionality comes from the geomesa-filter module, which can be installed in GeoServer (make sure the supported version is correct). Installation will require transitive dependencies too - the easiest thing is probably to just install the GeoMesa Redis plugin, which is the smallest plugin that includes all the necessary jars.
(discourse will only let me post 2 links, so I’ll put additional links in a follow on)
Hmm, I seem to have been flagged as a spammer Are my posts actually considered against the community guidelines, or is there a way to get them re-instated?
thanks,
Emilio
Hi Emilio,
I can see your post from an incognito brower tab too, so they have been published and are visible to anyone.
I can see the message has been put in the moderator queue because, quoting
“This new user tried to create multiple posts with links to the same domain. All posts from this user that include links should be reviewed. See the newuser_spam_host_threshold site setting.”
I believe the control of how many links can be used in a post is in the hands of OSGeo itself, and I’m not sure for how long someone is considered “a new user”.
The filtering will be something like this (mind, not tested): dateDifference(now(), data_fine, 'd') < 30.
Also, depending on the datasource you’re using, the above filter can be delegated down to storage, or executed in memory.
Currently I believe only the postgis data store is able to execute that function natively.
now() is a function, while ‘now()’ is just a static string. I have the impression you’re trying to work
around a GeoServer that does not really have the “now” function. Which version are you using?