In R, we call the runif- function to produce a single random number between to numbers, e. g. 0 and 1. This is basically what we want our process to do:
> runif(1, min=0, max=1)
[1] 0.6292043
# random number:
min = 0
max = 1
output = runif(1, min=min, max=max)
# wps.in: min, double, value = 0; # wps.in: max,double, value = 1; # random number: min = 0 max = 1 output = runif(1, min=min, max=max) # wps.out: output, double;
# wps.in: min, double, value = 0; # wps.in: max, double, value = 1; # wps.in: n, integer, value = 100; # random number: x = runif(n, min=min, max=max) output = "outputfilename"write.table(x, output) # wps.out: output, text;
# wps.des: id = R_andom, title = Random number generator,
# abstract = Generates random numbers for uniform distribution;
# wps.in: min, double, Minimum, All outcomes are larger than min, value = 0;
# wps.in: max, double, Maximum, All outcomes are smaller than max, value = 1;
# wps.in: n, integer, ammount of random numbers, value = 100;
# random number:
x = runif(n, min=min, max=max)
output = "outputfilename"
write.table(x, output)
# wps.out: output, text, Random number list, Textfile containing n random numbers in one column;
Figure 1: Upload the script
Figure 2: Repository view - process ready to use
<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>
<wps:Execute service="WPS" version="1.0.0"
xmlns:wps="http://www.opengis.net/wps/1.0.0"
xmlns:ows="http://www.opengis.net/ows/1.1"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/wps/1.0.0
http://schemas.opengis.net/wps/1.0.0/wpsExecute_request.xsd">
<ows:Identifier>org.n52.wps.server.r.R_andom</ows:Identifier>
<wps:ResponseForm>
<wps:RawDataOutput mimeType="text/plain">
<ows:Identifier>output</ows:Identifier>
</wps:RawDataOutput>
</wps:ResponseForm>
</wps:Execute>
A list of 100 random values should now appear. If so, your process has been successfully deployed!
Figure 3: Test Client - submit execute request