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

Last change on this file since 106 was 55, checked in by nmarco, 13 years ago

fixed error in GetArea? and Distance functions: wrong data type. Added the output in GML format in the ApplayTwo? function. Distance.zcfg: translated from French to English

File size: 18.6 KB
Line 
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
25#include "cpl_conv.h"
26#include "ogr_api.h"
27#include "ogr_geometry.h"
28#include "geos_c.h"
29#include "service.h"
30#include "service_internal.h"
31
32extern "C" {
33#include <libxml/tree.h>
34#include <libxml/parser.h>
35#include <libxml/xpath.h>
36#include <libxml/xpathInternals.h>
37
38#include <openssl/sha.h>
39#include <openssl/hmac.h>
40#include <openssl/evp.h>
41#include <openssl/bio.h>
42#include <openssl/buffer.h>
43
44  void printExceptionReportResponse(maps*,map*);
45  char *base64(const unsigned char *input, int length);
46
47  OGRGeometryH createGeometryFromGML(maps* conf,char* inputStr){
48    xmlInitParser();
49    xmlDocPtr doc = xmlParseMemory(inputStr,strlen(inputStr));
50    xmlChar *xmlbuff;
51    int buffersize;
52    xmlXPathContextPtr xpathCtx;
53    xmlXPathObjectPtr xpathObj;
54    char * xpathExpr="/*/*/*/*/*[local-name()='Polygon' or local-name()='MultiPolygon']";
55    xpathCtx = xmlXPathNewContext(doc);
56    xpathObj = xmlXPathEvalExpression(BAD_CAST xpathExpr,xpathCtx);
57    if(!xpathObj->nodesetval){
58      map* tmp=createMap("text","Unable to parse Input Polygon");
59      addToMap(tmp,"code","InvalidParameterValue");
60      printExceptionReportResponse(conf,tmp);
61      exit(0);
62    }
63    int size = (xpathObj->nodesetval) ? xpathObj->nodesetval->nodeNr : 0;
64    /**
65     * Create a temporary XML document
66     */
67    xmlDocPtr ndoc = xmlNewDoc(BAD_CAST "1.0");
68    /**
69     * Only one polygon should be provided so we use it as the root node.
70     */
71    for(int k=size-1;k>=0;k--){ 
72      xmlDocSetRootElement(ndoc, xpathObj->nodesetval->nodeTab[k]);
73    }
74    xmlDocDumpFormatMemory(ndoc, &xmlbuff, &buffersize, 1);
75    char *tmp=(char*)calloc((xmlStrlen(xmlStrstr(xmlbuff,BAD_CAST "?>"))-1),sizeof(char));
76    sprintf(tmp,"%s",xmlStrstr(xmlbuff,BAD_CAST "?>")+2);
77    xmlXPathFreeObject(xpathObj);
78    xmlXPathFreeContext(xpathCtx);
79    xmlFree(xmlbuff);
80    xmlFreeDoc(doc);
81    xmlFreeDoc(ndoc);
82    xmlCleanupParser();
83#ifdef DEBUG
84    fprintf(stderr,"\nService internal print\n Loading the geometry from GML string ...");
85#endif
86    OGRGeometryH res=OGR_G_CreateFromGML(tmp);
87    free(tmp);
88    if(res==NULL){
89      setMapInMaps(conf,"lenv","message",_ss("Unable to call OGR_G_CreatFromGML"));
90      return NULL;
91    }
92    else
93      return res;
94  }
95
96  int Simplify(maps*& conf,maps*& inputs,maps*& outputs){
97    maps* cursor=inputs;
98    OGRGeometryH geometry,res;
99    double tolerance;
100    map* tmp0=getMapFromMaps(cursor,"Tolerance","value");
101    if(tmp0==NULL){
102      tolerance=atof("2.0");
103    }
104    else
105      tolerance=atof(tmp0->value);
106    fprintf(stderr,"Tolerance for Simplify %f",tolerance);
107    map* tmp=getMapFromMaps(inputs,"InputPolygon","value");
108    if(!tmp){
109      setMapInMaps(conf,"lenv","message",_ss("Unable to parse the input geometry from InputPolygon"));
110      return SERVICE_FAILED;
111    }
112    map* tmp1=getMapFromMaps(inputs,"InputPolygon","mimeType");
113    if(tmp1!=NULL){
114      if(strncmp(tmp1->value,"text/js",7)==0 ||
115         strncmp(tmp1->value,"application/json",16)==0)
116        geometry=OGR_G_CreateGeometryFromJson(tmp->value);
117      else
118        geometry=createGeometryFromGML(conf,tmp->value);
119    }
120    else{
121      setMapInMaps(conf,"lenv","message",_ss("Unable to find any geometry for InputPolygon"));
122      return SERVICE_FAILED;
123    }
124    if(geometry==NULL){
125      setMapInMaps(conf,"lenv","message",_ss("Unable to parse the input geometry from InputPolygon"));
126      return SERVICE_FAILED;
127    }
128    fprintf(stderr,"Create GEOSGeometry object");
129    GEOSGeometry* ggeometry=((OGRGeometry *) geometry)->exportToGEOS();
130    GEOSGeometry* gres=GEOSTopologyPreserveSimplify(ggeometry,tolerance);
131    res=OGRGeometryFactory::createFromGEOS(gres);
132    tmp1=getMapFromMaps(outputs,"Result","mimeType");
133    if(tmp1!=NULL){
134      if(strncmp(tmp1->value,"text/js",7)==0 ||
135         strncmp(tmp1->value,"application/json",16)==0){
136        char *tmpS=OGR_G_ExportToJson(res);
137        setMapInMaps(outputs,"Result","value",tmpS);
138        setMapInMaps(outputs,"Result","mimeType","text/plain");
139        setMapInMaps(outputs,"Result","encoding","UTF-8");
140        free(tmpS);
141      }
142      else{
143        char *tmpS=OGR_G_ExportToGML(res);
144        setMapInMaps(outputs,"Result","value",tmpS);
145        setMapInMaps(outputs,"Result","mimeType","text/xml");
146        setMapInMaps(outputs,"Result","encoding","UTF-8");
147        setMapInMaps(outputs,"Result","schema","http://fooa/gml/3.1.0/polygon.xsd");
148        free(tmpS);
149      }
150    }else{
151      char *tmpS=OGR_G_ExportToJson(tmp->value);
152      setMapInMaps(outputs,"Result","value",tmpS);
153      setMapInMaps(outputs,"Result","mimeType","text/plain");
154      setMapInMaps(outputs,"Result","encoding","UTF-8");
155      free(tmpS);
156    }
157    outputs->next=NULL;
158    //GEOSFree(ggeometry);
159    //GEOSFree(gres);
160    OGR_G_DestroyGeometry(res);
161    OGR_G_DestroyGeometry(geometry);
162    return SERVICE_SUCCEEDED;
163  }
164
165
166  int applyOne(maps*& conf,maps*& inputs,maps*& outputs,OGRGeometryH (*myFunc)(OGRGeometryH),char* schema){
167#ifdef DEBUG
168    fprintf(stderr,"\nService internal print\n");
169#endif
170    maps* cursor=inputs;
171    OGRGeometryH geometry,res;
172#ifdef DEBUG
173    dumpMaps(cursor);
174#endif
175    map* tmp=getMapFromMaps(inputs,"InputPolygon","value");
176    if(!tmp){
177      setMapInMaps(conf,"lenv","message",_ss("Unable to parse the input geometry from InputPolygon"));
178      return SERVICE_FAILED;
179    }
180    fprintf(stderr,"Service internal print \n");
181    dumpMaps(inputs);
182    fprintf(stderr,"/Service internal print \n");
183    map* tmp1=getMapFromMaps(inputs,"InputPolygon","mimeType");
184    fprintf(stderr,"Service internal print \n");
185    dumpMap(tmp1);
186    fprintf(stderr,"/Service internal print \n");
187    if(tmp1!=NULL){
188      if(strncmp(tmp1->value,"text/js",7)==0 ||
189         strncmp(tmp1->value,"application/json",7)==0)
190        geometry=OGR_G_CreateGeometryFromJson(tmp->value);
191      else
192        geometry=createGeometryFromGML(conf,tmp->value);
193    }
194    else
195      geometry=createGeometryFromGML(conf,tmp->value);
196    if(geometry==NULL){
197      setMapInMaps(conf,"lenv","message",_ss("Unable to parse the input geometry from InputPolygon"));
198      return SERVICE_FAILED;
199    }
200    res=(*myFunc)(geometry);
201    fprintf(stderr,"Service internal print \n");
202    dumpMaps(outputs);
203    fprintf(stderr,"/Service internal print \n");
204    map *tmp_2=getMapFromMaps(outputs,"Result","mimeType");
205    fprintf(stderr,"Service internal print \n");
206    dumpMap(tmp_2);
207    fprintf(stderr,"/Service internal print \n");
208    if(tmp_2!=NULL){
209      if(strncmp(tmp_2->value,"text/js",7)==0 ||
210         strncmp(tmp_2->value,"application/json",16)==0){
211        char *tmpS=OGR_G_ExportToJson(res);
212        setMapInMaps(outputs,"Result","value",tmpS);
213        setMapInMaps(outputs,"Result","mimeType","text/plain");
214        setMapInMaps(outputs,"Result","encoding","UTF-8");
215        free(tmpS);
216      }
217      else{
218        char *tmpS=OGR_G_ExportToGML(res);
219        setMapInMaps(outputs,"Result","value",tmpS);
220        setMapInMaps(outputs,"Result","mimeType","text/xml");
221        setMapInMaps(outputs,"Result","encoding","UTF-8");
222        setMapInMaps(outputs,"Result","schema",schema);
223        free(tmpS);
224      }
225    }else{
226      char *tmpS=OGR_G_ExportToJson(res);
227      setMapInMaps(outputs,"Result","value",tmpS);
228      setMapInMaps(outputs,"Result","mimeType","text/plain");
229      setMapInMaps(outputs,"Result","encoding","UTF-8");
230      free(tmpS);
231    }
232    outputs->next=NULL;
233#ifdef DEBUG
234    dumpMaps(outputs);
235    fprintf(stderr,"\nService internal print\n===\n");
236#endif
237    OGR_G_DestroyGeometry(res);
238    OGR_G_DestroyGeometry(geometry);
239    //CPLFree(res);
240    //CPLFree(geometry);
241    fprintf(stderr,"Service internal print \n");
242    dumpMaps(outputs);
243    fprintf(stderr,"/Service internal print \n");
244    return SERVICE_SUCCEEDED;
245  }
246
247#ifdef WIN32
248  __declspec(dllexport)
249#endif
250int Buffer(maps*& conf,maps*& inputs,maps*& outputs){
251   OGRGeometryH geometry,res;
252   map* tmp=getMapFromMaps(inputs,"InputPolygon","value");
253   if(tmp==NULL){
254     setMapInMaps(conf,"lenv","message",_ss("Unable to fetch input geometry"));
255     return SERVICE_FAILED;
256   }else
257     if(strlen(tmp->value)<=0){
258       setMapInMaps(conf,"lenv","message",_ss("Unable to fetch input geometry"));
259       return SERVICE_FAILED;
260     }
261   map* tmp1=getMapFromMaps(inputs,"InputPolygon","mimeType");
262   if(strncmp(tmp1->value,"application/json",16)==0)
263     geometry=OGR_G_CreateGeometryFromJson(tmp->value);
264   else
265     geometry=createGeometryFromGML(conf,tmp->value);
266   if(geometry==NULL){
267     setMapInMaps(conf,"lenv","message",_ss("Unable to parse input geometry"));
268     return SERVICE_FAILED;
269   }
270   double bufferDistance;
271   tmp=getMapFromMaps(inputs,"BufferDistance","value");
272   if(tmp==NULL){
273     bufferDistance=atof("10.0");
274   }
275   else
276     bufferDistance=atof(tmp->value);
277   res=OGR_G_Buffer(geometry,bufferDistance,30);
278   tmp1=getMapFromMaps(outputs,"Result","mimeType");
279   if(strncmp(tmp1->value,"application/json",16)==0){
280     char *tmpS=OGR_G_ExportToJson(res);
281     setMapInMaps(outputs,"Result","value",tmpS);
282     setMapInMaps(outputs,"Result","mimeType","text/plain");
283     setMapInMaps(outputs,"Result","encoding","UTF-8");
284     free(tmpS);
285   }
286   else{
287     char *tmpS=OGR_G_ExportToGML(res);
288     setMapInMaps(outputs,"Result","value",tmpS);
289     free(tmpS);
290     setMapInMaps(outputs,"Result","mimeType","text/xml");
291     setMapInMaps(outputs,"Result","encoding","UTF-8");
292     setMapInMaps(outputs,"Result","schema","http://fooa/gml/3.1.0/polygon.xsd");
293   }
294   outputs->next=NULL;
295   OGR_G_DestroyGeometry(geometry);
296   OGR_G_DestroyGeometry(res);
297   return SERVICE_SUCCEEDED;
298}
299
300#ifdef WIN32
301  __declspec(dllexport)
302#endif
303  int Boundary(maps*& conf,maps*& inputs,maps*& outputs){
304    return applyOne(conf,inputs,outputs,&OGR_G_GetBoundary,"http://fooa/gml/3.1.0/polygon.xsd");
305  }
306
307#ifdef WIN32
308  __declspec(dllexport)
309#endif
310  int ConvexHull(maps*& conf,maps*& inputs,maps*& outputs){
311    return applyOne(conf,inputs,outputs,&OGR_G_ConvexHull,"http://fooa/gml/3.1.0/polygon.xsd");
312  }
313
314
315  OGRGeometryH MY_OGR_G_Centroid(OGRGeometryH hTarget){
316    OGRGeometryH res;
317    res=OGR_G_CreateGeometryFromJson("{\"type\": \"Point\", \"coordinates\": [0,0] }");
318    OGRwkbGeometryType gtype=OGR_G_GetGeometryType(hTarget);
319    if(gtype!=wkbPolygon){
320      hTarget=OGR_G_ConvexHull(hTarget);
321    }
322    int c=OGR_G_Centroid(hTarget,res);
323    return res;
324  }
325
326#ifdef WIN32
327  __declspec(dllexport)
328#endif
329  int Centroid(maps*& conf,maps*& inputs,maps*& outputs){
330    return applyOne(conf,inputs,outputs,&MY_OGR_G_Centroid,"http://fooa/gml/3.1.0/point.xsd");
331  }
332
333  int applyTwo(maps*& conf,maps*& inputs,maps*& outputs,OGRGeometryH (*myFunc)(OGRGeometryH,OGRGeometryH)){
334#ifdef DEBUG
335    fprintf(stderr,"\nService internal print1\n");
336    fflush(stderr);
337#endif
338    fprintf(stderr,"\nService internal print1\n");
339    dumpMaps(inputs);
340    fprintf(stderr,"\nService internal print1\n");
341
342    maps* cursor=inputs;
343    OGRGeometryH geometry1,geometry2;
344    OGRGeometryH res;
345    {
346      map* tmp=getMapFromMaps(inputs,"InputEntity1","value");
347      map* tmp1=getMapFromMaps(inputs,"InputEntity1","mimeType");
348      if(tmp1!=NULL){
349        if(strncmp(tmp1->value,"application/json",16)==0)
350          geometry1=OGR_G_CreateGeometryFromJson(tmp->value);
351        else
352          geometry1=createGeometryFromGML(conf,tmp->value);
353      }
354      else
355        geometry1=createGeometryFromGML(conf,tmp->value);
356    }
357    if(geometry1==NULL){
358      setMapInMaps(conf,"lenv","message",_ss("Unable to parse input geometry for InputEntity1."));
359      fprintf(stderr,"SERVICE FAILED !\n");
360      return SERVICE_FAILED;
361    }
362    fprintf(stderr,"\nService internal print1 InputEntity1\n");
363    {
364      map* tmp=getMapFromMaps(inputs,"InputEntity2","value");
365      map* tmp1=getMapFromMaps(inputs,"InputEntity2","mimeType");
366      //#ifdef DEBUG
367      fprintf(stderr,"MY MAP \n[%s] - %i\n",tmp1->value,strncmp(tmp1->value,"application/json",16));
368      //dumpMap(tmp);
369      fprintf(stderr,"MY MAP\n");
370      ///#endif
371      fprintf(stderr,"\nService internal print1 InputEntity2\n");
372      if(tmp1!=NULL){
373        if(strncmp(tmp1->value,"application/json",16)==0){
374          fprintf(stderr,"\nService internal print1 InputEntity2 as JSON\n");
375          geometry2=OGR_G_CreateGeometryFromJson(tmp->value);
376        }
377        else{
378          fprintf(stderr,"\nService internal print1 InputEntity2 as GML\n");
379          geometry2=createGeometryFromGML(conf,tmp->value);
380        }
381      }
382      else
383        geometry2=createGeometryFromGML(conf,tmp->value);
384      fprintf(stderr,"\nService internal print1 InputEntity2 PreFinal\n");
385    }
386    fprintf(stderr,"\nService internal print1 InputEntity2 Final\n");
387    if(geometry2==NULL){
388      setMapInMaps(conf,"lenv","message",_ss("Unable to parse input geometry for InputEntity2."));
389      fprintf(stderr,"SERVICE FAILED !\n");
390      return SERVICE_FAILED;
391    }
392    fprintf(stderr,"\nService internal print1\n");
393    res=(*myFunc)(geometry1,geometry2);
394    fprintf(stderr,"\nService internal print1\n");
395   
396    /* nuova parte */
397    map* tmp2=getMapFromMaps(outputs,"Result","mimeType");
398    if(strncmp(tmp2->value,"application/json",16)==0){
399      char *tmpS=OGR_G_ExportToJson(res);
400      setMapInMaps(outputs,"Result","value",tmpS);
401      setMapInMaps(outputs,"Result","mimeType","text/plain");
402      setMapInMaps(outputs,"Result","encoding","UTF-8");
403      free(tmpS);
404    }
405    else{
406      char *tmpS=OGR_G_ExportToGML(res);
407      setMapInMaps(outputs,"Result","value",tmpS);
408      setMapInMaps(outputs,"Result","mimeType","text/xml");
409      setMapInMaps(outputs,"Result","encoding","UTF-8");
410      setMapInMaps(outputs,"Result","schema","http://fooa/gml/3.1.0/polygon.xsd");
411      free(tmpS);
412    }
413   
414    /* vecchia da togliere */
415    /*
416    char *tmpS=OGR_G_ExportToJson(res);
417    setMapInMaps(outputs,"Result","value",tmpS);
418    setMapInMaps(outputs,"Result","mimeType","text/plain");
419    setMapInMaps(outputs,"Result","encoding","UTF-8");
420    free(tmpS);
421    */
422    OGR_G_DestroyGeometry(geometry1);
423    OGR_G_DestroyGeometry(geometry2);
424    OGR_G_DestroyGeometry(res);
425    return SERVICE_SUCCEEDED;
426  }
427 
428#ifdef WIN32
429  __declspec(dllexport)
430#endif
431  int Difference(maps*& conf,maps*& inputs,maps*& outputs){
432    return applyTwo(conf,inputs,outputs,&OGR_G_Difference);
433  }
434
435#ifdef WIN32
436  __declspec(dllexport)
437#endif
438  int SymDifference(maps*& conf,maps*& inputs,maps*& outputs){
439    return applyTwo(conf,inputs,outputs,&OGR_G_SymmetricDifference);
440  }
441
442#ifdef WIN32
443  __declspec(dllexport)
444#endif
445  int Intersection(maps*& conf,maps*& inputs,maps*& outputs){
446    return applyTwo(conf,inputs,outputs,&OGR_G_Intersection);
447  }
448
449#ifdef WIN32
450  __declspec(dllexport)
451#endif
452  int Union(maps*& conf,maps*& inputs,maps*& outputs){
453    return applyTwo(conf,inputs,outputs,&OGR_G_Union);
454  }
455
456#ifdef WIN32
457  __declspec(dllexport)
458#endif
459  int Distance(maps*& conf,maps*& inputs,maps*& outputs){
460#ifdef DEBUG
461    fprintf(stderr,"\nService internal print1\n");
462#endif
463    fflush(stderr);
464    maps* cursor=inputs;
465    OGRGeometryH geometry1,geometry2;
466    double res;
467    {
468      map* tmp=getMapFromMaps(inputs,"InputEntity1","value");
469      map* tmp1=getMapFromMaps(inputs,"InputEntity1","mimeType");
470#ifdef DEBUG
471      fprintf(stderr,"MY MAP\n");
472      dumpMap(tmp1);
473      dumpMaps(inputs);
474      fprintf(stderr,"MY MAP\n");
475#endif
476      if(tmp1!=NULL){
477        if(strncmp(tmp1->value,"application/json",16)==0)
478          geometry1=OGR_G_CreateGeometryFromJson(tmp->value);
479        else
480          geometry1=createGeometryFromGML(conf,tmp->value);
481      }
482      else
483        geometry1=createGeometryFromGML(conf,tmp->value);
484    }
485    if(geometry1==NULL){
486      setMapInMaps(conf,"lenv","message",_ss("Unable to parse input geometry for InputEntity1."));
487      fprintf(stderr,"SERVICE FAILED !\n");
488      return SERVICE_FAILED;
489    }
490    {
491      map* tmp=getMapFromMaps(inputs,"InputEntity2","value");
492      map* tmp1=getMapFromMaps(inputs,"InputEntity2","mimeType");
493#ifdef DEBUG
494      fprintf(stderr,"MY MAP\n");
495      dumpMap(tmp1);
496      dumpMaps(inputs);
497      fprintf(stderr,"MY MAP\n");
498#endif
499      if(tmp1!=NULL){
500        if(strncmp(tmp1->value,"application/json",16)==0)
501          geometry2=OGR_G_CreateGeometryFromJson(tmp->value);
502        else
503          geometry2=createGeometryFromGML(conf,tmp->value);
504      }
505      else
506        geometry2=createGeometryFromGML(conf,tmp->value);
507    }
508    if(geometry2==NULL){
509      setMapInMaps(conf,"lenv","message",_ss("Unable to parse input geometry for InputEntity2."));
510      fprintf(stderr,"SERVICE FAILED !\n");
511      return SERVICE_FAILED;
512    }
513    res=OGR_G_Distance(geometry1,geometry2);   
514    char tmpres[100];
515    sprintf(tmpres,"%f",res);
516    setMapInMaps(outputs,"Distance","value",tmpres);
517    setMapInMaps(outputs,"Distance","dataType","float");
518#ifdef DEBUG
519    dumpMaps(outputs);
520    fprintf(stderr,"\nService internal print\n===\n");
521#endif
522    return SERVICE_SUCCEEDED;
523  }
524
525#ifdef WIN32
526  __declspec(dllexport)
527#endif
528  int GetArea(maps*& conf,maps*& inputs,maps*& outputs){
529    fprintf(stderr,"GETAREA \n");
530    double res;
531    /**
532     * Extract Geometry from the InputPolygon value
533     */
534    OGRGeometryH geometry;
535    map* tmp=getMapFromMaps(inputs,"InputPolygon","value");
536    if(tmp==NULL){
537      setMapInMaps(conf,"lenv","message",_ss("Unable to parse input geometry from InputPolygon"));
538      return SERVICE_FAILED;
539    }
540    fprintf(stderr,"geometry creation %s \n",tmp->value);
541    geometry=createGeometryFromGML(conf,tmp->value);
542    if(geometry==NULL){
543      setMapInMaps(conf,"lenv","message",_ss("Unable to parse input geometry from InputPolygon"));
544      return SERVICE_FAILED;
545    }
546    fprintf(stderr,"geometry created %s \n",tmp->value);
547    res=OGR_G_GetArea(geometry);
548    fprintf(stderr,"area %d \n",res);
549    /**
550     * Filling the outputs
551     */
552    char tmp1[100];
553    sprintf(tmp1,"%f",res);
554    setMapInMaps(outputs,"Area","value",tmp1);
555    setMapInMaps(outputs,"Area","dataType","float");
556#ifdef DEBUG
557    dumpMaps(outputs);
558#endif
559    return SERVICE_SUCCEEDED;
560  }
561
562}
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