source: trunk/zoo-services/ogr/base-vect-ops/service.c @ 26

Last change on this file since 26 was 26, checked in by djay, 14 years ago

ZOO-Kernel updates and bug fixes :

  • Fixing gestion of RawDataOutput? when the Service return SERVICE_FAILED an ExceptionReport? was returned to the client.
  • Use gcc when compiling service_internal.c to avoid strange error messages about switch ....
  • Function setMapInMaps was added in service.h to let users set the value of a specific map in a maps.
  • Fixing JavaScript? issue during the context destruction process.
  • Use the GetStatus? ZOO Service when it is available on the local installation for statusLocation.
  • Add some comments for ServiceStarted?, ServiceSucceeded?, ServiceFailed? and ServiceAccepted?.
  • Dynamic creation of a lenv maps in the main configuration file maps, containing the current status and a sid (Service ID). Those informations can be used later by the GetStatus? Service to let user check the on-going status during the Service runs.
  • Function updateStatus was added to service_internal.h which let the Services developers set the current percentCompleted value.

ZOO-Service updates and bug fixes :

  • Add GetStatus? Service and its demo longProcess Service. All are in the wps_status.zo Services Provider.
  • Use the setMapInMaps in the base-vect-ops code to enhance readibility.

ZOO-API updates :

  • Add the function ZOO.UpdateStatus? to the ZOO JavaScript? API which simply point on ZOOUpdateStatus which can be called as-is from JavaScript?. Use : ZOOUpdateStatus(conf,value) where conf is the main configuration file maps and value the the value of the current status.
