[Pywps-commits] r1008 - in branches/pywps-foss4g2010: doc/source/_static doc/source/clients doc/source/special pywps pywps/Process pywps/Templates/1_0_0/inc pywps/Wps tests tests/Templates/1_0_0/inc tests/processes webservices/tomcat
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Sep 6 11:18:23 CEST 2010
Author: jachym
Date: 2010-09-06 11:18:23 +0200 (Mon, 06 Sep 2010)
New Revision: 1008
Added:
branches/pywps-foss4g2010/pywps/Wps/Execute.py
Removed:
branches/pywps-foss4g2010/doc/source/_static/pywps_jython.png
branches/pywps-foss4g2010/doc/source/special/java.rst
branches/pywps-foss4g2010/pywps/Wps/Execute/
branches/pywps-foss4g2010/tests/processes/buffer.py
Modified:
branches/pywps-foss4g2010/doc/source/clients/javascript.rst
branches/pywps-foss4g2010/pywps/Process/InAndOutputs.py
branches/pywps-foss4g2010/pywps/Process/__init__.py
branches/pywps-foss4g2010/pywps/Template.py
branches/pywps-foss4g2010/pywps/Templates/1_0_0/inc/DescribeProcess_BoundingBoxValue.tmpl
branches/pywps-foss4g2010/tests/Templates/1_0_0/inc/DescribeProcess_BoundingBoxValue.tmpl
branches/pywps-foss4g2010/tests/perform_requests.py
branches/pywps-foss4g2010/tests/processes/__init__.py
branches/pywps-foss4g2010/tests/processes/dummyprocess.py
branches/pywps-foss4g2010/tests/processes/tests.py
branches/pywps-foss4g2010/webservices/tomcat/PywpsServlet.py
branches/pywps-foss4g2010/webservices/tomcat/web.xml
Log:
reverting last changes
Deleted: branches/pywps-foss4g2010/doc/source/_static/pywps_jython.png
===================================================================
(Binary files differ)
Modified: branches/pywps-foss4g2010/doc/source/clients/javascript.rst
===================================================================
--- branches/pywps-foss4g2010/doc/source/clients/javascript.rst 2010-09-06 09:02:03 UTC (rev 1007)
+++ branches/pywps-foss4g2010/doc/source/clients/javascript.rst 2010-09-06 09:18:23 UTC (rev 1008)
@@ -4,7 +4,7 @@
`OpenLayers <http://openlayers.org>`_. The client *does not show any
results in the map*, but it enables you, as client coder, to program the
client in hopefully easy way. The client is located in
-:file:`PyWPS-source/webclient/WPS.js`. Beside this file, OpenLayers have to
+:file:`pywps-source/webclient/WPS.js`. Beside this file, OpenLayers have to
be included in the web page.
Initialization and GetCapabilities request
@@ -215,60 +215,3 @@
};
The rest was already defined before.
-
-Handling vector data
-......................................................
-A typical operation performed using OpenLayers and a WPS service,
-is to send data to the server and display the results directly over the map.
-For example consider a process that allows to generate a buffer starting from
-vector data and a number to use as buffer's value. From the DescribeProcess we
-see that those two inputs must be passed as "data" and "buffer".
-At this point we start with the configuration of OpenLayers:
-
-Add vector layer used for editing and the editing toolbar control:
-
-.. code-block:: javascript
-
- vlayer = new OpenLayers.Layer.Vector("Editable");
- edit = new OpenLayers.Control.EditingToolbar(vlayer);
- map.addControl(edit);
-
-Now create the WPS object as defined before;a bit of attention to input/output parameters
-because we're going to use the featues drawn by the user (vlayer) and a literaldata inserted
-in a HTML text box with buffer as id.
-
-Input:
-.. code-block:: javascript
-
- var dataInput = new OpenLayers.WPS.ComplexPut({
- identifier:"data",
- value: OpenLayers.Format.GML.prototype.write(vlayer.features)
- });
-
- var literalInput = new OpenLayers.WPS.LiteralPut({
- identifier:"buffer",
- value: document.getElementById("buffer").value
- });
-
-Ouput:
-
-..code-block:: javascript
- var complexOutput = new OpenLayers.WPS.ComplexPut({
- identifier: "output",
- asReference: "true"
- });
-
-Now move to the onSuceedeed function, the one executed once the process has successfully run.
-Basically we need to add the output file to the list of layers in the map object. OpenLayers
-allows to add GML directly on the map, but watch out for file too big:
-
-..code-block:: javascript
- var onWPSSussceeded = function(process) {
- //We need to remove the layer generated by previous instance of the script
- try {
- map.removeLayer(rlayer);
- rlayer.destroy();
- } catch(e) {}
- url = process.getOutput("output").value;
- rlayer = new OpenLayers.Layer.GML("Result",url);
- Pap.addLayer(rlayer);
Deleted: branches/pywps-foss4g2010/doc/source/special/java.rst
===================================================================
--- branches/pywps-foss4g2010/doc/source/special/java.rst 2010-09-06 09:02:03 UTC (rev 1007)
+++ branches/pywps-foss4g2010/doc/source/special/java.rst 2010-09-06 09:18:23 UTC (rev 1008)
@@ -1,190 +0,0 @@
-PyWPS and Java
-**************
-.. note:: Very important source for this section was `Jython Webapp
- Tutorial
- <http://seanmcgrath.blogspot.com/JythonWebAppTutorialPart1.html>`_ by
- Sean McGrath. And
- `Distributing Jython Scripts <http://wiki.python.org/jython/JythonFaq/DistributingJythonScripts>`_ page.
-
-Since 3.2x version, PyWPS is able to run in Java environment, using Python interpreter in Java -
-`Jython <http://jython.org>`_ .
-
-With Jython it is possible to access Java classes from Python code, as well
-as acces Python classes from Java code. So, it is no big problem to setup
-PyWPS, so it runs as Java servlet under Apache `Tomcat
-<http://tomcat.apache.org>`_ server and so, being able to access all the
-mighty Java tools for geodata processing.
-
-.. note:: One big note must be remarked on this place: Current version of
- Jython (2.5.1) does NOT support `os.fork()` [#f1]_ calls, which is the way,
- PyWPS is able to perform request assynchronously (which is the case, if
- you are requesting `status=true`). So currently, it is NOT possible to
- use assynchronous calls on PyWPS Execute request, if running within
- Jython. There are techniques, which do enable overcome this issue, but
- currently, they are not implemented in PyWPS yet.
-
-.. note:: We are using Tomcate 6.x. If you test PyWPS on 7.x, please let us
- know.
-
-.. note:: You should work with distribution of Java from Sun (now Oracle).
- Other JVMs are not tested (and usually, their usage is problematic).
- You can test, which interpreter you are using by running::
-
- java -version
-
- java version "1.6.0_20"
- Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
- Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed mode)
-
-Before running PyWPS as Java servlet, several steps have to be performed.
-
-#. Install Apache Tomcat server [#f2]_
-#. Configure Apache Tomcat
-#. Prepare the Jython-lib package
-#. Write the PyWPS-Servlet wrapper (similar to CGI wrapper)
-#. Run the server
-
-It is assumed, you have downloaded and installed the Tomcat server in your
-system.
-
-Configure Tomcat
-================
-Create `wps` directory within the `webapps` directory of Tomcat.::
-
- cd apache-tomcat-6.0.29/wps
- mkdir wps
-
-Create also the configuration directory within new `wps` directory and
-location for used Java lib::
-
- mkdir wps/WEB-INF
- mkdir wps/lib
-
-Configuration in Tomcat happens in :file:`web.xml` file, located in the
-`WEB-INF` directory. There is example of such configuration file, which you
-can simply copy from PyWPS source ::
-
- cp $PYWPS_SOURCE/webservices/tomcat/web.xml wps/WEB-INF/
-
-As second, copy the content of `pywps` module to `wps` directory::
-
- cp -r $PYWPS_SOURCE/pywps wps/
-
-(You should now have directories like `wps/pywps/default.py,
-wps/pywps/Exceptions.py, wps/pywps/Parser.py` and others.)
-
-Prepare the jython-lib package
-==============================
-Download and install Jython. Once, you download it, you have to run the
-install script::
-
- java -jar jython_installer-2.5.1.jar
-
-Once it is installed, you have to crate Java archive, with all necessary
-Python modules and copy it to `wps` directory of Tomcat server::
-
- cd $JYTHON_HOME
- cp jython.jar jythonlib.jar
- zip -r jythonlib.jar Lib
- cp jythonlib.jar $CATALINA_HOME/webapps/wps/lib/
-
-Now you should be able to configure PyWPS wrapper script
-
-Prepare the PyWPS-Servlet wrapper
-=================================
-Take the :file:`webservices/tomcat/PywpsServlet.py` file and store it to
-`webapps/wps/` directory.::
-
- cp $PYWPS_SOURCE/webservices/tomcat/PywpsServlet.py wps/`
-
-Let's edit it
-
-.. literalinclude:: ../../../webservices/tomcat/PywpsServlet.py
- :language: python
-
-Note the `getProcesses()` method, which creating one process on-the-fly.
-
-.. centered:: That is the way, how you can create custom Java-based processes
- and make them accessable via PyWPS.
-
-You can also set some environment variables, as you are probably used to:
-
-.. code-block:: python
-
- import os
- os.environ["PYWPS_PROCESSES"] = "/path/to/processes"
-
-the complete script looks like follows
-
-.. code-block:: python
-
-
- from java.io import *
- from javax.servlet.http import HttpServlet
-
- import pywps
- from pywps.Exceptions import *
- import traceback
- import os
-
- class PywpsServlet(HttpServlet):
-
- def doGet(self,request,response):
-
- inputQuery = request.getQueryString()
- if not inputQuery:
- e = NoApplicableCode("Missing request value")
- pywps.response.response(e,response)
- self.doPywps(request, response, inputQuery, pywps.METHOD_GET)
-
- def doPost(self,request,response):
-
- inputQuery = request.getQueryString()
- self.doPywps(request, response, inputQuery, pywps.METHOD_POST)
-
- def doPywps(self,request, response, inputQuery,method):
-
- os.environ["PYWPS_PROCESSES"] = "/usr/local/src/pywps/trunk/tests/processes/"
- # create the WPS object
- try:
- wps = pywps.Pywps(method)
- if wps.parseRequest(inputQuery):
- pywps.debug(wps.inputs)
- wpsresponse = wps.performRequest()
- if wpsresponse:
- pywps.response.response(wps.response, response, wps.parser.isSoap)
- except WPSException,e:
- pywps.response.response(e, response)
-
-
-Run the server
-==============
-... and see, what happens.::
-
- bin/startup.sh
-
- Using CATALINA_BASE: /tmp/apache-tomcat-6.0.29
- Using CATALINA_HOME: /tmp/apache-tomcat-6.0.29
- Using CATALINA_TMPDIR: /tmp/apache-tomcat-6.0.29/temp
- Using JRE_HOME: /usr/lib/jvm/java-6-sun/
- Using CLASSPATH: /tmp/apache-tomcat-6.0.29/bin/bootstrap.jar
-
-
-Test the PyWPS, to to url http://localhost:8080/wps/PywpsServlet?service=wps&request=getcapabilities
-
-And let us execute something as well: http://localhost:8080/wps/PywpsServlet.py?service=wps&request=execute&version=1.0.0&identifier=dummyprocess
-
-Conclusion
-==========
-This chapter describes the basics, how to setup Apache Tomcat server
-together with PyWPS. Advanced users will probably skip the configuration
-part and go directly to PyWPS part.
-
-It shows, how easy it is to connect two worlds: Python and Java. It makes
-it easy to access Java-based analytical tools being exposed to the outside
-world via OGC WPS.
-
-.. [#f1] http://wiki.python.org/jython/JythonFaq/ProgrammingJython#TheJython.27sosmoduleismissingsomefunctions.2Cwhy.3F
-.. [#f2] Ubuntu users: better use the version from Apache side, rather then
- package from ubuntu repository.
-
Modified: branches/pywps-foss4g2010/pywps/Process/InAndOutputs.py
===================================================================
--- branches/pywps-foss4g2010/pywps/Process/InAndOutputs.py 2010-09-06 09:02:03 UTC (rev 1007)
+++ branches/pywps-foss4g2010/pywps/Process/InAndOutputs.py 2010-09-06 09:18:23 UTC (rev 1008)
@@ -388,7 +388,6 @@
# download data
if input.has_key("asReference") and input["asReference"] == True:
- import sys
self.downloadData(input["value"])
else:
self.storeData(input["value"])
@@ -827,35 +826,17 @@
.. attribute :: projection
- file projection (used by mapserver, see useMapscript below), is not set, will be determined
- automatically
+ file projection (used by mapserver)
.. attribute :: bbox
- data bounding box (used by mapserver, see useMapscript below)
- if not set, will be determined automatically
+ data bounding box (used by mapserver)
.. attribute :: width
-
- (used by mapserver, see useMapscript below)
- if not set, will be determined automatically
-
.. attribute :: height
-
- (used by mapserver, see useMapscript below)
- if not set, will be determined automatically
-
.. attribute :: useMapscript
- If set to true and asReference is set to true (by request), PyWPS
- will gerenate UMN MapServer mapfile and point the reference URL to
- it, so that raster layer will be accessible as OGC WCS and vector
- layer will be accessible as OGC WFS. This enables the client more
- flexible bindings of resulting ouput files.
-
- Attributes projection, bbox, width and height will be used. If not
- set, they will be determined using gdal/ogr libraries. If something
- does not work, try to adjust them manualy.
+ create dynamicaly mapfile and setup MapServer environment
"""
formats = None
@@ -890,11 +871,11 @@
self.projection = projection
self.bbox = bbox
- self.useMapscript = useMapscript
try:
self.ms = magic.open(magic.MAGIC_MIME)
self.ms.load()
+ self.useMapscript = useMapscript
except:
pass
Modified: branches/pywps-foss4g2010/pywps/Process/__init__.py
===================================================================
--- branches/pywps-foss4g2010/pywps/Process/__init__.py 2010-09-06 09:02:03 UTC (rev 1007)
+++ branches/pywps-foss4g2010/pywps/Process/__init__.py 2010-09-06 09:18:23 UTC (rev 1008)
@@ -615,7 +615,7 @@
printed. nothing happen otherwise.
"""
- if (self.debug or force) and self.logFile:
+ if self.debug or force and self.logFile:
if type(self.logFile) == type(""):
try:
f = open(self.logFile,"w")
Modified: branches/pywps-foss4g2010/pywps/Template.py
===================================================================
--- branches/pywps-foss4g2010/pywps/Template.py 2010-09-06 09:02:03 UTC (rev 1007)
+++ branches/pywps-foss4g2010/pywps/Template.py 2010-09-06 09:18:23 UTC (rev 1008)
@@ -41,7 +41,7 @@
VARTYPES=[types.StringType, types.FileType,
types.FloatType, types.IntType,
types.NoneType,
- types.BooleanType, types.LongType, types.UnicodeType]
+ types.BooleanType, types.LongType]
class Token:
"""Base Token class. Token is snipplet of input template. Template
Modified: branches/pywps-foss4g2010/pywps/Templates/1_0_0/inc/DescribeProcess_BoundingBoxValue.tmpl
===================================================================
--- branches/pywps-foss4g2010/pywps/Templates/1_0_0/inc/DescribeProcess_BoundingBoxValue.tmpl 2010-09-06 09:02:03 UTC (rev 1007)
+++ branches/pywps-foss4g2010/pywps/Templates/1_0_0/inc/DescribeProcess_BoundingBoxValue.tmpl 2010-09-06 09:18:23 UTC (rev 1008)
@@ -1,8 +1,8 @@
<Default>
- <CRS><TMPL_VAR crs></CRS>
+ <CRS xlink:href="<TMPL_VAR crs>" />
</Default>
<Supported>
<TMPL_LOOP CRSs>
- <CRS><TMPL_VAR crs></CRS>
+ <CRS xlink:href="<TMPL_VAR crs>" />
</TMPL_LOOP>
</Supported>
Copied: branches/pywps-foss4g2010/pywps/Wps/Execute.py (from rev 967, branches/pywps-foss4g2010/pywps/Wps/Execute.py)
Modified: branches/pywps-foss4g2010/tests/Templates/1_0_0/inc/DescribeProcess_BoundingBoxValue.tmpl
===================================================================
--- branches/pywps-foss4g2010/tests/Templates/1_0_0/inc/DescribeProcess_BoundingBoxValue.tmpl 2010-09-06 09:02:03 UTC (rev 1007)
+++ branches/pywps-foss4g2010/tests/Templates/1_0_0/inc/DescribeProcess_BoundingBoxValue.tmpl 2010-09-06 09:18:23 UTC (rev 1008)
@@ -1,8 +1,8 @@
<Default>
- <CRS><TMPL_VAR crs></CRS>
+ <CRS xlink:href="<TMPL_VAR crs>" />
</Default>
<Supported>
<TMPL_LOOP CRSs>
- <CRS><TMPL_VAR crs></CRS>
+ <CRS xlink:href="<TMPL_VAR crs>" />
</TMPL_LOOP>
</Supported>
Modified: branches/pywps-foss4g2010/tests/perform_requests.py
===================================================================
--- branches/pywps-foss4g2010/tests/perform_requests.py 2010-09-06 09:02:03 UTC (rev 1007)
+++ branches/pywps-foss4g2010/tests/perform_requests.py 2010-09-06 09:18:23 UTC (rev 1008)
@@ -28,11 +28,10 @@
getdescribeprocessrequest = "service=wps&request=describeprocess&version=1.0.0&identifier=dummyprocess"
getexecuterequest = "service=wps&request=execute&version=1.0.0&identifier=dummyprocess&datainputs=[input1=20;input2=10]"
wfsurl = "http://www2.dmsolutions.ca/cgi-bin/mswfs_gmap?version=1.0.0&request=getfeature&service=wfs&typename=park"
- wcsurl = "http://www.bnhelp.cz/cgi-bin/crtopo?service=WMS&request=GetMap&LAYERS=sitwgs&TRANSPARENT=true&FORMAT=image%2Ftiff&EXCEPTIONS=application%2Fvnd.ogc.se_xml&VERSION=1.1.1&STYLES=default&SRS=EPSG%3A4326&BBOX=-10,-10,10,10&WIDTH=50&HEIGHT=50"
wpsns = "http://www.opengis.net/wps/1.0.0"
xmldom = None
- def _testT00Assync(self):
+ def testT00Assync(self):
"""Test assynchronous mode for the first time"""
self._setFromEnv()
mypywps = pywps.Pywps(pywps.METHOD_GET)
@@ -49,7 +48,7 @@
self.assertTrue(len(xmldom.getElementsByTagNameNS(self.wpsns,"ProcessSucceeded")))
self.assertTrue(len(xmldom.getElementsByTagNameNS(self.wpsns,"ProcessSucceeded")))
- def _testT01PerformGetCapabilities(self):
+ def testT01PerformGetCapabilities(self):
"""Test if GetCapabilities request returns Capabilities document"""
self._setFromEnv()
mypywps = pywps.Pywps(pywps.METHOD_GET)
@@ -58,7 +57,7 @@
xmldom = minidom.parseString(mypywps.response)
self.assertEquals(xmldom.firstChild.nodeName, "wps:Capabilities")
- def _testT02ProcessesLengthGetCapabilities(self):
+ def testT02ProcessesLengthGetCapabilities(self):
"""Test, if any processes are listed in the Capabilities document
"""
self._setFromEnv()
@@ -68,7 +67,7 @@
xmldom = minidom.parseString(mypywps.response)
self.assertTrue(len(xmldom.getElementsByTagNameNS(self.wpsns,"Process"))>0)
- def _testT03PerformDescribeProcess(self):
+ def testT03PerformDescribeProcess(self):
"""Test if DescribeProcess request returns ProcessDescription document"""
self._setFromEnv()
mypywps = pywps.Pywps(pywps.METHOD_GET)
@@ -77,7 +76,7 @@
xmldom = minidom.parseString(mypywps.response)
self.assertEquals(xmldom.firstChild.nodeName, "wps:ProcessDescriptions")
- def _testT04ProcessesLengthDescribeProcess(self):
+ def testT04ProcessesLengthDescribeProcess(self):
"""Test, if any processes are listed in the DescribeProcess document
"""
self._setFromEnv()
@@ -90,7 +89,7 @@
len(mypywps.inputs["identifier"]))
######################################################################################
- def _testT05ParseExecute(self):
+ def testT05ParseExecute(self):
"""Test if Execute request is parsed and performed"""
self._setFromEnv()
mypywps = pywps.Pywps(pywps.METHOD_GET)
@@ -101,7 +100,7 @@
xmldom = minidom.parseString(mypywps.response)
self.assertEquals(len(xmldom.getElementsByTagNameNS(self.wpsns,"LiteralData")),2)
- def _testT06ParseExecuteLiteralInput(self):
+ def testT06ParseExecuteLiteralInput(self):
"""Test if Execute with LiteralInput and Output is executed"""
getpywps = pywps.Pywps(pywps.METHOD_GET)
postpywps = pywps.Pywps(pywps.METHOD_POST)
@@ -131,7 +130,7 @@
self.assertEquals(getliteraldata[2].firstChild.nodeValue, "spam")
self.assertEquals(getliteraldata[1].firstChild.nodeValue, "1.1")
- def _testT07ParseExecuteComplexInput(self):
+ def testT07ParseExecuteComplexInput(self):
"""Test if Execute with ComplexInput and Output, given directly with input XML request is executed"""
postpywps = pywps.Pywps(pywps.METHOD_POST)
executeRequestFile = open(os.path.join(pywpsPath,"tests","requests","wps_execute_request-complexinput-direct.xml"))
@@ -170,7 +169,7 @@
# wpsFeature = wpslayer.GetFeature(f)
# self.assertTrue(origFeature.Equal(wpsFeature))
- def _testT08ParseExecuteComplexInputRawDataOutput(self):
+ def testT08ParseExecuteComplexInputRawDataOutput(self):
"""Test if Execute with ComplexInput and Output, given directly
with input XML request is executed, with raster file requested as
raw data output"""
@@ -180,9 +179,7 @@
postpywps.performRequest(postinputs)
origData = open(os.path.join(pywpsPath,"tests","datainputs","dem.tiff"),"rb")
- rasterWpsData = base64.encodestring(origData.read())
- resp = postpywps.response.read();
- self.assertEquals(resp.strip(),rasterWpsData.strip())
+ self.assertEquals(postpywps.response.read(),origData.read())
def _test09ParseExecuteComplexVectorInputs(self):
"""Test, if pywps can parse complex vector input values, given as reference, output given directly"""
@@ -212,8 +209,37 @@
# output GML should be the same, as input GML
self.assertTrue(xmldom, outputgml)
+ def _test10ParseExecuteComplexVectorInputsAsReference(self):
+ """Test, if pywps can parse complex vector input values, given as reference"""
+ self._setFromEnv()
+ import urllib
+ import tempfile
+ gmlfile = open(tempfile.mktemp(prefix="pywps-test-wfs"),"w")
+ gmlfile.write(urllib.urlopen(self.wfsurl).read())
+ gmlfile.close()
- def _testT11ParseExecuteComplexVectorAndRasterInputsAsReferenceOutpu(self):
+ request = "service=wps&request=execute&version=1.0.0&identifier=complexVector&datainputs=[indata=%s]&responsedocument=[outdata=@asreference=true]" % (urllib.quote(self.wfsurl))
+ mypywps = pywps.Pywps(pywps.METHOD_GET)
+ inputs = mypywps.parseRequest(request)
+ mypywps.performRequest()
+ xmldom = minidom.parseString(mypywps.response)
+ self.assertFalse(len(xmldom.getElementsByTagNameNS(self.wpsns,"ExceptionReport")), 0)
+
+ # try to get out the Reference elemengt
+ gmlout = xmldom.getElementsByTagNameNS(self.wpsns,"Reference")[0].getAttribute("xlink:href")
+
+ # download, store, parse XML
+ gmlfile2 = open(tempfile.mktemp(prefix="pywps-test-wfs"),"w")
+ gmlfile2.write(urllib.urlopen(gmlout).read())
+ gmlfile2.close()
+ xmldom2 = minidom.parse(gmlfile2.name)
+ xmldom = minidom.parse(gmlfile.name)
+
+ # check, if they fit
+ # TODO: this test failes, but no power to get it trough
+ # self.assertEquals(xmldom, xmldom2)
+
+ def testT11ParseExecuteComplexVectorAndRasterInputsAsReferenceOutpu(self):
"""Test, if pywps can store complex values as reference"""
postpywps = pywps.Pywps(pywps.METHOD_POST)
executeRequestFile = open(os.path.join(pywpsPath,"tests","requests","wps_execute_request-complexinput-output-as-reference.xml"))
@@ -223,7 +249,7 @@
#print postpywps.request.process.outputs["rasterout"].value
- def _testsT12ExecuteBBox(self):
+ def testsT12ExecuteBBox(self):
"""Parsing Bounding Box Input"""
getpywps = pywps.Pywps(pywps.METHOD_GET)
postpywps = pywps.Pywps(pywps.METHOD_POST)
@@ -243,31 +269,6 @@
######################################################################################
- def test13ParseExecuteComplexVectorInputsAsReferenceMapServer(self):
- """Test if PyWPS can return correct WFS and WCS services for output
- data reference"""
- self._setFromEnv()
- import urllib
- import tempfile
-
- getpywps = pywps.Pywps(pywps.METHOD_GET)
- inputs = getpywps.parseRequest("service=wps&version=1.0.0&request=execute&identifier=complexprocessows&datainputs=[rasterin=%s;vectorin=%s]&responsedocument=[rasterout=@asreference=true;vectorout=@asreference=true]" % (urllib.quote(self.wcsurl), urllib.quote(self.wfsurl)))
- getpywps.performRequest()
- xmldom = minidom.parseString(getpywps.response)
-
- self.assertFalse(len(xmldom.getElementsByTagNameNS(self.wpsns,"ExceptionReport")), 0)
-
- # try to get out the Reference elemengt
- wfsurl = xmldom.getElementsByTagNameNS(self.wpsns,"Reference")[0].getAttribute("xlink:href")
- wcsurl = xmldom.getElementsByTagNameNS(self.wpsns,"Reference")[1].getAttribute("xlink:href")
-
- # test, if there are WFS and WCS request strings
- self.assertTrue(wfsurl.find("WFS") > -1)
- self.assertTrue(wcsurl.find("WCS") > -1)
- print urllib.unquote(wfsurl)
- print urllib.unquote(wcsurl)
-
-
def _setFromEnv(self):
os.putenv("PYWPS_PROCESSES", os.path.join(pywpsPath,"tests","processes"))
os.environ["PYWPS_PROCESSES"] = os.path.join(pywpsPath,"tests","processes")
Modified: branches/pywps-foss4g2010/tests/processes/__init__.py
===================================================================
--- branches/pywps-foss4g2010/tests/processes/__init__.py 2010-09-06 09:02:03 UTC (rev 1007)
+++ branches/pywps-foss4g2010/tests/processes/__init__.py 2010-09-06 09:18:23 UTC (rev 1008)
@@ -1 +1 @@
-__all__ = ["returner","dummyprocess","moreInOne","moreInstancesInOne","tests","buffer"]
+__all__ = ["returner","dummyprocess","moreInOne","moreInstancesInOne","tests"]
Deleted: branches/pywps-foss4g2010/tests/processes/buffer.py
===================================================================
--- branches/pywps-foss4g2010/tests/processes/buffer.py 2010-09-06 09:02:03 UTC (rev 1007)
+++ branches/pywps-foss4g2010/tests/processes/buffer.py 2010-09-06 09:18:23 UTC (rev 1008)
@@ -1,70 +0,0 @@
-"""
-OGR Buffer process
-
-Author: Jachym Cepicky (jachym at les-ejk.cz)
-"""
-
-from pywps.Process import WPSProcess
-from osgeo import ogr
-import os
-
-class Process(WPSProcess):
- def __init__(self):
- # init process
- WPSProcess.__init__(self,
- identifier = "ogrbuffer", # must be same, as filename
- title="Buffer process using OGR",
- version = "0.1",
- storeSupported = "true",
- statusSupported = "true",
- abstract="Process demonstrating how to work with OGR inside PyWPS")
-
- self.data = self.addComplexInput(identifier = "data",
- title = "Input vector file")
- self.size = self.addLiteralInput(identifier="size",
- title="Buffer area size",
- allowedValues = [[-10000,10000]])
- self.output =self.addComplexOutput(identifier="buffer",
- title="Buffered data",
- useMapscript=True)
- def execute(self):
-
-
- # open the input file
- try:
- inSource = ogr.Open(self.data.getValue())
- except Exception,e:
- return "Could not open given vector file: %s" % e
-
- inLayer = inSource.GetLayer()
- out = inLayer.GetName()
-
- # create output file
- driver = ogr.GetDriverByName('GML')
- outSource = driver.CreateDataSource(out, ["XSISCHEMAURI=http://schemas.opengis.net/gml/2.1.2/ feature.xsd"])
- outLayer = outSource.CreateLayer(out,None,ogr.wkbUnknown)
-
- # for each feature
- featureCount = inLayer.GetFeatureCount()
- index = 0
-
- while index < featureCount:
- self.status.set("Calculating buffer for feature %d from %d" % (index+1,featureCount),
- (100*(index+1)/featureCount*1.0))
-
- # get the geometry
- inFeature = inLayer.GetNextFeature()
- inGeometry = inFeature.GetGeometryRef()
-
- # make the buffer
- buff = inGeometry.Buffer(10000)
-
- # create output feature to the file
- outFeature = ogr.Feature(feature_def=outLayer.GetLayerDefn())
- outFeature.SetGeometryDirectly(buff)
- outLayer.CreateFeature(outFeature)
- outFeature.Destroy()
- index = index +1
-
- self.output.setValue(out)
- return
Modified: branches/pywps-foss4g2010/tests/processes/dummyprocess.py
===================================================================
--- branches/pywps-foss4g2010/tests/processes/dummyprocess.py 2010-09-06 09:02:03 UTC (rev 1007)
+++ branches/pywps-foss4g2010/tests/processes/dummyprocess.py 2010-09-06 09:18:23 UTC (rev 1008)
@@ -18,10 +18,10 @@
self.Input1 = self.addLiteralInput(identifier = "input1",
title = "Input1 number",
- default=100)
+ default="100")
self.Input2= self.addLiteralInput(identifier="input2",
title="Input2 number",
- default=200)
+ default="200")
self.Output1=self.addLiteralOutput(identifier="output1",
title="Output1 add 1 result")
self.Output2=self.addLiteralOutput(identifier="output2",title="Output2 subtract 1 result" )
Modified: branches/pywps-foss4g2010/tests/processes/tests.py
===================================================================
--- branches/pywps-foss4g2010/tests/processes/tests.py 2010-09-06 09:02:03 UTC (rev 1007)
+++ branches/pywps-foss4g2010/tests/processes/tests.py 2010-09-06 09:18:23 UTC (rev 1008)
@@ -88,47 +88,6 @@
time.sleep(5)
return
-class ComplexProcessOWS(WPSProcess):
- def __init__(self):
-
- WPSProcess.__init__(self, identifier = "complexprocessows",
- title="Complex process",
- storeSupported=True)
-
- self.vectorin = self.addComplexInput(identifier="vectorin",
- title="Vector file")
-
- self.rasterin = self.addComplexInput(identifier="rasterin",
- title="Raster file",
- formats = [{"mimeType":"image/tiff"}])
-
- self.pausein = self.addLiteralInput(identifier="pause",
- title="Pause the process",
- abstract="Pause the process for several seconds, so that status=true can be tested",
- default = False,
- type = type(True))
-
- self.vectorout = self.addComplexOutput(identifier="vectorout",
- title="Vector file",
- useMapscript=True)
-
- self.rasterout = self.addComplexOutput(identifier="rasterout",
- title="Raster file",
- formats = [{"mimeType":"image/tiff"}],
- useMapscript=True)
-
- def execute(self):
- self.vectorout.setValue(self.vectorin.getValue())
- self.rasterout.setValue(self.rasterin.getValue())
-
-
- if self.pausein.getValue():
- import time
- for i in range(5):
- self.status.set("Processing process",i*20)
- time.sleep(5)
- return
-
class BBoxProcess(WPSProcess):
"""This process defines bounding box in- and outputs"""
Modified: branches/pywps-foss4g2010/webservices/tomcat/PywpsServlet.py
===================================================================
--- branches/pywps-foss4g2010/webservices/tomcat/PywpsServlet.py 2010-09-06 09:02:03 UTC (rev 1007)
+++ branches/pywps-foss4g2010/webservices/tomcat/PywpsServlet.py 2010-09-06 09:18:23 UTC (rev 1008)
@@ -9,8 +9,9 @@
import pywps
from pywps.Exceptions import *
import traceback
+import sys
-class PywpsServlet(HttpServlet):
+class PywspServlet(HttpServlet):
def doGet(self,request,response):
Modified: branches/pywps-foss4g2010/webservices/tomcat/web.xml
===================================================================
--- branches/pywps-foss4g2010/webservices/tomcat/web.xml 2010-09-06 09:02:03 UTC (rev 1007)
+++ branches/pywps-foss4g2010/webservices/tomcat/web.xml 2010-09-06 09:18:23 UTC (rev 1008)
@@ -20,8 +20,8 @@
...
tomcat/webapps/wps/WEB-INF/
tomcat/webapps/wps/WEB-INF/web.xml (this file)
- tomcat/webapps/wps/WEB-INF/lib/
- tomcat/webapps/wps/WEB-INF/lib/jythonlib.jar
+ tomcat/webapps/wps/WEB-INF/classes/
+ tomcat/webapps/wps/WEB-INF/classes/jythonlib.jar
This should be described in the documentation more detaily.
-->
More information about the Pywps-commits
mailing list