Index: trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/BoundaryPy.zcfg
===================================================================
--- trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/BoundaryPy.zcfg	(revision 80)
+++ trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/BoundaryPy.zcfg	(revision 106)
@@ -23,5 +23,5 @@
      mimeType = text/xml
      encoding = UTF-8
-     schema = http://fooa/gml/3.1.0/polygon.xsd
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
     </Default>
     <Supported>
@@ -40,17 +40,16 @@
    <ComplexData>
     <Default>
+     mimeType = text/xml
+     encoding = UTF-8
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
+    </Default>
+    <Supported>
      mimeType = application/json
      encoding = UTF-8
-    </Default>
-    <Supported>
-     mimeType = text/xml
-     encoding = UTF-8
-     schema = http://fooa/gml/3.1.0/polygon.xsd
     </Supported>
     <Supported>
      mimeType = text/xml
      encoding = base64
-     schema = http://fooa/gml/3.1.0/polygon.xsd
-     asReference = true	
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
     </Supported>
    </ComplexData>
Index: trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/BufferPy.zcfg
===================================================================
--- trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/BufferPy.zcfg	(revision 80)
+++ trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/BufferPy.zcfg	(revision 106)
@@ -24,9 +24,9 @@
      mimeType = text/xml
      encoding = UTF-8
-     schema = http://fooa/gml/3.1.0/polygon.xsd
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
      asReference = true	
     </Default>
     <Supported>
-     mimeType = aplication/json
+     mimeType = application/json
      encoding = UTF-8
     </Supported>
@@ -57,12 +57,11 @@
    <ComplexData>
     <Default>
+     mimeType = text/xml
+     encoding = UTF-8
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
+    </Default>
+    <Supported>
      mimeType = application/json
      encoding = UTF-8
-    </Default>
-    <Supported>
-     mimeType = text/xml
-     encoding = UTF-8
-     schema = http://fooa/gml/3.1.0/polygon.xsd
-     asReference = true	
     </Supported>
    </ComplexData>
Index: trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/CentroidPy.zcfg
===================================================================
--- trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/CentroidPy.zcfg	(revision 80)
+++ trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/CentroidPy.zcfg	(revision 106)
@@ -24,10 +24,10 @@
      mimeType = text/xml
      encoding = UTF-8
-     schema = http://fooa/gml/3.1.0/polygon.xsd
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
     </Default>
     <Supported>
      mimeType = text/xml
      encoding = base64
-     schema = http://fooa/gml/3.1.0/polygon.xsd
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
     </Supported>
    </ComplexData>
@@ -42,12 +42,11 @@
    <ComplexData>
     <Default>
+     mimeType = text/xml
+     encoding = UTF-8
+     schema = http://schemas.opengis.net/gml/3.1.0/point.xsd
+    </Default>
+    <Supported>
      mimeType = application/json
      encoding = UTF-8
-    </Default>
-    <Supported>
-     mimeType = text/xml
-     encoding = UTF-8
-     schema = http://fooa/gml/3.1.0/point.xsd
-     asReference = true	
     </Supported>
    </ComplexData>
Index: trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/ConvexHullPy.zcfg
===================================================================
--- trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/ConvexHullPy.zcfg	(revision 80)
+++ trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/ConvexHullPy.zcfg	(revision 106)
@@ -23,5 +23,5 @@
      mimeType = text/xml
      encoding = UTF-8
-     schema = http://fooa/gml/3.1.0/polygon.xsd
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
     </Default>
     <Supported>
@@ -40,11 +40,11 @@
    <ComplexData>
     <Default>
+     mimeType = text/xml
+     encoding = UTF-8
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
+    </Default>
+    <Supported>
      mimeType = application/json
      encoding = UTF-8
-    </Default>
-    <Supported>
-     mimeType = text/xml
-     encoding = UTF-8
-     schema = http://fooa/gml/3.1.0/polygon.xsd
     </Supported>
    </ComplexData>
Index: trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/DifferencePy.zcfg
===================================================================
--- trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/DifferencePy.zcfg	(revision 80)
+++ trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/DifferencePy.zcfg	(revision 106)
@@ -24,10 +24,10 @@
      mimeType = text/xml
      encoding = UTF-8
-     schema = http://fooa/gml/3.1.0/polygon.xsd
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
     </Default>
     <Supported>
      mimeType = text/xml
      encoding = base64
-     schema = http://fooa/gml/3.1.0/polygon.xsd
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
     </Supported>
    </ComplexData>
@@ -43,5 +43,5 @@
     <Default>
      mimeType = text/xml
-     schema = http://fooa/gml/3.1.0/polygon.xsd
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
      encoding = UTF-8
     </Default>
@@ -49,5 +49,5 @@
      mimeType = text/xml
      encoding = base64
