Setting up the 52°North WPS with GRASS backend under Linux and Apache Tomcat
For the Windows tutorial see
TutorialBackendGRASSWin. This tutorial has been tested under Ubuntu and Debian.
Prerequisites
From WPS version 3.3.0, you will need to have added the GeoTools package to the WPS.
You can find it in the
download area.
(It is assumed that Java 1.7 and Apache Tomcat are already installed.Other servlet container should work as well.)
- Download the latest WPS release from here.(If you want the source code, follow this tutorial)
- Rename the downloaded .war file to wps.war and drop it in the webapps folder of your tomcat.
- Install GRASS 7.0 You can either download GRASS 7.0 e.g. from here or compile and install it yourself (which we recommend for Linux). See this tutorial on how to compile and install GRASS 7.0 on Ubuntu.
- In order to use GRASS modules with the WPS, a file needs to be present, containing the absolute path to a file containing settings for GISDBASE, LOCATION_NAME and MAPSET. Possibly a demolocation was created by the GRASS installation. Otherwise, you will have to create a location yourself, e.g. using the GRASS GUI. Now you will need to create a new file, e.g in your user home directory. Three properties need to be stored in the file (you can find an example here: grassrc70):
- GISDBASE: must point to the parent directory of the existing GRASS location, e.g. /home/user/grassdata
- LOCATION_NAME: must be the name of the existing loctation, e.g. loc_ncarolina_spm_base0.3.1
- MAPSET: must be the name of the existing mapset, e.g. PERMANENT
- Grant user tomcat6 write access to the directory of the GRASS location AND the therein contained directory PERMANENT e.g. :
- sudo chown tomcat7:tomcat7 /home/user/grasdata/demolocation
- sudo chown tomcat7:tomcat7 /home/user/grasdata/demolocation/PERMANENT
- Download and unzip the wps-grass-bridge from here or check it out from the svn located here. Note that the GRASS backend currently doesn not work with the trunk version of the bridge.
- Note: If you get a "Permission denied" error trying to execute Grass processes, you will need to do the same as in step 5 with the wps_grass_bridge folder and the gms folder.
- Download and install Python.While the python executable is shipped with GRASS 7.0, the GrassModuleStarter needs some extra libraries. Thus a complete installation of Python is needed.
- Start your Apache Tomcat
- Go to http://localhost:<tomcat_port>/wps/webAdmin/index.jsp and login with username wps and password wps
- Activate the tab <Server Settings>
- Click on the edit button and change the port , if necessary
- Click on the edit button and change the port , if necessary
- Activate the tab <Algorithm Repositories>
- enable the Grass Repository
- Click on the edit button and set the variables
- Grass_Home must point to the installation directory of GRASS 7.0
- Python_Home must point to a directory that contains the python executable (e.g. the extrabin directory of the GRASS 7.0 installation or the path to the python installation (see step 7.))
- Python_Path must point to a directory that contains the python installation.
- Addon_Dir (optional) must point to a directory that contains the GRASS addons (python scripts without .py extension).
- The ModuleStarter_Home variable must point to the subdirectory of the wps-grass-bridge that contains the file GrassModuleStarter.py.
- GISRC_Dir must point to the GISRC file. See also step 4.
- TMP_Dir must point to a directory that is not read-only. Note: every time the WPS with enabled GRASS-backend is started it will attempt to delete all files in the tmp directory, so do not point to a directory that contains any important files!
- All Grass processes that will be exposed as WPS processes are listed as algorithm-properties of this repository. Here you can add, remove, activate and deactivate Grass processes according to your needs.
- The username and password for the WPS Admin Console can be changed in the file _TOMCAT_INSTALL_PATH_/webapps/wps/WEB-INF/classes/users.xml
Example configuration:
At the moment the following input and output types are supported by the 52°North GRASS-WPS backend:
Raster
Mimetype |
Input |
Output |
image/tiff |
Yes |
Yes |
image/geotiff |
Yes |
Yes |
application/geotiff |
Yes |
Yes |
application/x-geotiff |
Yes |
Yes |
image/png |
Yes |
Yes |
image/gif |
Yes |
Yes |
image/jpeg |
Yes |
Yes |
application/x-erdas-hfa |
Yes |
Yes |
application/netcdf |
Yes |
Yes |
application/x-netcdf |
Yes |
Yes |
Vector