Changeset 268 for branches/branch-1.2/zoo-services
- Timestamp:
- Jul 16, 2011, 12:58:47 PM (13 years ago)
- Location:
- branches/branch-1.2
- Files:
-
- 7 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/branch-1.2
-
branches/branch-1.2/zoo-services/ogr/base-vect-ops-py/cgi-env/SymDifferencePy.zcfg
r106 r268 66 66 Abstract = The symmetric difference between the two geometries. 67 67 <MetaData> 68 Title = Symmetric Difference68 title = Symmetric Difference 69 69 </MetaData> 70 70 <ComplexData> -
branches/branch-1.2/zoo-services/ogr/base-vect-ops-py/cgi-env/ogr_sp.py
r107 r268 1 from osgeo import * 1 2 import osgeo.ogr 3 import osgeo.gdal 2 4 import libxml2 3 5 import os 4 6 import sys 5 7 6 def createGeometryFromWFS(my_wfs_response): 7 doc=libxml2.parseMemory(my_wfs_response,len(my_wfs_response)) 8 ctxt = doc.xpathNewContext() 9 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()='LineString' ]") 8 def createGeometryFromWFS(conf,my_wfs_response): 10 9 geometry=[] 11 10 try: 12 for node in res: 13 geometry_as_string=node.serialize() 14 geometry+=[osgeo.ogr.CreateGeometryFromGML(geometry_as_string)] 11 # Create virtual file or parse XML file depending on the GDAL Version 12 gV=int(osgeo.gdal.VersionInfo()) 13 if gV >= 1800: 14 osgeo.gdal.FileFromMemBuffer('/vsimem//temp', my_wfs_response) 15 ds = osgeo.ogr.Open('/vsimem//temp') 16 lyr = ds.GetLayer(0) 17 feat = lyr.GetNextFeature() 18 while feat is not None: 19 geometry+=[feat.GetGeometryRef().Clone()] 20 feat.Destroy() 21 feat = lyr.GetNextFeature() 22 ds.Destroy() 23 osgeo.gdal.Unlink('/vsimem//temp') 24 else: 25 doc=libxml2.parseMemory(my_wfs_response,len(my_wfs_response)) 26 ctxt = doc.xpathNewContext() 27 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()='LineString' ]") 28 for node in res: 29 geometry_as_string=node.serialize() 30 geometry+=[osgeo.ogr.CreateGeometryFromGML(geometry_as_string)] 15 31 except: 16 print >> sys.stderr," Error"32 print >> sys.stderr,"Unable to load file from mem buffer\n\n\n" 17 33 return geometry 18 34 19 def extractInputs( obj):35 def extractInputs(conf,obj): 20 36 if obj["mimeType"]=="application/json": 21 37 return [osgeo.ogr.CreateGeometryFromJson(obj["value"])] 22 38 else: 23 39 try: 24 return createGeometryFromWFS( obj["value"])40 return createGeometryFromWFS(conf,obj["value"]) 25 41 except: 26 42 return [osgeo.ogr.CreateGeometryFromJson(obj["value"])] … … 34 50 extension = [ ".js" ] 35 51 drv = osgeo.ogr.GetDriverByName( driverName ) 36 ds = drv.CreateDataSource( conf["main"]["tmpPath"]+"/store"+conf["lenv"]["sid"]+extension[0] ) 52 # Create virtual file or real one depending on the GDAL Version 53 gV=int(osgeo.gdal.VersionInfo()) 54 if gV >= 1800: 55 ds = drv.CreateDataSource( "/vsimem/store"+conf["lenv"]["sid"]+extension[0] ) 56 else: 57 ds = drv.CreateDataSource( conf["main"]["tmpPath"]+"/store"+conf["lenv"]["sid"]+extension[0] ) 37 58 lyr = ds.CreateLayer( "Result", None, osgeo.ogr.wkbUnknown ) 38 59 field_defn = osgeo.ogr.FieldDefn( "Name", osgeo.ogr.OFTString ) … … 49 70 i+=1 50 71 ds.Destroy() 51 obj["value"]=open(conf["main"]["tmpPath"]+"/store"+conf["lenv"]["sid"]+extension[0],"r").read() 52 os.unlink(conf["main"]["tmpPath"]+"/store"+conf["lenv"]["sid"]+extension[0]) 53 if len(extension)>1: 54 os.unlink(conf["main"]["tmpPath"]+"/store"+conf["lenv"]["sid"]+extension[1]) 72 if gV >= 1800: 73 vsiFile=osgeo.gdal.VSIFOpenL("/vsimem/store"+conf["lenv"]["sid"]+extension[0],"r") 74 i=0 75 while osgeo.gdal.VSIFSeekL(vsiFile,0,os.SEEK_END)>0: 76 i+=1 77 fileSize=osgeo.gdal.VSIFTellL(vsiFile) 78 osgeo.gdal.VSIFSeekL(vsiFile,0,os.SEEK_SET) 79 obj["value"]=osgeo.gdal.VSIFReadL(fileSize,1,vsiFile) 80 osgeo.gdal.Unlink("/vsimem/store"+conf["lenv"]["sid"]+extension[0]) 81 else: 82 obj["value"]=open(conf["main"]["tmpPath"]+"/store"+conf["lenv"]["sid"]+extension[0],"r").read() 83 os.unlink(conf["main"]["tmpPath"]+"/store"+conf["lenv"]["sid"]+extension[0]) 84 if len(extension)>1: 85 os.unlink(conf["main"]["tmpPath"]+"/store"+conf["lenv"]["sid"]+extension[1]) 86 55 87 56 88 def BoundaryPy(conf,inputs,outputs): 57 geometry=extractInputs( inputs["InputPolygon"])89 geometry=extractInputs(conf,inputs["InputPolygon"]) 58 90 i=0 59 91 rgeometries=[] … … 66 98 67 99 def CentroidPy(conf,inputs,outputs): 68 geometry=extractInputs( inputs["InputPolygon"])100 geometry=extractInputs(conf,inputs["InputPolygon"]) 69 101 i=0 70 102 rgeometries=[] … … 79 111 80 112 def ConvexHullPy(conf,inputs,outputs): 81 geometry=extractInputs( inputs["InputPolygon"])113 geometry=extractInputs(conf,inputs["InputPolygon"]) 82 114 i=0 83 115 rgeometries=[] … … 94 126 except: 95 127 bdist=10 96 geometry=extractInputs( inputs["InputPolygon"])128 geometry=extractInputs(conf,inputs["InputPolygon"]) 97 129 i=0 98 130 rgeometries=[] … … 106 138 107 139 def UnionPy(conf,inputs,outputs): 108 geometry1=extractInputs( inputs["InputEntity1"])109 geometry2=extractInputs( inputs["InputEntity2"])140 geometry1=extractInputs(conf,inputs["InputEntity1"]) 141 geometry2=extractInputs(conf,inputs["InputEntity2"]) 110 142 rgeometries=[] 111 143 i=0 … … 127 159 128 160 def IntersectionPy(conf,inputs,outputs): 129 geometry1=extractInputs( inputs["InputEntity1"])130 geometry2=extractInputs( inputs["InputEntity2"])161 geometry1=extractInputs(conf,inputs["InputEntity1"]) 162 geometry2=extractInputs(conf,inputs["InputEntity2"]) 131 163 rgeometries=[] 132 164 i=0 … … 148 180 149 181 def DifferencePy(conf,inputs,outputs): 150 geometry1=extractInputs( inputs["InputEntity1"])151 geometry2=extractInputs( inputs["InputEntity2"])182 geometry1=extractInputs(conf,inputs["InputEntity1"]) 183 geometry2=extractInputs(conf,inputs["InputEntity2"]) 152 184 rgeometries=[] 153 185 i=0 … … 169 201 170 202 def SymDifferencePy(conf,inputs,outputs): 171 geometry1=extractInputs( inputs["InputEntity1"])172 geometry2=extractInputs( inputs["InputEntity2"])203 geometry1=extractInputs(conf,inputs["InputEntity1"]) 204 geometry2=extractInputs(conf,inputs["InputEntity2"]) 173 205 rgeometries=[] 174 206 i=0 -
branches/branch-1.2/zoo-services/ogr/ogr2ogr/cgi-env/Ogr2Ogr.zcfg
r48 r268 8 8 serviceProvider = ogr2ogr_service.zo 9 9 <MetaData> 10 Title = My Demo10 title = My Demo 11 11 </MetaData> 12 12 <DataInputs> -
branches/branch-1.2/zoo-services/ogr/ogr2ogr/service.c
r49 r268 95 95 const char *pszSQLStatement = NULL; 96 96 int eGType = -2; 97 double 97 double dfMaxSegmentLength = 0; 98 98 99 99 /* Check strict compilation and runtime library version as we use C++ API */ … … 178 178 } 179 179 180 tmpMap=NULL; 181 tmpMap=getMapFromMaps(inputs,"overwrite","value"); 182 if(tmpMap!=NULL){ 183 bOverwrite = TRUE; 184 } 185 180 /* if exist, overwrite the data with the same name */ 181 bOverwrite = TRUE; 182 186 183 tmpMap=NULL; 187 184 tmpMap=getMapFromMaps(inputs,"update","value"); … … 826 823 827 824 #ifdef ZOO_SERVICE 828 outputs=(maps*)malloc(sizeof(maps*));829 outputs->name="GeneratedFile";830 825 outputs->content=createMap("value",(char*)pszwebDestData); 831 addMapToMap(&outputs->content,createMap("dataType","string"));832 outputs->next=NULL;833 826 return SERVICE_SUCCEEDED; 834 827 #else -
branches/branch-1.2/zoo-services/utils/status/Makefile
r51 r268 1 CFLAGS=-I../../../ zoo-kernel/ -I./ `xslt-config --cflags` `xml2-config --cflags`-DLINUX_FREE_ISSUE #-DDEBUG1 CFLAGS=-I../../../thirds/cgic206/ -I../../../zoo-kernel/ -I./ `xslt-config --cflags` `xml2-config --cflags` -lintl -lfcgi -lcrypto -DLINUX_FREE_ISSUE #-DDEBUG 2 2 # if JS_ENABLED flag is set to true in your ZOO-Kernel Makefile then you'll have 3 3 # uncomment the following line -
branches/branch-1.2/zoo-services/utils/status/service.c
r217 r268 72 72 char tmp[128]; 73 73 sprintf(tmp,"_%s.xml",tmpMap->value); 74 while ((dp = readdir(dirp)) != NULL) 74 while ((dp = readdir(dirp)) != NULL){ 75 #ifdef DEBUG 76 fprintf(stderr,"File : %s searched : %s\n",dp->d_name,tmp); 77 #endif 75 78 if(strstr(dp->d_name,tmp)!=0){ 76 79 sprintf(fileName,"%s/%s",tmpTmap->value,dp->d_name); 77 80 hasFile=1; 78 81 } 82 } 79 83 }else{ 80 84 char tmp[1024];
Note: See TracChangeset
for help on using the changeset viewer.