Almost all rasters I have in GeoServer are with float values, which means they contain at least 15 decimals. Is it possible to round these values for the getfeatureinfo?

I was looking in the data settings of my layer, but it doesn't seem like there is an option there. I am sure this must be possible.

  • I think the easiest place to do this is in the client – Ian Turton Mar 1 at 10:54

If you are using the HTML GetFeatureInfo output, you can prepare a custom Freemarker template for each layer that will do the rounding: https://docs.geoserver.org/stable/en/user/tutorials/freemarker.html

For any other format the answer is no, there is no way to control rounding, but as Ian said, best to do it on the client side (you need to know what is the meaning of a value to round it in a sensible way, for some values one would like to keep 6 decimals, for others 2, for others zero, and so on).

If you still want the server side to do it, check this guide: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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