On Tue, Mar 26, 2013 at 9:35 AM, wwsmith <wwsmith@anonymised.com> wrote:
Using GeoServer 2.1.4 I'm looking for the possibility to use (system) time
functions in SLDs.
Concrete: we have layer stores with data sets containing a text time stamp
like '2010-03-01' or '2012/04/01'. Now the SLD should display all data which
are older than 2 years - looking at the actual date ... - in an other color
than the default color.
Are there any suggestions?
There are no functions for date manipulation out of the box.
However, it's not hard to implement them if you can develop in Java,
the function subsystem is pluggable, new functions can be added
in GeoServer by dropping in a custom jar in the right format.
GeoTools has a tutorial on its plugin system that uses functions as
an example... the example is quite a bit more complex than necessary,
you actually just need to create the function and you can register it
directly without having to also create a factory for it:
http://docs.geotools.org/latest/userguide/tutorial/factory.html
It's really just:
1) create the function, e.g.
https://github.com/geotools/geotools/blob/master/modules/library/main/src/main/java/org/geotools/filter/function/string/ConcatenateFunction.java
2) register the function in SPI, eg.:
https://github.com/geotools/geotools/blob/master/modules/library/main/src/main/resources/META-INF/services/org.opengis.filter.expression.Function#L168
You just create a jar with those two files, drop it in GeoServer, and you
get the extra function available to SLD, WFS and so on
Cheers
Andrea
--
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------