2

I have a raster with 95 different integer values (1-95). When I do a GetFeatureInfo request, GeoServer sends back the raster cell integer value. That makes sense, but what if I want a text value (a descriptive label). I have the descriptive label in my style (.sld) and the legend is generated using this label. I'd like to get that label back through GetFeatureInfo. ArcGIS Server solves this problem by associating an attribute table to the raster (a row for each unique raster value). Is there a way to accomplish this sort of thing in GeoServer/WMS?

1 Answer 1

2

Recent Geoserver versions

It is now possible to include the labels in the response, eventually along with the values, using a vendor option, see the documentation for details:

https://docs.geoserver.org/stable/en/user/tutorials/GetFeatureInfo/raster.html

Before GeoServer 2.18.3, 2.19.1, and 2.20

Generally speaking, no, there is no such way. However, if your particular output format is HTML, then you can write your own freemarker template and put the value to label mapping logic in there: http://docs.geoserver.org/stable/en/user/tutorials/GetFeatureInfo/index.html#tutorials-getfeatureinfo

Adding the same functionality as ArcGIS would be a new feature, you can read how to handle feature requests here: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

2
  • Is it still true that there's no way to pull a label/class name from a raster attribute table stored in a GeoTIFF, with Geoserver? I can't find any documentation to the contrary, but thought it was worth checking. Aug 30, 2022 at 13:08
  • 1
    Nope, not true any longer. Aug 31, 2022 at 16:51

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.