Friday, October 14, 2011

Using OSM data in GeoServer: Part3 - GeoServer

To install GeoServer you have a lot of options:

I choose the WAR because I want to extend the funktionality of the server later on (Not in this tutorial).
Go to the download page and get the stable WAR and unzip it.

A WAR gets deployed into an application server. Also here you got a lot of options:

I choose GlassFish. Go to the download page and get the newest open source version.


Installation folder C:\glassfish3
Http port 8080
Admin port 4848
start command C:\glassfish3\glassfish\bin\asadmin.bat start-domain domain1

Go to the admin site and deploy the GeoServer WAR.
Open your browser and type in 'http://localhost:4848'.
Click on Applications and there on the 'Deploy...' button.
Choose the geoserver.war ond click 'OK'.

Open the page 'http://localhost:8080/geoserver'.

The default username and password ist admin and geoserver.

If you want to know how GeoServer generally works I recomend to read the excellent GeoServer User Manual.

Now we want to bring the spacial data into the browser.

Go to 'Workspaces'.
Click 'Add new workspace'

Name osm
Namespace URI

Go to 'Stores'.
Click 'Add new Store'.
Click 'PostGIS - PostGIS Database'.

Workspace osm
Data Source Name osm data
host localhost
port 5432
database osm
user osmuser
passwd ***

Now you have to create for every table a layer.

Go to 'Layers'.
Click 'Add a new resource'
Choose 'osm:osm data'.

In the Tab 'Data' go to the point 'Bounding Boxes' and compute the native- and Lat/Lon bounding boxes from data.
Check in the Tab 'Publising' if the 'Standard Stil' is point for planet_osm_point and line for planet_osm_line, planet_osm_roads and polygon fro planet_osm_polygon.
Click 'Save'.

Go to 'Layer Groups'.
Click 'Add new layer group'
Name: osm group
Click 'Add Layer...' and add all 4 layers.
Click 'Geerate Bounds'.
Click 'Save'

Go to 'Layer Preview'.
Find the osm group and click 'OpenLayers'.


  1. Hey Mate! Great tutorial it really helps me a lot. I will try to make a video tutorial out of it and upload it in YouTube. I have only one question. Why the map is so ugly? Mine is also like this. Thank you :)

    1. I know I know. Part4 was planned but Styling is pain ;)
      There are some SLD's available in the web but nothing comes close to OSM.
      Try it with:
      rough and ugly but a good starting point
      couldn't get it to work
      looks great but couldn't get it to work either

  2. This comment has been removed by the author.

  3. I've managed to run osm-in-a-box with a working map and styles :) If you want me to explain it to you please send me an email with your gtalk or skype (it is a long process) So I can show you via teamviewer how you can do it. And you can make some tutorial out of it later :)

  4. Dear, thanks for your manual. Could you please help for the SLD-styles for OSM shapes files from or from somewhere else?