File size: 17.2 KB
RevLine 
[1]1/**
2 * Author : Gérald FENOY
3 *
4 * Copyright 2008-2009 GeoLabs SARL. All rights reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24
[9]25#include "cpl_conv.h"
[1]26#include "ogr_api.h"
[9]27#include "ogr_geometry.h"
28#include "geos_c.h"
[1]29#include "service.h"
30
31extern "C" {
32#include <libxml/tree.h>
33#include <libxml/parser.h>
34#include <libxml/xpath.h>
35#include <libxml/xpathInternals.h>
36
37#include <openssl/sha.h>
38#include <openssl/hmac.h>
39#include <openssl/evp.h>
40#include <openssl/bio.h>
41#include <openssl/buffer.h>
42
43  void printExceptionReportResponse(maps*,map*);
44  char *base64(const unsigned char *input, int length);
45
46  OGRGeometryH createGeometryFromGML(maps* conf,char* inputStr){
47    xmlInitParser();
48    xmlDocPtr doc = xmlParseMemory(inputStr,strlen(inputStr));
49    xmlChar *xmlbuff;
50    int buffersize;
51    xmlXPathContextPtr xpathCtx;
52    xmlXPathObjectPtr xpathObj;
53    char * xpathExpr="/*/*/*/*/*[local-name()='Polygon' or local-name()='MultiPolygon']";
54    xpathCtx = xmlXPathNewContext(doc);
55    xpathObj = xmlXPathEvalExpression(BAD_CAST xpathExpr,xpathCtx);
56    if(!xpathObj->nodesetval){
57      map* tmp=createMap("text","Unable to parse Input Polygon");
58      addToMap(tmp,"code","InvalidParameterValue");
59      printExceptionReportResponse(conf,tmp);
60      exit(0);
61    }
62    int size = (xpathObj->nodesetval) ? xpathObj->nodesetval->nodeNr : 0;
63    /**
64     * Create a temporary XML document
65     */
66    xmlDocPtr ndoc = xmlNewDoc(BAD_CAST "1.0");
67    /**
68     * Only one polygon should be provided so we use it as the root node.
69     */
70    for(int k=size-1;k>=0;k--){ 
71      xmlDocSetRootElement(ndoc, xpathObj->nodesetval->nodeTab[k]);
72    }
73    xmlDocDumpFormatMemory(ndoc, &xmlbuff, &buffersize, 1);
[9]74    char *tmp=(char*)calloc((xmlStrlen(xmlStrstr(xmlbuff,BAD_CAST "?>"))-1),sizeof(char));
75    sprintf(tmp,"%s",xmlStrstr(xmlbuff,BAD_CAST "?>")+2);
[1]76    xmlXPathFreeObject(xpathObj);
[9]77    xmlXPathFreeContext(xpathCtx);
[1]78    xmlFree(xmlbuff);
79    xmlFreeDoc(doc);
[9]80    xmlFreeDoc(ndoc);
[1]81    xmlCleanupParser();
82#ifdef DEBUG
83    fprintf(stderr,"\nService internal print\n Loading the geometry from GML string ...");
84#endif
85    OGRGeometryH res=OGR_G_CreateFromGML(tmp);
[9]86    free(tmp);
[1]87    if(res==NULL){
[26]88      setMapInMaps(conf,"lenv","message","Unable to call OGR_G_CreatFromGML");
89      return NULL;
[1]90    }
91    else
[26]92      return res;
[1]93  }
94
[9]95  int Simplify(maps*& conf,maps*& inputs,maps*& outputs){
[1]96    maps* cursor=inputs;
[9]97    OGRGeometryH geometry,res;
98    double tolerance;
99    map* tmp0=getMapFromMaps(cursor,"Tolerance","value");
100    if(tmp0==NULL){
101      tolerance=atof("2.0");
[1]102    }
[9]103    else
104      tolerance=atof(tmp0->value);
105    fprintf(stderr,"Tolerance for Simplify %f",tolerance);
[1]106    map* tmp=getMapFromMaps(inputs,"InputPolygon","value");
[26]107    if(!tmp){
108      setMapInMaps(conf,"lenv","message","Unagle to parse the input geometry from InputPolygon");
[1]109      return SERVICE_FAILED;
[26]110    }
111    map* tmp1=getMapFromMaps(inputs,"InputPolygon","mimeType");
[1]112    if(tmp1!=NULL){
[9]113      if(strncmp(tmp1->value,"text/js",7)==0 ||
[26]114         strncmp(tmp1->value,"application/json",16)==0)
[1]115        geometry=OGR_G_CreateGeometryFromJson(tmp->value);
116      else
117        geometry=createGeometryFromGML(conf,tmp->value);
[9]118    }
[26]119    else{
120      setMapInMaps(conf,"lenv","message","Unable to find any geometry for InputPolygon");
121      return SERVICE_FAILED;
122    }
123    if(geometry==NULL){
124      setMapInMaps(conf,"lenv","message","Unagle to parse the input geometry from InputPolygon");
125      return SERVICE_FAILED;
126    }
127    fprintf(stderr,"Create GEOSGeometry object");
[9]128    GEOSGeometry* ggeometry=((OGRGeometry *) geometry)->exportToGEOS();
129    GEOSGeometry* gres=GEOSTopologyPreserveSimplify(ggeometry,tolerance);
130    res=OGRGeometryFactory::createFromGEOS(gres);
[26]131    tmp1=getMapFromMaps(outputs,"Result","mimeType");
[1]132    if(tmp1!=NULL){
[9]133      if(strncmp(tmp1->value,"text/js",7)==0 ||
134         strncmp(tmp1->value,"application/json",16)==0){
[26]135        char *tmpS=OGR_G_ExportToJson(res);
136        setMapInMaps(outputs,"Result","value",tmpS);
137        setMapInMaps(outputs,"Result","mimeType","text/plain");
138        setMapInMaps(outputs,"Result","encoding","UTF-8");
139        free(tmpS);
[1]140      }
141      else{
[26]142        char *tmpS=OGR_G_ExportToGML(res);
143        setMapInMaps(outputs,"Result","value",tmpS);
144        setMapInMaps(outputs,"Result","mimeType","text/xml");
145        setMapInMaps(outputs,"Result","encoding","UTF-8");
146        setMapInMaps(outputs,"Result","schema","http://fooa/gml/3.1.0/polygon.xsd");
147        free(tmpS);
[1]148      }
149    }else{
[26]150      char *tmpS=OGR_G_ExportToJson(tmp->value);
151      setMapInMaps(outputs,"Result","value",tmpS);
152      setMapInMaps(outputs,"Result","mimeType","text/plain");
153      setMapInMaps(outputs,"Result","encoding","UTF-8");
154      free(tmpS);
[1]155    }
156    outputs->next=NULL;
[9]157    //GEOSFree(ggeometry);
158    //GEOSFree(gres);
159    OGR_G_DestroyGeometry(res);
160    OGR_G_DestroyGeometry(geometry);
[1]161    return SERVICE_SUCCEEDED;
162  }
163
164
[9]165  int applyOne(maps*& conf,maps*& inputs,maps*& outputs,OGRGeometryH (*myFunc)(OGRGeometryH)){
[1]166#ifdef DEBUG
[9]167    fprintf(stderr,"\nService internal print\n");
[1]168#endif
169    maps* cursor=inputs;
170    OGRGeometryH geometry,res;
171#ifdef DEBUG
[9]172    dumpMaps(cursor);
[1]173#endif
[9]174    map* tmp=getMapFromMaps(inputs,"InputPolygon","value");
175    if(!tmp)
176      return SERVICE_FAILED;
177    fprintf(stderr,"Service internal print \n");
178    dumpMaps(inputs);
179    fprintf(stderr,"/Service internal print \n");
180    map* tmp1=getMapFromMaps(inputs,"InputPolygon","mimeType");
181    fprintf(stderr,"Service internal print \n");
182    dumpMap(tmp1);
183    fprintf(stderr,"/Service internal print \n");
184    if(tmp1!=NULL){
185      if(strncmp(tmp1->value,"text/js",7)==0 ||
186         strncmp(tmp1->value,"application/json",7)==0)
187        geometry=OGR_G_CreateGeometryFromJson(tmp->value);
[1]188      else
[9]189        geometry=createGeometryFromGML(conf,tmp->value);
[1]190    }
[9]191    else
192      geometry=createGeometryFromGML(conf,tmp->value);
[26]193    if(geometry==NULL)
194      return SERVICE_FAILED;
[9]195    res=(*myFunc)(geometry);
196    fprintf(stderr,"Service internal print \n");
[1]197    dumpMaps(outputs);
[9]198    fprintf(stderr,"/Service internal print \n");
199    map *tmp_2=getMapFromMaps(outputs,"Result","mimeType");
200    fprintf(stderr,"Service internal print \n");
201    dumpMap(tmp_2);
202    fprintf(stderr,"/Service internal print \n");
203    if(tmp_2!=NULL){
204      if(strncmp(tmp_2->value,"text/js",7)==0 ||
205         strncmp(tmp_2->value,"application/json",16)==0){
[26]206        char *tmpS=OGR_G_ExportToJson(res);
207        setMapInMaps(outputs,"Result","value",tmpS);
208        setMapInMaps(outputs,"Result","mimeType","text/plain");
209        setMapInMaps(outputs,"Result","encoding","UTF-8");
210        free(tmpS);
[1]211      }
[9]212      else{
[26]213        char *tmpS=OGR_G_ExportToGML(res);
214        setMapInMaps(outputs,"Result","value",tmpS);
215        setMapInMaps(outputs,"Result","mimeType","text/plain");
216        setMapInMaps(outputs,"Result","encoding","UTF-8");
217        free(tmpS);
218
[1]219      }
[9]220    }else{
[26]221      char *tmpS=OGR_G_ExportToJson(res);
222      setMapInMaps(outputs,"Result","value",tmpS);
223      setMapInMaps(outputs,"Result","mimeType","text/plain");
224      setMapInMaps(outputs,"Result","encoding","UTF-8");
225      free(tmpS);
[1]226    }
227    outputs->next=NULL;
228#ifdef DEBUG
229    dumpMaps(outputs);
230    fprintf(stderr,"\nService internal print\n===\n");
231#endif
[9]232    OGR_G_DestroyGeometry(res);
233    OGR_G_DestroyGeometry(geometry);
234    //CPLFree(res);
235    //CPLFree(geometry);
236    fprintf(stderr,"Service internal print \n");
237    dumpMaps(outputs);
238    fprintf(stderr,"/Service internal print \n");
[1]239    return SERVICE_SUCCEEDED;
240  }
241
242#ifdef WIN32
243  __declspec(dllexport)
244#endif
[9]245int Buffer(maps*& conf,maps*& inputs,maps*& outputs){
246   OGRGeometryH geometry,res;
247   map* tmp=getMapFromMaps(inputs,"InputPolygon","value");
248   if(tmp==NULL)
249     return SERVICE_FAILED;
250   map* tmp1=getMapFromMaps(inputs,"InputPolygon","mimeType");
251   if(strncmp(tmp1->value,"application/json",16)==0)
252     geometry=OGR_G_CreateGeometryFromJson(tmp->value);
253   else
254     geometry=createGeometryFromGML(conf,tmp->value);
[26]255   if(geometry==NULL){
256     setMapInMaps(conf,"lenv","message","Unable to parse input geometry");
257     return SERVICE_FAILED;
258   }
259   double bufferDistance;
[9]260   tmp=getMapFromMaps(inputs,"BufferDistance","value");
[26]261   if(tmp==NULL){
262     bufferDistance=atof("10.0");
263   }
264   else
265     bufferDistance=atof(tmp->value);
[9]266   res=OGR_G_Buffer(geometry,bufferDistance,30);
267   tmp1=getMapFromMaps(outputs,"Result","mimeType");
268   if(strncmp(tmp1->value,"application/json",16)==0){
[26]269     char *tmpS=OGR_G_ExportToJson(res);
270     setMapInMaps(outputs,"Result","value",tmpS);
271     setMapInMaps(outputs,"Result","mimeType","text/plain");
272     setMapInMaps(outputs,"Result","encoding","UTF-8");
273     free(tmpS);
[9]274   }
275   else{
[26]276     char *tmpS=OGR_G_ExportToGML(res);
277     setMapInMaps(outputs,"Result","value",tmpS);
278     setMapInMaps(outputs,"Result","mimeType","text/xml");
279     setMapInMaps(outputs,"Result","encoding","UTF-8");
280     setMapInMaps(outputs,"Result","schema","http://fooa/gml/3.1.0/polygon.xsd");
[9]281   }
282   outputs->next=NULL;
283   OGR_G_DestroyGeometry(geometry);
284   OGR_G_DestroyGeometry(res);
285   return SERVICE_SUCCEEDED;
286}
287
[1]288#ifdef WIN32
289  __declspec(dllexport)
290#endif
[9]291  int Boundary(maps*& conf,maps*& inputs,maps*& outputs){
292    return applyOne(conf,inputs,outputs,&OGR_G_GetBoundary);
293  }
294
295#ifdef WIN32
296  __declspec(dllexport)
297#endif
298  int ConvexHull(maps*& conf,maps*& inputs,maps*& outputs){
299    return applyOne(conf,inputs,outputs,&OGR_G_ConvexHull);
300  }
301
302
303  OGRGeometryH MY_OGR_G_Centroid(OGRGeometryH hTarget){
304    OGRGeometryH res;
305    res=OGR_G_CreateGeometryFromJson("{\"type\": \"Point\", \"coordinates\": [0,0] }");
306    OGRwkbGeometryType gtype=OGR_G_GetGeometryType(hTarget);
307    if(gtype!=wkbPolygon){
308      hTarget=OGR_G_ConvexHull(hTarget);
309    }
310    int c=OGR_G_Centroid(hTarget,res);
311    return res;
312  }
313
314#ifdef WIN32
315  __declspec(dllexport)
316#endif
317  int Centroid(maps*& conf,maps*& inputs,maps*& outputs){
318    return applyOne(conf,inputs,outputs,&MY_OGR_G_Centroid);
319  }
320
321  int applyTwo(maps*& conf,maps*& inputs,maps*& outputs,OGRGeometryH (*myFunc)(OGRGeometryH,OGRGeometryH)){
[1]322#ifdef DEBUG
323    fprintf(stderr,"\nService internal print1\n");
[26]324    fflush(stderr);
[9]325#endif
[26]326    fprintf(stderr,"\nService internal print1\n");
327    dumpMaps(inputs);
328    fprintf(stderr,"\nService internal print1\n");
[9]329
[1]330    maps* cursor=inputs;
331    OGRGeometryH geometry1,geometry2;
332    OGRGeometryH res;
333    {
334      map* tmp=getMapFromMaps(inputs,"InputEntity1","value");
335      map* tmp1=getMapFromMaps(inputs,"InputEntity1","mimeType");
336      if(tmp1!=NULL){
337        if(strncmp(tmp1->value,"application/json",16)==0)
338          geometry1=OGR_G_CreateGeometryFromJson(tmp->value);
339        else
340          geometry1=createGeometryFromGML(conf,tmp->value);
341      }
342      else
343        geometry1=createGeometryFromGML(conf,tmp->value);
344    }
[26]345    if(geometry1==NULL){
346      setMapInMaps(conf,"lenv","message","Unable to parse input geometry for InputEntity1.");
347      fprintf(stderr,"SERVICE FAILED !\n");
348      return SERVICE_FAILED;
349    }
350    fprintf(stderr,"\nService internal print1 InputEntity1\n");
[1]351    {
352      map* tmp=getMapFromMaps(inputs,"InputEntity2","value");
353      map* tmp1=getMapFromMaps(inputs,"InputEntity2","mimeType");
[26]354      //#ifdef DEBUG
355      fprintf(stderr,"MY MAP \n[%s] - %i\n",tmp1->value,strncmp(tmp1->value,"application/json",16));
356      //dumpMap(tmp);
[1]357      fprintf(stderr,"MY MAP\n");
[26]358      ///#endif
359      fprintf(stderr,"\nService internal print1 InputEntity2\n");
[1]360      if(tmp1!=NULL){
[26]361        if(strncmp(tmp1->value,"application/json",16)==0){
362          fprintf(stderr,"\nService internal print1 InputEntity2 as JSON\n");
[1]363          geometry2=OGR_G_CreateGeometryFromJson(tmp->value);
[26]364        }
365        else{
366          fprintf(stderr,"\nService internal print1 InputEntity2 as GML\n");
[1]367          geometry2=createGeometryFromGML(conf,tmp->value);
[26]368        }
[1]369      }
370      else
371        geometry2=createGeometryFromGML(conf,tmp->value);
[26]372      fprintf(stderr,"\nService internal print1 InputEntity2 PreFinal\n");
[1]373    }
[26]374    fprintf(stderr,"\nService internal print1 InputEntity2 Final\n");
375    if(geometry2==NULL){
376      setMapInMaps(conf,"lenv","message","Unable to parse input geometry for InputEntity2.");
377      fprintf(stderr,"SERVICE FAILED !\n");
378      return SERVICE_FAILED;
379    }
380    fprintf(stderr,"\nService internal print1\n");
[9]381    res=(*myFunc)(geometry1,geometry2);
[26]382    fprintf(stderr,"\nService internal print1\n");
383    char *tmpS=OGR_G_ExportToJson(res);
384    setMapInMaps(outputs,"Result","value",tmpS);
385    setMapInMaps(outputs,"Result","mimeType","text/plain");
386    setMapInMaps(outputs,"Result","encoding","UTF-8");
387    free(tmpS);
[9]388    OGR_G_DestroyGeometry(geometry1);
389    OGR_G_DestroyGeometry(geometry2);
390    OGR_G_DestroyGeometry(res);
[1]391    return SERVICE_SUCCEEDED;
392  }
[9]393 
394#ifdef WIN32
395  __declspec(dllexport)
396#endif
397  int Difference(maps*& conf,maps*& inputs,maps*& outputs){
398    return applyTwo(conf,inputs,outputs,&OGR_G_Difference);
399  }
[1]400
401#ifdef WIN32
402  __declspec(dllexport)
403#endif
[9]404  int SymDifference(maps*& conf,maps*& inputs,maps*& outputs){
405    return applyTwo(conf,inputs,outputs,&OGR_G_SymmetricDifference);
406  }
407
408#ifdef WIN32
409  __declspec(dllexport)
410#endif
411  int Intersection(maps*& conf,maps*& inputs,maps*& outputs){
412    return applyTwo(conf,inputs,outputs,&OGR_G_Intersection);
413  }
414
415#ifdef WIN32
416  __declspec(dllexport)
417#endif
418  int Union(maps*& conf,maps*& inputs,maps*& outputs){
419    return applyTwo(conf,inputs,outputs,&OGR_G_Union);
420  }
421
422#ifdef WIN32
423  __declspec(dllexport)
424#endif
[1]425  int Distance(maps*& conf,maps*& inputs,maps*& outputs){
426#ifdef DEBUG
427    fprintf(stderr,"\nService internal print1\n");
428#endif
429    fflush(stderr);
430    maps* cursor=inputs;
431    OGRGeometryH geometry1,geometry2;
432    double res;
433    {
434      map* tmp=getMapFromMaps(inputs,"InputEntity1","value");
435      map* tmp1=getMapFromMaps(inputs,"InputEntity1","mimeType");
436#ifdef DEBUG
437      fprintf(stderr,"MY MAP\n");
438      dumpMap(tmp1);
439      dumpMaps(inputs);
440      fprintf(stderr,"MY MAP\n");
441#endif
442      if(tmp1!=NULL){
443        if(strncmp(tmp1->value,"application/json",16)==0)
444          geometry1=OGR_G_CreateGeometryFromJson(tmp->value);
445        else
446          geometry1=createGeometryFromGML(conf,tmp->value);
447      }
448      else
449        geometry1=createGeometryFromGML(conf,tmp->value);
450    }
[26]451    if(geometry1==NULL){
452      setMapInMaps(conf,"lenv","message","Unable to parse input geometry for InputEntity1.");
453      fprintf(stderr,"SERVICE FAILED !\n");
454      return SERVICE_FAILED;
455    }
[1]456    {
457      map* tmp=getMapFromMaps(inputs,"InputEntity2","value");
458      map* tmp1=getMapFromMaps(inputs,"InputEntity2","mimeType");
459#ifdef DEBUG
460      fprintf(stderr,"MY MAP\n");
461      dumpMap(tmp1);
462      dumpMaps(inputs);
463      fprintf(stderr,"MY MAP\n");
464#endif
465      if(tmp1!=NULL){
466        if(strncmp(tmp1->value,"application/json",16)==0)
467          geometry2=OGR_G_CreateGeometryFromJson(tmp->value);
468        else
469          geometry2=createGeometryFromGML(conf,tmp->value);
470      }
471      else
472        geometry2=createGeometryFromGML(conf,tmp->value);
473    }
[26]474    if(geometry2==NULL){
475      setMapInMaps(conf,"lenv","message","Unable to parse input geometry for InputEntity2.");
476      fprintf(stderr,"SERVICE FAILED !\n");
477      return SERVICE_FAILED;
478    }
479    res=OGR_G_Distance(geometry1,geometry2);   
[1]480    char tmpres[100];
481    sprintf(tmpres,"%d",res);
[26]482    setMapInMaps(outputs,"Distance","value",tmpres);
483    setMapInMaps(outputs,"Distance","dataType","float");
[1]484#ifdef DEBUG
485    dumpMaps(outputs);
486    fprintf(stderr,"\nService internal print\n===\n");
487#endif
488    return SERVICE_SUCCEEDED;
489  }
490
[9]491#ifdef WIN32
492  __declspec(dllexport)
493#endif
[1]494  int GetArea(maps*& conf,maps*& inputs,maps*& outputs){
495    fprintf(stderr,"GETAREA \n");
496    double res;
497    /**
[26]498     * Extract Geometry from the InputPolygon value
[1]499     */
[26]500    OGRGeometryH geometry;
501    map* tmp=getMapFromMaps(inputs,"InputPolygon","value");
502    if(tmp==NULL){
503      setMapInMaps(conf,"lenv","message","Unable to parse input geometry from InputPolygon");
504      return SERVICE_FAILED;
505    }
[1]506    fprintf(stderr,"geometry creation %s \n",tmp->value);
[26]507    geometry=createGeometryFromGML(conf,tmp->value);
508    if(geometry==NULL){
509      setMapInMaps(conf,"lenv","message","Unable to parse input geometry from InputPolygon");
510      return SERVICE_FAILED;
511    }
[1]512    fprintf(stderr,"geometry created %s \n",tmp->value);
[26]513    res=OGR_G_GetArea(geometry);
[1]514    fprintf(stderr,"area %d \n",res);
515    /**
[26]516     * Filling the outputs
[1]517     */
518    char tmp1[100];
519    sprintf(tmp1,"%d",res);
[26]520    setMapInMaps(outputs,"Area","value",tmp1);
521    setMapInMaps(outputs,"Area","dataType","float");
[1]522#ifdef DEBUG
523    dumpMaps(outputs);
524#endif
525    return SERVICE_SUCCEEDED;
526  }
527
528}
Note: See TracBrowser for help on using the repository browser.

Search

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png