-     schema = http://fooa/gml/3.1.0/polygon.xsd
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
     </Supported>
    </ComplexData>
@@ -62,13 +62,13 @@
     <ComplexData>
      <Default>
-       mimeType = application/json
-       encoding = UTF-8
-       extension = js
+      mimeType = text/xml
+      schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
+      encoding = UTF-8
+      extension = xml
      </Default>
      <Supported>
-      mimeType = text/xml
-      schema = http://fooa/gml/3.1.0/polygon.xsd
+      mimeType = application/json
       encoding = UTF-8
-      extension = xml
+      extension = js
      </Supported>
     </ComplexData>
Index: trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/IntersectionPy.zcfg
===================================================================
--- trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/IntersectionPy.zcfg	(revision 80)
+++ trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/IntersectionPy.zcfg	(revision 106)
@@ -24,10 +24,10 @@
      mimeType = text/xml
      encoding = UTF-8
-     schema = http://fooa/gml/3.1.0/polygon.xsd
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
     </Default>
     <Supported>
      mimeType = text/xml
      encoding = base64
-     schema = http://fooa/gml/3.1.0/polygon.xsd
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
     </Supported>
    </ComplexData>
@@ -43,5 +43,5 @@
     <Default>
      mimeType = text/xml
-     schema = http://fooa/gml/3.1.0/polygon.xsd
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
      encoding = UTF-8
     </Default>
@@ -49,5 +49,5 @@
      mimeType = text/xml
      encoding = base64
-     schema = http://fooa/gml/3.1.0/polygon.xsd
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
     </Supported>
    </ComplexData>
@@ -62,13 +62,13 @@
     <ComplexData>
      <Default>
-       mimeType = application/json
-       encoding = UTF-8
-       extension = js
+      mimeType = text/xml
+      schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
+      encoding = UTF-8
+      extension = xml
      </Default>
      <Supported>
-      mimeType = text/xml
-      schema = http://fooa/gml/3.1.0/polygon.xsd
+      mimeType = application/json
       encoding = UTF-8
-      extension = xml
+      extension = js
      </Supported>
     </ComplexData>
Index: trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/SymDifferencePy.zcfg
===================================================================
--- trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/SymDifferencePy.zcfg	(revision 80)
+++ trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/SymDifferencePy.zcfg	(revision 106)
@@ -24,10 +24,14 @@
      mimeType = text/xml
      encoding = UTF-8
-     schema = http://fooa/gml/3.1.0/polygon.xsd
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
     </Default>
     <Supported>
      mimeType = text/xml
      encoding = base64
-     schema = http://fooa/gml/3.1.0/polygon.xsd
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
+    </Supported>
+    <Supported>
+     mimeType = application/json
+     encoding = UTF-8
     </Supported>
    </ComplexData>
@@ -43,5 +47,5 @@
     <Default>
      mimeType = text/xml
-     schema = http://fooa/gml/3.1.0/polygon.xsd
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
      encoding = UTF-8
     </Default>
@@ -49,5 +53,9 @@
      mimeType = text/xml
      encoding = base64
-     schema = http://fooa/gml/3.1.0/polygon.xsd
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
+    </Supported>
+    <Supported>
+     mimeType = application/json
+     encoding = UTF-8
     </Supported>
    </ComplexData>
@@ -62,13 +70,13 @@
     <ComplexData>
      <Default>
-       mimeType = application/json
-       encoding = UTF-8
-       extension = js
+      mimeType = text/xml
+      schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
+      encoding = UTF-8
+      extension = xml
      </Default>
      <Supported>
-      mimeType = text/xml
-      schema = http://fooa/gml/3.1.0/polygon.xsd
+      mimeType = application/json
       encoding = UTF-8
-      extension = xml
+      extension = js
      </Supported>
     </ComplexData>
Index: trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/UnionPy.zcfg
===================================================================
--- trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/UnionPy.zcfg	(revision 80)
+++ trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/UnionPy.zcfg	(revision 106)
@@ -24,5 +24,5 @@
      mimeType = text/xml
      encoding = UTF-8
-     schema = http://fooa/gml/3.1.0/polygon.xsd
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
     </Default>
     <Supported>
@@ -42,5 +42,5 @@
     <Default>
      mimeType = text/xml
-     schema = http://fooa/gml/3.1.0/polygon.xsd
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
      encoding = UTF-8
     </Default>
@@ -60,13 +60,13 @@
     <ComplexData>
      <Default>
-       mimeType = application/json
-       encoding = UTF-8
-       extension = js
+      mimeType = text/xml
+      schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
+      encoding = UTF-8
+      extension = xml
      </Default>
      <Supported>
-      mimeType = text/xml
-      schema = http://fooa/gml/3.1.0/polygon.xsd
+      mimeType = application/json
       encoding = UTF-8
