The 5 minute guide to setting up GeoServer and GeoWebCache on Windows


UPDATE – With Geoserver 2.0 out a while now, the information in this post is growing stale, as GeoWebCache is now an integral part of GeoServer, and overall installation and configuration of Geoserver has changed a lot – read: got a lot easier. Configuring GeoWebCache under GeoServer 2.0.x is described here. Grab a copy of GeoServer 2.0.x here. Read about upgrading to 2.0.x from earlier versions here.

I will keep this post available for archival purposes.

I came across yet another tile caching implementation, GeoWebCache, through this article on the Google Open Source blog. It integrates nicely with the Geoserver OGC server, which should make it very easy to set up on a Windows box. So let’s try that.First, we need to get the Java SDK (not the runtime environment) from Sun; Geoserver needs it. An older 1.4.x version will do, but if you start a-fresh, you might as well get the Java 6 SDK from here. Download and install it.

Then we grab a fresh copy of Geoserver from their web site. (direct download link for 1.6.3)

UPDATE 1.6.4 is out, as Mike Pumphrey pointed out already in the comments section. Improved support for the GeoWebCache plug-in is among the new features. Read on for the implications for this guide.

While you’re there, download the GeoWebCachce extension as well.

Unzip the GeoWebCache extension, which comes as a zip file.

Install the Geoserver package. It will try and locate the Java SDK and notify you about it. I don’t think installing in the default location is such a nice solution, so I changed this to c:\geoserver\ instead. The data directory then defaults to c:\geoserver\data_dir which I left like that.

When Geoserver is installed, we need to add all the JAR files that comprise the GeoWebCache extension to C:\geoserver\webapps\geoserver\WEB-INF\lib.

UPDATE The following config file tweak is obsolete as of Geoserver 1.6.4. Only if you want to stick with 1.6.3 or earlier, the following paragraph applies:

We need to make a small manual change to one of the Geoserver config files, web.xml in C:\geoserver\webapps\geoserver\WEB-INF\web.xml. This is described in the extension README:

find

<mime-mapping>

BEFORE, add

<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/gwc/*</url-pattern>
</servlet-mapping>

Before we start Geoserver, we are going to change the default admin credentials just to be on the safe side. To do this, we open C:\geoserver\data_dir\security\users.properties and change ‘admin=geoserver’ to ‘admin=[yourpassword]’.

Now we’re ready to start Geoserver and try to call the tile cache. We’re not going to add our own layers just yet; Geoserver comes with some simple sample data. To stret Geoserver, use the Start Menu entry or call

C:\geoserver\bin\startup.bat

from the Run box or a command line.

This will open a Java command line which should remain opened. The output shown could also be useful when you start hacking the Geoserver configuration. Your Windows firewall could complain about Java, in which case you could ‘Unblock’ Java to allow http access from outside your box.

To confirm that it all works, type

http://localhost:8080/geoserver/

in your browser, which should yield your Geoserver Admin home page (no maps there).

Now type

http://localhost:8080/geoserver/gwc/service/ve?layers=topp:states&quadkey=02

which should yield a Microsoft Virtual Earth tile schema compliant tile:

The last thing I want to do right now is to integrate this into a Microsoft Virtual Earth map client. This is quite well described in the GWC documentation and is dead simple anyway. Basically, you take a barebones VE map client template and add a VETileSourceSpecification:

var tileSourceSpec3 = new VETileSourceSpecification(“GeoserverSample”, “http://martijne:8080/geoserver/gwc/service/ve?quadkey=%4&format=image/png&layers=topp:states&#8221;);
tileSourceSpec3.NumServers = 1;
tileSourceSpec3.MinZoomLevel = 1;
tileSourceSpec3.MaxZoomLevel = 16;
tileSourceSpec3.Opacity = 0.3;
tileSourceSpec3.ZIndex = 100;
vemap.AddTileLayer(tileSourceSpec3, true);

You only need to change the server part of the URL in the first line to your computer name (or localhost if you’re only going to access the sample from your own machine).

Next steps

The major disadvantage of Geoserver for me is that it cannot do cascading WMS, although cascading WFS was recently implemented. So I’d like to set up GeoWebCache together with UMN MapServer to be able to do this.

When that’s done, I’d like to do some performance benchmarking and compare it to the Metacarta TileCache solution.

4 thoughts on “The 5 minute guide to setting up GeoServer and GeoWebCache on Windows

  1. Hi there. Thanks for the kudos. With GeoServer 1.6.4, which was just released, it is now no longer necessary to edit the web.xml file to install the GeoWebCache plugin. So I guess that turns this into a 4 1/2 minute guide. 🙂

  2. Hi,

    I also would like to know how to use the getfeature Info functionality and getfeature(WFS) of the geoserver like in google maps in virtual Earth.

    Thanks,

  3. Hi,
    I follwed the steps but the server won’t start up after I copy the jar files in to the ../WEB-INF/lib/ folder.
    Any reason why ?
    thank..
    raj

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s