1

I am doing normalisation of two fields on GeoServer.

     <ogc:Div>
       <ogc:PropertyName>PERSONS</ogc:PropertyName>
       <ogc:PropertyName>LAND_KM</ogc:PropertyName>
     </ogc:Div>

Now I want to round the result of Division to n decimal places.

3

To simply format it you can use the numberFormat function. This allows you to specify how many digits you want after the decimal point.

Here is an example from MASS-GIS:

    <TextSymbolizer>
        <Label>
          <Function name="numberFormat">
            <Literal>#</Literal>
            <PropertyName xmlns="http://www.opengis.net/ogc">CONTOUR_FT</PropertyName>
          </Function>
        </Label>

If you also want to round the result there is a round function which while return the nearest integer value.

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.