This is the wiki page for adding and styling a GeoTiff to the GeoServer.
Step 0: Download and install GeoServer for windows. For this tutorial we use GeoServer 2.5.
Step 1: Open GeoServer
- 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’.
- Next go to your GeoServer folder again and click on the ‘Geoserver Admin Page’ and log in.
Step 2: Create a workspace
- To add a new GeoTiff layer, you will have to create your own workspace first. Click on the ‘Create Workspace’ button on the GeoServer admin page.
- Fill in your Name and Namespace URI and ‘Submit’. Now you have created your workspace. We use this workspace to organize the layers we will create.
Step 3: Create a store
- Go to the GeoServer admin homepage by clicking on the GeoServer button on the upper left side.
- Click on the ‘Add stores’ button. Here are a few options for what kind of data source you could create with GeoServer. In this tutorial we will explain how to add a GeoTIFF. From the ‘Raster Data Sources’ click on the ‘GeoTIFF’ button.
- Fill in the ‘Basic Store Info’. As ‘workspace’ select the workspace you just created. Name your data source and give it a description. The ‘Connection Parameters’ are important. This is the link to your .tif(f) file on your computer. To select the right path click on ‘Browse…’, from the URL click on ‘Home directory’ (or another location where the .tif(f) is stored) and go to the right folder and select the right .tif(f) file and ‘Save’. On the now appearing page called ‘New Layer’, click on ‘Publish’.
Step 4: Save layer
- Now you can edit your layer. You could add ‘New Keywords’ to make your map easier to find or add Metadata links etc. For this tutorial it is important that your map is visible in the color range of your preference. If you ‘Save’ your layer now, it would be visible, but not with the right colors.
- To check if it is visible, ‘save’ your map. On the left side underneath ‘Data’ press ‘Layer Preview’. Now you could choose the layer you just created and click ‘Open Layers and you will see your map. You can zoom in to see the map in more details.
Step 5: Style layer in Qgis
If you want to use your own color range for the data, you will have to create your own style in Qgis.
- Open Qgis.
- Add your data to Qgis via the Add Raster Data button on the left side.
- Right click on your data layer and select ‘Properties’.
- Select ‘Style’ on the left side.
- Change your render type to ‘Singleband pseudocolor’ and change the style into something you would like to use for your data.
- Save the style using the ‘Save Style’ button on the bottom and save as .qml file.
Step 6: Copy style in GeoServer
- Open the .qml file with e.g. notepad and copy the content into e.g. word, so all the lines are underneath each other so you will have a good overview
- Go to the admin page from GeoServer again
- Click on ‘Styles and ‘Add a new style’
- Name your style and select your workspace again.
- Choose Copy from existing style, select ‘dem’ and press ‘copy…’
- This field will appear:
- Change the name, title and abstract.
- Now use the word document with the copied .qml content. Change the colors to the colors the, quantities to the values and labels to the labels from the .qml content. If the opacity is 0.0, it means that the color will not be visible, so it will be white.
- Press ‘Validate’ to check if it works
- If there are no errors, then ‘submit’
Step 7: Add new style to your GeoTiff
- Go to ‘Layers’ and select the layer you just created. Make sure ‘Enabled’ and ‘Advertised’ are turned on and check if the ‘Coverage Band Details’ are set correctly, if not adjust them.
- Select the ‘Publishing’ tab. With the WMS settings select ‘Default style’ and change it to the one you just created. ‘Save’ the layer again. View your layer again with the ‘Layer preview’ and ‘Open Layers’. Now your layer should be displayed correctly.