This is the tutorial about adding a shaded relief to your map in Geoserver.
Step 0: add your DEM map as GeoTIFF to GeoServer, see this tutorial.
Step 1: create a shaded relief
- Open OSGeo4W Shell
- Set your path to the directory your DEM map is in. You do this by typing 'cd D:\test' for instance. Now this appears: D:\test>
- Make use of the gdal library (which comes also together with QGis installation) to generate a DEM. The utility to analyze and visualize DEMs is called gdaldem. Type in the shell:
gdaldem hillshade input_dem.tif output_hillshade.tif
Step 2: open GeoSever
- Click on your windows start button. Open your GeoServer folder. There should be four options: Start GeoServer, Stop GeoServer, GeoServer Homepage Geoserver Admin Page. Click on ‘Start Geoserver’.
- Now go to your GeoServer folder again and click on the ‘Geoserver Admin Page’ and log in.
Step 3: create new layer style
- Go to 'Styles' and 'Add a new style'
- Name your style, e.g. Hillshade, select the workspace you created for the DEM layer and type this:
- It is important that the opacity is 0.3 so you can still see your original map underneath your hillshade.
- Click 'Validate' and 'Submit'.
Step 4: create new store and save layer
- Go to 'Stores' and 'Add a new store'
- Select 'GeoTIFF' under 'Raster Data Sources'
- Select your workspace, fill in 'Data Source Name' and for 'URL' select your output_hillshade.tif. Now click 'save' and 'publish' your layer.
Step 5: style your layer
- Go to 'Layers', click on the layer you just created and in the Edit Layer screen click 'Publishing'.
- Scroll down to 'WMS Settings' and set the 'Default Style' to the hillshade file you just created.
- Click 'Save'
Step 6: create layer group
- Go to 'Layer Groups' in the left and 'Add new layer group'
- Write down the Bounds or 'Generate Bounds' automatically
- Click 'Add Layer' and in 'Drawing order' select your DEM layer as '1' and the Hillshade layer as '2', so the hillshade is rendered on top of the DEM layer.
- Click 'Save'
Step 7: view your layer group
- Go to 'Layer Preview' and press on 'OpenLayers' for you layer group. Now both the hillshade and the DEM should be visible.