[Geoserver-users] Dynamic SLD Filter?

Hi,
is it possible to use dynamic temporal SLD filters? I'd like to display a few colored lines with SLD. The lines are Linestring Objects from a PostgreSQL/PostGIS DB with one Time (15:14:00) and one Date (2007-02-10) attribute. The colour of the line should depend on the Time and Date attributes. For example: Older lines should be red and younger lines green. I'm thinking of something like:

<ogc:Filter>
  <ogc:And>
    <ogc:PropertyIsLessThan>
      <ogc:PropertyName>attributename</ogc:PropertyName>
      <ogc:Literal>(CURRENT_TIME - interval '1 hour')</ogc:Literal>
    </ogc:PropertyIsLessThan>
    <ogc:PropertyIsEqualTo>
      <ogc:PropertyName>attributename</ogc:PropertyName>
      <ogc:Literal>(CURRENT_DATE)</ogc:Literal>
     </ogc:PropertyIsEqualTo>
  </ogc:And>
</ogc:Filter>

I found an example like this while browsing Google and tried using it in my .sld-File, but Geoserver's Map Preview remains blank. I tried CURRENT_TIMESTAMP without success. I'm using Geoserver Version 1.3.4, PostgreSQL 8.1.5, PostGIS 1.1.5.
Thanks for your help,
Alexander

I don't think there is a great way to do this. What you could do is have a pre-determined time range that is set on the client-side and filled into an SLD document that you can then send to GeoServer as an SLD POST request. It will then render the data with that SLD.

For instance, you would take the current time and then use that for each filter in the SLD file, where you will have several rules for different colors; say 5 rules, each being (current_time - N*days), then have a filter that will check if the feature's time/date is less than that time, and color it accordingly.

Other than that, there isn't an easy built-in way to do it.

Brent Owens
(The Open Planning Project)

Alexander Padberg wrote:

Hi,
is it possible to use dynamic temporal SLD filters? I'd like to display a few colored lines with SLD. The lines are Linestring Objects from a PostgreSQL/PostGIS DB with one Time (15:14:00) and one Date (2007-02-10) attribute. The colour of the line should depend on the Time and Date attributes. For example: Older lines should be red and younger lines green. I'm thinking of something like:

<ogc:Filter>
  <ogc:And>
    <ogc:PropertyIsLessThan>
      <ogc:PropertyName>attributename</ogc:PropertyName>
      <ogc:Literal>(CURRENT_TIME - interval '1 hour')</ogc:Literal>
    </ogc:PropertyIsLessThan>
    <ogc:PropertyIsEqualTo>
      <ogc:PropertyName>attributename</ogc:PropertyName>
      <ogc:Literal>(CURRENT_DATE)</ogc:Literal>
     </ogc:PropertyIsEqualTo>
  </ogc:And>
</ogc:Filter>

I found an example like this while browsing Google and tried using it in my .sld-File, but Geoserver's Map Preview remains blank. I tried CURRENT_TIMESTAMP without success. I'm using Geoserver Version 1.3.4, PostgreSQL 8.1.5, PostGIS 1.1.5.
Thanks for your help,
Alexander

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

IMO this might be doable--in the case of using a Postgis store.

Look into defining a function that returns a boolean whether or not
data is older than 1 hour. Postresql's time, date, and/or timestamp
functions should help with this. Then create a view that pulls your
data from the table, with an extra field that does the above-mentioned
calculation with you new function.

Then, use this new field in your SLD, and color the data based on true
or false.

This is just an idea--I don't have the exact solution at the moment.
But it should be possible.

Alex

On 2/12/07, Brent Owens <brentowens@anonymised.com> wrote:

I don't think there is a great way to do this. What you could do is have
a pre-determined time range that is set on the client-side and filled
into an SLD document that you can then send to GeoServer as an SLD POST
request. It will then render the data with that SLD.

For instance, you would take the current time and then use that for each
filter in the SLD file, where you will have several rules for different
colors; say 5 rules, each being (current_time - N*days), then have a
filter that will check if the feature's time/date is less than that
time, and color it accordingly.

Other than that, there isn't an easy built-in way to do it.

Brent Owens
(The Open Planning Project)

Alexander Padberg wrote:
> Hi,
> is it possible to use dynamic temporal SLD filters? I'd like to display
> a few colored lines with SLD. The lines are Linestring Objects from a
> PostgreSQL/PostGIS DB with one Time (15:14:00) and one Date (2007-02-10)
> attribute. The colour of the line should depend on the Time and Date
> attributes. For example: Older lines should be red and younger lines
> green. I'm thinking of something like:
>
> <ogc:Filter>
> <ogc:And>
> <ogc:PropertyIsLessThan>
> <ogc:PropertyName>attributename</ogc:PropertyName>
> <ogc:Literal>(CURRENT_TIME - interval '1 hour')</ogc:Literal>
> </ogc:PropertyIsLessThan>
> <ogc:PropertyIsEqualTo>
> <ogc:PropertyName>attributename</ogc:PropertyName>
> <ogc:Literal>(CURRENT_DATE)</ogc:Literal>
> </ogc:PropertyIsEqualTo>
> </ogc:And>
> </ogc:Filter>
>
> I found an example like this while browsing Google and tried using it in
> my .sld-File, but Geoserver's Map Preview remains blank. I tried
> CURRENT_TIMESTAMP without success. I'm using Geoserver Version 1.3.4,
> PostgreSQL 8.1.5, PostGIS 1.1.5.
> Thanks for your help,
> Alexander
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier.
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Geoserver-users mailing list
> Geoserver-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users