[447] | 1 | # -*- coding: utf-8 -*- |
---|
[422] | 2 | # |
---|
| 3 | # Author : Gérald FENOY |
---|
| 4 | # |
---|
| 5 | # Copyright 2009-2013 GeoLabs SARL. All rights reserved. |
---|
| 6 | # |
---|
| 7 | # Permission is hereby granted, free of charge, to any person obtaining a |
---|
| 8 | # copy of this software and associated documentation files (the |
---|
| 9 | # "Software"), to deal in the Software without restriction, including with |
---|
| 10 | # out limitation the rights to use, copy, modify, merge, publish, |
---|
| 11 | # distribute, sublicense, and/or sell copies of the Software, and to |
---|
| 12 | # permit persons to whom the Software is furnished to do so, subject to |
---|
| 13 | # the following conditions: |
---|
| 14 | # |
---|
| 15 | # The above copyright notice and this permission notice shall be included |
---|
| 16 | # in all copies or substantial portions of the Software. |
---|
| 17 | # |
---|
| 18 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
---|
| 19 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
---|
| 20 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
---|
| 21 | # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
---|
| 22 | # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
---|
| 23 | # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
---|
| 24 | # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
---|
| 25 | # |
---|
| 26 | |
---|
[257] | 27 | from osgeo import * |
---|
[9] | 28 | import osgeo.ogr |
---|
[257] | 29 | import osgeo.gdal |
---|
[9] | 30 | import libxml2 |
---|
[106] | 31 | import os |
---|
| 32 | import sys |
---|
[382] | 33 | import zoo |
---|
[9] | 34 | |
---|
[360] | 35 | def readFileFromBuffer(data,ext): |
---|
[382] | 36 | try: |
---|
| 37 | geometry=[] |
---|
| 38 | print >> sys.stderr,'/vsimem//temp1'+ext |
---|
| 39 | #print >> sys.stderr,data |
---|
| 40 | osgeo.gdal.FileFromMemBuffer('/vsimem//temp1'+ext,data) |
---|
| 41 | ds = osgeo.ogr.Open('/vsimem//temp1'+ext) |
---|
| 42 | lyr = ds.GetLayer(0) |
---|
[360] | 43 | feat = lyr.GetNextFeature() |
---|
[382] | 44 | while feat is not None: |
---|
| 45 | geometry+=[feat.Clone()] |
---|
| 46 | feat.Destroy() |
---|
| 47 | feat = lyr.GetNextFeature() |
---|
| 48 | ds.Destroy() |
---|
| 49 | osgeo.gdal.Unlink('/vsimem//temp1'+ext) |
---|
| 50 | return geometry |
---|
| 51 | except Exception,e: |
---|
| 52 | print >> sys.stderr,e |
---|
| 53 | return [] |
---|
[465] | 54 | |
---|
[360] | 55 | def buildFeatureFromGeomtry(conf,geom,driverName,ext): |
---|
| 56 | drv = osgeo.ogr.GetDriverByName( driverName ) |
---|
| 57 | ds = drv.CreateDataSource( "/vsimem//store"+conf["lenv"]["sid"]+"0."+ext ) |
---|
| 58 | lyr = ds.CreateLayer( "Result", None, osgeo.ogr.wkbUnknown ) |
---|
| 59 | field_defn = osgeo.ogr.FieldDefn( "Name", osgeo.ogr.OFTString ) |
---|
| 60 | field_defn.SetWidth( len("Result10000") ) |
---|
| 61 | lyr.CreateField ( field_defn ) |
---|
| 62 | feat = osgeo.ogr.Feature(lyr.GetLayerDefn()) |
---|
| 63 | feat.SetField( "Name", "Input0" ) |
---|
| 64 | feat.SetGeometry(geom) |
---|
| 65 | lyr.CreateFeature(feat) |
---|
| 66 | ds.Destroy() |
---|
| 67 | return [feat] |
---|
| 68 | |
---|
[257] | 69 | def createGeometryFromWFS(conf,my_wfs_response): |
---|
[106] | 70 | try: |
---|
[465] | 71 | geom=osgeo.ogr.CreateGeometryFromGML(my_wfs_response.replace('<?xml version="1.0" encoding="utf-8"?>\n','').replace('<?xml version=\'1.0\' encoding="utf-8"?>\n','')) |
---|
| 72 | except Exception,e: |
---|
| 73 | print >> sys.stderr,"**" |
---|
| 74 | print >> sys.stderr,e |
---|
[360] | 75 | geom=None |
---|
| 76 | try: |
---|
[465] | 77 | print >> sys.stderr,geom is None |
---|
[360] | 78 | if geom is None: |
---|
[382] | 79 | if not(conf["lenv"].has_key("cnt")): |
---|
| 80 | conf["lenv"]["cnt"]=0 |
---|
| 81 | else: |
---|
| 82 | conf["lenv"]["cnt"]+=1 |
---|
| 83 | return readFileFromBuffer(my_wfs_response,str(conf["lenv"]["cnt"])) |
---|
[257] | 84 | else: |
---|
[360] | 85 | return buildFeatureFromGeomtry(conf,geom,"GML","xml") |
---|
[106] | 86 | except: |
---|
[360] | 87 | print >> sys.stderr,"Unable to load file input data !!!\n\n\n" |
---|
[9] | 88 | |
---|
[360] | 89 | def createLayerFromJson(conf,obj): |
---|
| 90 | geom=osgeo.ogr.CreateGeometryFromJson(obj) |
---|
| 91 | if geom is None: |
---|
| 92 | return readFileFromBuffer(obj,".json") |
---|
| 93 | else: |
---|
| 94 | return buildFeatureFromGeomtry(conf,geom,"GeoJSON","json") |
---|
| 95 | |
---|
[257] | 96 | def extractInputs(conf,obj): |
---|
[863] | 97 | if obj.keys().count("cache_file"): |
---|
| 98 | print >> sys.stderr,obj |
---|
| 99 | geometry=[] |
---|
| 100 | ds = osgeo.ogr.Open(obj["cache_file"]) |
---|
| 101 | if sql is not None: |
---|
| 102 | if sql.count("from")==0: |
---|
| 103 | layerName=ds.GetLayerByIndex(0).GetName() |
---|
| 104 | sql+=" from "+layerName |
---|
| 105 | lyr=ds.ExecuteSQL( sql, None, None ) |
---|
| 106 | else: |
---|
| 107 | lyr = ds.GetLayer(0) |
---|
| 108 | feat = lyr.GetNextFeature() |
---|
| 109 | while feat is not None: |
---|
| 110 | geometry+=[feat.Clone()] |
---|
| 111 | feat.Destroy() |
---|
| 112 | feat = lyr.GetNextFeature() |
---|
| 113 | ds.Destroy() |
---|
| 114 | return geometry |
---|
[9] | 115 | if obj["mimeType"]=="application/json": |
---|
[360] | 116 | return createLayerFromJson(conf,obj["value"]) |
---|
[9] | 117 | else: |
---|
[360] | 118 | return createGeometryFromWFS(conf,obj["value"]) |
---|
[9] | 119 | |
---|
[106] | 120 | def outputResult(conf,obj,geom): |
---|
[465] | 121 | if obj["mimeType"].count("text/xml")>0: |
---|
| 122 | driverName = "GML" |
---|
| 123 | extension = [ ".xml" , ".xsd" ] |
---|
| 124 | format_list = { "2.": 'GML2', "3.1.1": 'GML3', "3.1": 'GML3Deegree', "3.2": 'GML3.2' } |
---|
| 125 | opts=['FORMAT=%s,GML3_LONGSRS=YES',format_list["3.2"]] |
---|
| 126 | for i in format_list: |
---|
| 127 | if obj["mimeType"].count(i)>0: |
---|
| 128 | opts=['FORMAT=%s,GML3_LONGSRS=YES',format_list[i]] |
---|
[9] | 129 | if obj["mimeType"]=="application/json": |
---|
[106] | 130 | driverName = "GeoJSON" |
---|
| 131 | extension = [ ".js" ] |
---|
[465] | 132 | opts=None |
---|
[360] | 133 | if obj.keys().count("schema")>0 and \ |
---|
| 134 | obj["schema"]=="http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd": |
---|
| 135 | driverName = "KML" |
---|
| 136 | extension = [ ".kml" ] |
---|
[465] | 137 | opts=None |
---|
[106] | 138 | drv = osgeo.ogr.GetDriverByName( driverName ) |
---|
[465] | 139 | print >> sys.stderr,drv |
---|
| 140 | # Create virtual file |
---|
| 141 | ds = drv.CreateDataSource( "/vsimem/store"+conf["lenv"]["sid"]+extension[0],options = opts) |
---|
| 142 | print >> sys.stderr,ds |
---|
[106] | 143 | lyr = ds.CreateLayer( "Result", None, osgeo.ogr.wkbUnknown ) |
---|
[465] | 144 | print >> sys.stderr,lyr |
---|
[106] | 145 | i=0 |
---|
[465] | 146 | print >> sys.stderr,driverName |
---|
| 147 | print >> sys.stderr,extension |
---|
[106] | 148 | while i < len(geom): |
---|
[382] | 149 | if i==0 and driverName!="GeoJSON": |
---|
| 150 | poDstFDefn=geom[i].GetDefnRef() |
---|
| 151 | if poDstFDefn is not None: |
---|
| 152 | nDstFieldCount = poDstFDefn.GetFieldCount() |
---|
| 153 | for iField in range(nDstFieldCount): |
---|
| 154 | poSrcFieldDefn = poDstFDefn.GetFieldDefn(iField) |
---|
| 155 | oFieldDefn = osgeo.ogr.FieldDefn(poSrcFieldDefn.GetNameRef(),poSrcFieldDefn.GetType()) |
---|
| 156 | oFieldDefn.SetWidth( poSrcFieldDefn.GetWidth() ) |
---|
| 157 | oFieldDefn.SetPrecision( poSrcFieldDefn.GetPrecision() ) |
---|
| 158 | lyr.CreateField( oFieldDefn ) |
---|
[465] | 159 | try: |
---|
| 160 | lyr.CreateFeature(geom[i]) |
---|
| 161 | except: |
---|
| 162 | pass |
---|
[106] | 163 | geom[i].Destroy() |
---|
| 164 | i+=1 |
---|
| 165 | ds.Destroy() |
---|
[360] | 166 | vsiFile=osgeo.gdal.VSIFOpenL("/vsimem/store"+conf["lenv"]["sid"]+extension[0],"r") |
---|
| 167 | i=0 |
---|
| 168 | while osgeo.gdal.VSIFSeekL(vsiFile,0,os.SEEK_END)>0: |
---|
| 169 | i+=1 |
---|
| 170 | fileSize=osgeo.gdal.VSIFTellL(vsiFile) |
---|
| 171 | osgeo.gdal.VSIFSeekL(vsiFile,0,os.SEEK_SET) |
---|
| 172 | obj["value"]=osgeo.gdal.VSIFReadL(fileSize,1,vsiFile) |
---|
| 173 | osgeo.gdal.Unlink("/vsimem/store"+conf["lenv"]["sid"]+extension[0]) |
---|
| 174 | |
---|
| 175 | def BufferPy(conf,inputs,outputs): |
---|
[382] | 176 | print >> sys.stderr, "Starting service ..." |
---|
[360] | 177 | try: |
---|
| 178 | bdist=float(inputs["BufferDistance"]["value"]) |
---|
| 179 | except: |
---|
| 180 | bdist=1 |
---|
| 181 | print >> sys.stderr, bdist |
---|
| 182 | geometry=extractInputs(conf,inputs["InputPolygon"]) |
---|
| 183 | i=0 |
---|
| 184 | rgeometries=[] |
---|
| 185 | while i < len(geometry): |
---|
| 186 | tmp=geometry[i].Clone() |
---|
| 187 | resg=geometry[i].GetGeometryRef().Buffer(bdist) |
---|
| 188 | tmp.SetGeometryDirectly(resg) |
---|
| 189 | rgeometries+=[tmp] |
---|
| 190 | geometry[i].Destroy() |
---|
| 191 | resg.thisown=False |
---|
| 192 | tmp.thisown=False |
---|
| 193 | i+=1 |
---|
| 194 | outputResult(conf,outputs["Result"],rgeometries) |
---|
| 195 | i=0 |
---|
[382] | 196 | return zoo.SERVICE_SUCCEEDED |
---|
[9] | 197 | |
---|
[465] | 198 | def Clean(conf,inputs,outputs): |
---|
| 199 | from shapely.wkb import loads |
---|
| 200 | print >> sys.stderr, "Starting service ..." |
---|
| 201 | features=extractInputs(conf,inputs["InputData"]) |
---|
| 202 | i=0 |
---|
| 203 | rgeometries=[] |
---|
| 204 | while i < len(features): |
---|
| 205 | tmp=features[i].Clone() |
---|
| 206 | resg=features[i].GetGeometryRef() |
---|
| 207 | if resg is not None: |
---|
| 208 | geom = loads(resg.ExportToWkb()) |
---|
| 209 | if geom.is_valid: |
---|
| 210 | tmp.SetGeometryDirectly(resg) |
---|
| 211 | rgeometries+=[tmp] |
---|
| 212 | print >> sys.stderr,"valid !" |
---|
| 213 | else: |
---|
| 214 | print >> sys.stderr,"invalid !" |
---|
| 215 | print >> sys.stderr,geom.wkt[0:50] |
---|
| 216 | features[i].Destroy() |
---|
| 217 | resg.thisown=False |
---|
| 218 | tmp.thisown=False |
---|
| 219 | i+=1 |
---|
| 220 | outputResult(conf,outputs["Result"],rgeometries) |
---|
| 221 | i=0 |
---|
| 222 | print >> sys.stderr,"Return" |
---|
| 223 | return zoo.SERVICE_SUCCEEDED |
---|
| 224 | |
---|
| 225 | def TransformService(conf,inputs,outputs): |
---|
| 226 | from osgeo import osr |
---|
| 227 | geometry=extractInputs(conf,inputs["InputData"]) |
---|
| 228 | sourceRef = osr.SpatialReference() |
---|
| 229 | tmp=inputs["SourceCRS"]["value"].split(":") |
---|
| 230 | sourceRef.ImportFromEPSG(int(tmp[len(tmp)-1])) |
---|
| 231 | targetRef = osr.SpatialReference() |
---|
| 232 | tmp=inputs["TargetCRS"]["value"].split(":") |
---|
| 233 | targetRef.ImportFromEPSG(int(tmp[len(tmp)-1])) |
---|
| 234 | transform = osr.CoordinateTransformation(sourceRef, targetRef) |
---|
| 235 | i=0 |
---|
| 236 | rgeometries=[] |
---|
| 237 | while i < len(geometry): |
---|
| 238 | tmp=geometry[i].Clone() |
---|
| 239 | resg=geometry[i].GetGeometryRef() |
---|
| 240 | resg.Transform(transform) |
---|
| 241 | tmp.SetGeometryDirectly(resg.Clone()) |
---|
| 242 | rgeometries+=[tmp] |
---|
| 243 | geometry[i].Destroy() |
---|
| 244 | i+=1 |
---|
| 245 | outputResult(conf,outputs["TransformedData"],rgeometries) |
---|
| 246 | return zoo.SERVICE_SUCCEEDED |
---|
| 247 | |
---|
[9] | 248 | def BoundaryPy(conf,inputs,outputs): |
---|
[257] | 249 | geometry=extractInputs(conf,inputs["InputPolygon"]) |
---|
[106] | 250 | i=0 |
---|
| 251 | rgeometries=[] |
---|
| 252 | while i < len(geometry): |
---|
[360] | 253 | tmp=geometry[i].Clone() |
---|
| 254 | resg=geometry[i].GetGeometryRef() |
---|
| 255 | resg=resg.GetBoundary() |
---|
| 256 | tmp.SetGeometryDirectly(resg) |
---|
| 257 | rgeometries+=[tmp] |
---|
[106] | 258 | geometry[i].Destroy() |
---|
| 259 | i+=1 |
---|
| 260 | outputResult(conf,outputs["Result"],rgeometries) |
---|
[382] | 261 | return zoo.SERVICE_SUCCEEDED |
---|
[9] | 262 | |
---|
| 263 | def CentroidPy(conf,inputs,outputs): |
---|
[257] | 264 | geometry=extractInputs(conf,inputs["InputPolygon"]) |
---|
[106] | 265 | i=0 |
---|
| 266 | rgeometries=[] |
---|
| 267 | while i < len(geometry): |
---|
[360] | 268 | tmp=geometry[i].Clone() |
---|
| 269 | resg=geometry[i].GetGeometryRef() |
---|
| 270 | if resg.GetGeometryType()!=3: |
---|
| 271 | resg=resg.ConvexHull() |
---|
| 272 | resg=resg.Centroid() |
---|
| 273 | tmp.SetGeometryDirectly(resg) |
---|
| 274 | rgeometries+=[tmp] |
---|
[106] | 275 | geometry[i].Destroy() |
---|
| 276 | i+=1 |
---|
| 277 | outputResult(conf,outputs["Result"],rgeometries) |
---|
[388] | 278 | return zoo.SERVICE_SUCCEEDED |
---|
[9] | 279 | |
---|
| 280 | def ConvexHullPy(conf,inputs,outputs): |
---|
[257] | 281 | geometry=extractInputs(conf,inputs["InputPolygon"]) |
---|
[106] | 282 | i=0 |
---|
| 283 | rgeometries=[] |
---|
| 284 | while i < len(geometry): |
---|
[360] | 285 | tmp=geometry[i].Clone() |
---|
| 286 | resg=geometry[i].GetGeometryRef().ConvexHull() |
---|
| 287 | tmp.SetGeometryDirectly(resg) |
---|
| 288 | rgeometries+=[tmp] |
---|
[106] | 289 | geometry[i].Destroy() |
---|
| 290 | i+=1 |
---|
| 291 | outputResult(conf,outputs["Result"],rgeometries) |
---|
[388] | 292 | return zoo.SERVICE_SUCCEEDED |
---|
[9] | 293 | |
---|
[360] | 294 | |
---|
| 295 | |
---|
| 296 | def EnvelopePy(conf,inputs,outputs): |
---|
| 297 | print >> sys.stderr, inputs |
---|
[9] | 298 | try: |
---|
[107] | 299 | bdist=float(inputs["BufferDistance"]["value"]) |
---|
[9] | 300 | except: |
---|
| 301 | bdist=10 |
---|
[257] | 302 | geometry=extractInputs(conf,inputs["InputPolygon"]) |
---|
[360] | 303 | tmp=geometry[0].GetGeometryRef().GetEnvelope() |
---|
| 304 | outputs["Result"]["value"]=str(tmp[0])+','+str(tmp[2])+','+str(tmp[1])+','+str(tmp[3])+','+'urn:ogc:def:crs:OGC:1.3:CRS84' |
---|
| 305 | print >> sys.stderr,outputs["Result"] |
---|
[9] | 306 | return 3 |
---|
| 307 | |
---|
| 308 | def UnionPy(conf,inputs,outputs): |
---|
[257] | 309 | geometry1=extractInputs(conf,inputs["InputEntity1"]) |
---|
| 310 | geometry2=extractInputs(conf,inputs["InputEntity2"]) |
---|
[106] | 311 | rgeometries=[] |
---|
| 312 | i=0 |
---|
| 313 | while i < len(geometry1): |
---|
| 314 | j=0 |
---|
| 315 | while j < len(geometry2): |
---|
[389] | 316 | tmp=geometry1[i].Clone() |
---|
| 317 | resg=geometry2[j].GetGeometryRef() |
---|
[388] | 318 | resg=resg.Union(geometry1[i].GetGeometryRef()) |
---|
| 319 | tmp.SetGeometryDirectly(resg) |
---|
| 320 | if not(resg.IsEmpty()): |
---|
| 321 | rgeometries+=[tmp] |
---|
[106] | 322 | j+=1 |
---|
| 323 | geometry1[i].Destroy() |
---|
| 324 | i+=1 |
---|
| 325 | i=0 |
---|
| 326 | while i < len(geometry2): |
---|
| 327 | geometry2[i].Destroy() |
---|
| 328 | i+=1 |
---|
| 329 | outputResult(conf,outputs["Result"],rgeometries) |
---|
[9] | 330 | return 3 |
---|
| 331 | |
---|
| 332 | def IntersectionPy(conf,inputs,outputs): |
---|
[360] | 333 | |
---|
[257] | 334 | geometry1=extractInputs(conf,inputs["InputEntity1"]) |
---|
| 335 | geometry2=extractInputs(conf,inputs["InputEntity2"]) |
---|
[360] | 336 | |
---|
[382] | 337 | print >> sys.stderr,str(len(geometry1))+" "+str(len(geometry2)) |
---|
| 338 | |
---|
[106] | 339 | rgeometries=[] |
---|
[382] | 340 | fids=[] |
---|
[106] | 341 | i=0 |
---|
| 342 | while i < len(geometry1): |
---|
| 343 | j=0 |
---|
| 344 | while j < len(geometry2): |
---|
[360] | 345 | tmp=geometry2[j].Clone() |
---|
| 346 | resg=geometry2[j].GetGeometryRef() |
---|
| 347 | #resg=resg.Intersection(geometry1[i].GetGeometryRef()) |
---|
| 348 | resg=geometry1[i].GetGeometryRef().Intersection(resg) |
---|
| 349 | tmp.SetGeometryDirectly(resg) |
---|
[382] | 350 | if resg is not None and not(resg.IsEmpty()) and fids.count(tmp.GetFID())==0: |
---|
[360] | 351 | rgeometries+=[tmp] |
---|
[382] | 352 | fids+=[tmp.GetFID()] |
---|
| 353 | else: |
---|
| 354 | tmp.Destroy() |
---|
[106] | 355 | j+=1 |
---|
| 356 | geometry1[i].Destroy() |
---|
| 357 | i+=1 |
---|
| 358 | i=0 |
---|
| 359 | while i < len(geometry2): |
---|
| 360 | geometry2[i].Destroy() |
---|
| 361 | i+=1 |
---|
| 362 | outputResult(conf,outputs["Result"],rgeometries) |
---|
[360] | 363 | print >> sys.stderr,"/outputResult" |
---|
[9] | 364 | return 3 |
---|
| 365 | |
---|
| 366 | def DifferencePy(conf,inputs,outputs): |
---|
[257] | 367 | geometry1=extractInputs(conf,inputs["InputEntity1"]) |
---|
| 368 | geometry2=extractInputs(conf,inputs["InputEntity2"]) |
---|
[106] | 369 | rgeometries=[] |
---|
| 370 | i=0 |
---|
| 371 | while i < len(geometry1): |
---|
| 372 | j=0 |
---|
| 373 | while j < len(geometry2): |
---|
[360] | 374 | tmp=geometry2[j].Clone() |
---|
| 375 | resg=geometry1[i].GetGeometryRef() |
---|
| 376 | resg=resg.Difference(geometry2[i].GetGeometryRef()) |
---|
| 377 | tmp.SetGeometryDirectly(resg) |
---|
| 378 | if not(resg.IsEmpty()): |
---|
| 379 | rgeometries+=[tmp] |
---|
[106] | 380 | j+=1 |
---|
| 381 | geometry1[i].Destroy() |
---|
| 382 | i+=1 |
---|
| 383 | i=0 |
---|
| 384 | while i < len(geometry2): |
---|
| 385 | geometry2[i].Destroy() |
---|
| 386 | i+=1 |
---|
| 387 | outputResult(conf,outputs["Result"],rgeometries) |
---|
[9] | 388 | return 3 |
---|
| 389 | |
---|
| 390 | def SymDifferencePy(conf,inputs,outputs): |
---|
[257] | 391 | geometry1=extractInputs(conf,inputs["InputEntity1"]) |
---|
| 392 | geometry2=extractInputs(conf,inputs["InputEntity2"]) |
---|
[106] | 393 | rgeometries=[] |
---|
| 394 | i=0 |
---|
| 395 | while i < len(geometry1): |
---|
| 396 | j=0 |
---|
| 397 | while j < len(geometry2): |
---|
[360] | 398 | tmp=geometry2[j].Clone() |
---|
| 399 | resg=geometry1[i].GetGeometryRef() |
---|
| 400 | resg=resg.SymmetricDifference(geometry2[i].GetGeometryRef()) |
---|
| 401 | tmp.SetGeometryDirectly(resg) |
---|
| 402 | rgeometries+=[tmp] |
---|
[106] | 403 | j+=1 |
---|
| 404 | geometry1[i].Destroy() |
---|
| 405 | i+=1 |
---|
| 406 | i=0 |
---|
| 407 | while i < len(geometry2): |
---|
| 408 | geometry2[i].Destroy() |
---|
| 409 | i+=1 |
---|
| 410 | outputResult(conf,outputs["Result"],rgeometries) |
---|
[9] | 411 | return 3 |
---|
[360] | 412 | |
---|