-      extension = xml
+      extension = js
      </Supported>
     </ComplexData>
Index: trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/ogr_sp.py
===================================================================
--- trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/ogr_sp.py	(revision 80)
+++ trunk/zoo-services/ogr/base-vect-ops-py/cgi-env/ogr_sp.py	(revision 106)
@@ -1,68 +1,106 @@
 import osgeo.ogr
 import libxml2
+import os
+import sys
 
 def createGeometryFromWFS(my_wfs_response):
     doc=libxml2.parseMemory(my_wfs_response,len(my_wfs_response))
     ctxt = doc.xpathNewContext()
-    res=ctxt.xpathEval("/*/*/*/*/*[local-name()='Polygon' or local-name()='MultiPolygon']")
-    for node in res:
-        geometry_as_string=node.serialize()
-        geometry=osgeo.ogr.CreateGeometryFromGML(geometry_as_string)
-	return geometry
+    res=ctxt.xpathEval("/*/*/*/*/*[local-name()='Polygon' or local-name()='MultiPolygon' or local-name()='Point' or local-name()='MultiPoint' or local-name()='MultiLinestring' or local-name()='MultiLinestring' ]")
+    geometry=[]
+    try:
+        for node in res:
+            geometry_as_string=node.serialize()
+            geometry+=[osgeo.ogr.CreateGeometryFromGML(geometry_as_string)]
+    except:
+        print >> sys.stderr,"Error"
     return geometry
 
 def extractInputs(obj):
     if obj["mimeType"]=="application/json":
-	return osgeo.ogr.CreateGeometryFromJson(obj["value"])
+	return [osgeo.ogr.CreateGeometryFromJson(obj["value"])]
     else:
 	try:
         	return createGeometryFromWFS(obj["value"])
 	except:
-		return osgeo.ogr.CreateGeometryFromJson(obj["value"])
+		return [osgeo.ogr.CreateGeometryFromJson(obj["value"])]
     return null
     
-def outputResult(obj,geom):
+def outputResult(conf,obj,geom):
+    driverName = "GML"
+    extension = [ ".xml" , ".xsd" ]
     if obj["mimeType"]=="application/json":
-        obj["value"]=geom.ExportToJson()
-        obj["mimeType"]="text/plain"
-    else:
-        obj["value"]=geom.ExportToGML()
+        driverName = "GeoJSON"
+        extension = [ ".js" ]
+    drv = osgeo.ogr.GetDriverByName( driverName )
+    ds = drv.CreateDataSource( conf["main"]["tmpPath"]+"/store"+conf["lenv"]["sid"]+extension[0] )
+    lyr = ds.CreateLayer( "Result", None, osgeo.ogr.wkbUnknown )
+    field_defn = osgeo.ogr.FieldDefn( "Name", osgeo.ogr.OFTString )
+    field_defn.SetWidth( len("Result10000") )
+    lyr.CreateField ( field_defn )
+    i=0
+    while i < len(geom):
+        feat = osgeo.ogr.Feature( lyr.GetLayerDefn())
+        feat.SetField( "Name", "Result"+str(i) )
+        feat.SetGeometry(geom[i])
+        lyr.CreateFeature(feat)
+        feat.Destroy()
+        geom[i].Destroy()
+        i+=1
+    ds.Destroy()
+    obj["value"]=open(conf["main"]["tmpPath"]+"/store"+conf["lenv"]["sid"]+extension[0],"r").read()
+    os.unlink(conf["main"]["tmpPath"]+"/store"+conf["lenv"]["sid"]+extension[0])
+    if len(extension)>1:
+        os.unlink(conf["main"]["tmpPath"]+"/store"+conf["lenv"]["sid"]+extension[1])
 
 def BoundaryPy(conf,inputs,outputs):
     geometry=extractInputs(inputs["InputPolygon"])
-    rgeom=geometry.GetBoundary()
-    if outputs["Result"]["mimeType"]=="application/json":
-        outputs["Result"]["value"]=rgeom.ExportToJson()
-        outputs["Result"]["mimeType"]="text/plain"
-    else:
-        outputs["Result"]["value"]=rgeom.ExportToGML()
+    i=0
+    rgeometries=[]
+    while i < len(geometry):
+        rgeometries+=[geometry[i].GetBoundary()]
+        geometry[i].Destroy()
+        i+=1
+    outputResult(conf,outputs["Result"],rgeometries)
     return 3
 
 def CentroidPy(conf,inputs,outputs):
     geometry=extractInputs(inputs["InputPolygon"])
