4

I have a set of features in a PostGIS table, where each feature has an attribute describing when the feature was created.

I would like to serve the features as a WMS layer and I would like to style each feature according to how old the feature is. An example could be a feature created today should be RED, if the feature is younger than 3 days old it should be GREEN and features older than that should be BLUE.

I could create a PostGIS view calculating the age of the features and style according to that, but it will also appear in the GetFeatureInfo lookup, which I would like to avoid.

Can this be done currently in GeoServer?

2
  • 1
    if age is an attribute yes docs.geoserver.org/stable/en/user/styling/sld-cookbook/…
    – Mapperz
    Commented Apr 24, 2015 at 15:59
  • @chau were you able to solve this? I am looking at the same problem here, and to be able to solve it I would need to be able to refer to the current date in the SLD which seems impossible. So the only solution seems to use a view?
    – nathanvda
    Commented May 20, 2016 at 14:50

1 Answer 1

3

Definately it can be done, if you have styled your layer with the correct symbology then geoserver will just render that sld. On the question of it appearing in getfeature info look at geoserver templates which allows you to customise the how your get feature info behaves

1
  • 4
    Amazed when an answer that does not really answer anything ("it can be done" but does not explain how), still gets upvotes? Am I missing something? Please explain how you can write an SLD that filters on date, in reference to the current date.
    – nathanvda
    Commented May 20, 2016 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.