Lecture on Geo-processing using WPS - Additional material
Introduction
Hands-on material for Geo-processing using WPS.
Preparations
The tasks that are described in this turorial can best be performed using the
OSGeoLive DVD 9.5.
The minimum software requirements for this turorial are:
- A servlet container, e.g. Tomcat
- A 52°North WPS (Download)
- A GeoServer (Download)
- Additional data and software (Download)
Just set up the servlet container and deploy the services. For this tutorial, you can leave the default settings (e.g. admin-accounts). Now you are ready to perform the basic task described in this tutorial.
For the other tasks, additional software is required (see above). If you are using the OSGeoLive DVD, download the data and execute the command sh commands.sh
Save process result in GeoServer instance
This is described in the OSGeo Live DVD Quickstart:
http://live.osgeo.org/en/quickstart/52nWPS_quickstart.html
Upload Java prozess
Open the WPS Admin Console:
http://localhost:8080/52nWPS/webAdmin/index.jsp
Username: wps
Password: wps
Click on the button Upload Process
Paste the following text in the upper textfield:
org.n52.wps.server.algorithm.jts.JTSBufferAlgorithm
Click on Browse and open the JTSBufferAlgorithm.java file (TODO, beschreiben, wo es liegt):
Click on Submit Query, the process will now be uploaded and compiled. Open in the Admin Console the tab Algorithm Repositories and scroll to LocalAlgorithmRepository.
Add the new process
.
Click the save button
. Now Click on Save and Activate Configuration at the top of the Admin Console.The process now will be activated.
Test uploaded process
Now you can test the new process. Open the OpenLayers-Example:
http://localhost:8080/openlayers-example/wps.html
The JTSBufferAlgorithm should appear in the process-list. Choose it.
Now create a geometry in the OpenLayers-map.
Select the geometry (Click on the pencil-symbol on the right and then on the geometry).
Click in the data-textbox. The geometry should appear there in the WKT-format. Fill in the other inputs, endCapStyle and distance (in meters) are mandatory.
After a click on Execute the buffered geometry should appear on the map.
Setup R backend
Open the console:
Execute the following commands:
sudo R
Password: user
install.packages("Rserve")
Choose a mirror
install.packages("sos4R")
install.packages("xts")
library(Rserve)
Rserve()
Open the WPS Admin Console:
http://localhost:8080/52nWPS/webAdmin/index.jsp
Nutzername: wps
Passwort: wps
Expand the Algorithm Repositories tab and scroll to!LocalRAlgorithmRepository.
Check Active. After a click on Save and Activate Configuration the WPS will be restarted. Now the WPS4R processes are available.
Request the capabilities of the WPS, the R processes should be shown:
http://localhost:8080/52nWPS/WebProcessingService?Request=GetCapabilities&Service=WPS
You can have a closer look at e.g. the process org.n52.wps.server.r.demo.timeseriesPlot:
http://localhost:8080/52nWPS/WebProcessingService?request=DescribeProcess&service=WPS&version=1.0.0&identifier=org.n52.wps.server.r.demo.timeseriesPlot
The underlying R script can be viewed here:
http://localhost:8080/52nWPS/R/scripts/demo_timeseries-plot.R
Open the R timeseries demo:
http://localhost:8080/52nWPS/R/demo/ImageRendering.html
A click on "create time series plot" requests the PegelOnline SOS and creates a diagram that shows the waterlevel and a fitted regression line.
Setup GRASS 7 backend
Open the WPS Admin Console:
http://localhost:8080/52nWPS/webAdmin/index.jsp
Nutzername: wps
Passwort: wps
Expand the tab Algorithm Repositories and scroll t GrassRepository. Check Active and modify the properties of the repository as follows:
- Property "GISRC_Dir" = /home/user/grassdata/.grassrc70
- Property "Grass_Home" = /usr/lib/grass70
- Property "ModuleStarter_Home" = /home/user/wps-grass-bridge-patched/gms
- Property "Python_Home" = /usr/bin
- Property "Python_Path" = /usr/lib/python2.7
- Property "TMP_Dir" = /tmp/grass_tmp
After a click on Save and Activate Configuration the WPS will be restarted. Now the GRASS 7 processes are available.
Execute GRASS 7 WPS process with QGIS
Start QGIS and open the file elev_srtm_30m.tif that you can find in the downloaded zip-file.
Click the menu item Plugins -> Manage and Install Plugins...
Install the WPS Client Plugin
The WPS Client Plugin should appear left in QGIS. If not, click the menu item Web -> WPS-Client -> WPS-Client.
Click on connect. Then click on New to add a WPS Server.
Name e.g.: 52nWPS
URL:
http://localhost:8080/52nWPS/WebProcessingService
Click Ok and then Connect. The processes of the WPS should be shown.
Choose the r.watershed process, A double-click will open the following dialog:
Use elev_srtm_30m as input for elevation. Set the other raster inputs (depression, flow, disturbed_land, blocking) to <None>. Use e.g. 1000 for the threshold. Set all process outputs exept basin to <None>.
A click on Run starts the WPS process.