Saturday, November 1, 2008

GeoServer 1.70 Setup with MrSID and GeoWebCache

Here are the procedures I used to successfully setup GeoServer 1.70 on a Windows 2003 server:

1) Download the latest Java SE JDK (I used http://java.sun.com/javase/downloads/index.jsp )
and install it to where you like.

Set an environment variable (I did a System EV) for JAVA_HOME to point to the directory where the JDK is installed.

2) Download GeoServer 1.70 from geoserver.org. Install it, choosing your install directory and data directory. Note that if you chose a different data directory than the default like I did, you will have to move all the contents of the data_dir from the geoserver install directory to your own data directory.

3) Follow the instructions carefully from:
http://geoserver.org/display/GEOSDOC/ImageIO-ext+GDAL+extensions
to install the Image-IO extensions. Note that you have three downloads, one is the JAR files from the main GeoServer 1.7 download page, and two from this page.

4) Download the GeoWebCache extension from the main GeoServer download page, and copy the JAR files from the zip to the program_files/geoserver_directory/webapps/geoserver/WEB_INF/lib . This is also stated in the readme inside the zip

5) Fire up Geoserver from the start menu entry for Geoserver. Say yes to any warnings about firewall.

6) Start up the Geoserver administrator from the same place. Go to Demos and try the Map Preview for some layers to see if everything is working.
Go to Config|WCS|CoveragePlugins and verify that MrSID is there.

7) Copy your MRSID files to your geoserver data directory/coverages/MrSIDSample

8) Follow the instructions on this page, to create the mosaic.

http://geoserver.org/display/GEOSDOC/Using+the+ImageMosaic+plugin

Use the GDALTIndex instructions. This will create the SHP file for the mosaic. I usually copy GDALTINDEX.exe and all the rest of the GDAL utilities (GDAL version 1.4) into the JAVA_HOME/bin, and add this path to the path environment variable.

Open a command window. Go to the directory where the MrSids are.

To quickly create the SHP file,

for %q in (*.sid) do gdaltindex mrsidsample %q

then you will have the .SHP done.
Next create a .PRJ file for the projection. This is a little tricky, but it is a WKT prj the same as from a SHP file. Name it the same mrsidsample.prj

Finally, create a mrsdidsample.properties file, in our case this is:

Name=MrSidSample
Levels=1.0,1.0
LevelsNum=1
Envelope2D=360646.500000,3728054.500000 372944.500000,3735762.500000
NumFiles=2

Create a Mosaic coverage and test it in demos. It should appear.



Finally, to test the GeoWebCache, first create a new WMS layer-group MrSID4326, generate the bounding rectangle, test it in demo.

then create an open layers html page that accesses the cache