-    if geometry.GetGeometryType()!=3:
-        geometry=geometry.ConvexHull()
-    rgeom=geometry.Centroid()
-    outputResult(outputs["Result"],rgeom)
+    i=0
+    rgeometries=[]
+    while i < len(geometry):
+        if geometry[i].GetGeometryType()!=3:
+            geometry[i]=geometry[i].ConvexHull()
+        rgeometries+=[geometry[i].Centroid()]
+        geometry[i].Destroy()
+        i+=1
+    outputResult(conf,outputs["Result"],rgeometries)
     return 3
 
 def ConvexHullPy(conf,inputs,outputs):
     geometry=extractInputs(inputs["InputPolygon"])
-    rgeom=geometry.ConvexHull()
-    outputResult(outputs["Result"],rgeom)
+    i=0
+    rgeometries=[]
+    while i < len(geometry):
+        rgeometries+=[geometry[i].ConvexHull()]
+        geometry[i].Destroy()
+        i+=1
+    outputResult(conf,outputs["Result"],rgeometries)
     return 3
 
 def BufferPy(conf,inputs,outputs):
-    geometry=createGeometryFromWFS(inputs["InputPolygon"]["value"])
     try:
         bdist=int(inputs["BufferDistance"]["value"])
     except:
         bdist=10
-    rgeom=geometry.Buffer(bdist)
-    if outputs["Result"]["mimeType"]=="application/json":
-        outputs["Result"]["value"]=rgeom.ExportToJson()
-        outputs["Result"]["mimeType"]="text/plain"
-    else:
-        outputs["Result"]["value"]=rgeom.ExportToGML()
+    geometry=extractInputs(inputs["InputPolygon"])
+    i=0
+    rgeometries=[]
+    while i < len(geometry):
+        rgeometries+=[geometry[i].Buffer(bdist)]
+        geometry[i].Destroy()
+        i+=1
+    outputResult(conf,outputs["Result"],rgeometries)
+    i=0
     return 3
 
@@ -70,6 +108,20 @@
     geometry1=extractInputs(inputs["InputEntity1"])
     geometry2=extractInputs(inputs["InputEntity2"])
-    rgeom=geometry1.Union(geometry2)
-    outputResult(outputs["Result"],rgeom)
+    rgeometries=[]
+    i=0
+    while i < len(geometry1):
+        j=0
+        while j < len(geometry2):
+            tres=geometry1[i].Union(geometry2[j])
+            if not(tres.IsEmpty()):
+                rgeometries+=[tres]
+            j+=1
+        geometry1[i].Destroy()
+        i+=1
+    i=0
+    while i < len(geometry2):
+        geometry2[i].Destroy()
+        i+=1
+    outputResult(conf,outputs["Result"],rgeometries)
     return 3
 
@@ -77,6 +129,20 @@
     geometry1=extractInputs(inputs["InputEntity1"])
     geometry2=extractInputs(inputs["InputEntity2"])
-    rgeom=geometry1.Intersection(geometry2)
-    outputResult(outputs["Result"],rgeom)
+    rgeometries=[]
+    i=0
+    while i < len(geometry1):
+        j=0
+        while j < len(geometry2):
+            tres=geometry1[i].Intersection(geometry2[j])
+            if not(tres.IsEmpty()):
+                rgeometries+=[tres]
+            j+=1
+        geometry1[i].Destroy()
+        i+=1
+    i=0
+    while i < len(geometry2):
+        geometry2[i].Destroy()
+        i+=1
+    outputResult(conf,outputs["Result"],rgeometries)
     return 3
 
@@ -84,6 +150,20 @@
     geometry1=extractInputs(inputs["InputEntity1"])
     geometry2=extractInputs(inputs["InputEntity2"])
-    rgeom=geometry1.Difference(geometry2)
-    outputResult(outputs["Result"],rgeom)
+    rgeometries=[]
+    i=0
+    while i < len(geometry1):
+        j=0
+        while j < len(geometry2):
+            tres=geometry1[i].Difference(geometry2[j])
+            if not(tres.IsEmpty()):
+                rgeometries+=[tres]
+            j+=1
+        geometry1[i].Destroy()
+        i+=1
+    i=0
+    while i < len(geometry2):
+        geometry2[i].Destroy()
+        i+=1
+    outputResult(conf,outputs["Result"],rgeometries)
     return 3
 
@@ -91,5 +171,17 @@
     geometry1=extractInputs(inputs["InputEntity1"])
     geometry2=extractInputs(inputs["InputEntity2"])
-    rgeom=geometry1.SymmetricDifference(geometry2)
-    outputResult(outputs["Result"],rgeom)
+    rgeometries=[]
+    i=0
+    while i < len(geometry1):
+        j=0
+        while j < len(geometry2):
+            rgeometries+=[geometry1[i].SymmetricDifference(geometry2[j])]
+            j+=1
+        geometry1[i].Destroy()
+        i+=1
+    i=0
+    while i < len(geometry2):
+        geometry2[i].Destroy()
+        i+=1
+    outputResult(conf,outputs["Result"],rgeometries)
     return 3
