GeoServer– Interpolate

Marketing
Marketing
  • Updated

by David Crowther

interpolate 1.png

Question:

How do you use the Interpolate option in GeoServer?

Answer:

As defined by the GeoServer help files, the option to Interpolate

‘… transforms a continuous-valued attribute into another continuous range of values. The function can be used within SLD styling parameters to convert the value of a feature attribute into a continuous-valued parameter such as colour, size, width, opacity, etc.

The transformation is defined by a set of (input, output) control points chosen along a desired mapping curve. Piecewise interpolation along the curve is used to compute an output value for any input value.

The function is able to compute either numeric or colour values as output. This is known as the interpolation method and is specified by an optional parameter with a value of numeric (the default) or colour.’

Here is an example of how I implemented it within the DynamicMaps webGIS – MapThat!

As a comparison I already have a GeoServer Style that creates a thematic map of the Lower Super Output Areas (LSOA’s) for Liverpool mapped using their Population value.

interpolate 2.jpg

This original thematic uses multiple RULES within the SLD to define Literal Values to create RANGES…. e.g. between 0-1000 and then uses a Hex Colour to style the data that falls into each range.

interpolate 3.jpg

In this example the SLD will need to have multiple RULES for each category which can be time consuming to create… and can also lead to subjectivity in how you classify the data.

interpolate 4.jpg

In our new example we will use the SLD parameter of Interpolate to create a new Style file.

interpolate 5.jpg

… using the Polygon Symbolizer example within the GeoServer help pages.

interpolate 6.jpg 

… we simply copy the text into our SLD.

interpolate 7.jpg 

The highlighted values below are the population values to separate the data… using low, medium, and high population values.

interpolate 8.jpg

Note – ensure you change the PropertyName at the top to be the name of your field.  E.g. Populati_1

The highlighted values below are the colour hex values to style the data for the individual map features.

interpolate 9.jpg

Once applied the new LSOA layer is now styled by interpolating the map features using these 3 literal values, assigning a variation of the 3 colours dependant on how close the value is to the defined literal value.

interpolate 10.jpg

And shown in our webGIS – MapThat - the new LSOA WMS looks like the below.

interpolate 11.jpg

Notice how the layer doesn’t need separate range classes, the Style instead classifies the data on the fly.

If we now update the SLD and firstly amend the Low and Medium literal values and also assign a colour of BLUE to the lower range, we will reclassify how the map features are styled.

interpolate 12.jpg

And in our webGIS the WMS now looks different, with more map features styled differently and blue used as the lower range.

interpolate 13.jpg

And finally, we can also add extra Literal values to the SLD, so that the Interpolate uses more distinct values to map the LSOA features. In this case we used the colour of yellow for the inserted extra middle range.

interpolate 14.jpg

The new Interpolate WMS now shows the LSOA’s styled by interpolating a range of colours for each Population value.

interpolate 15.jpg

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.