Ignore:
Timestamp:
Dec 12, 2017, 4:09:47 PM (6 years ago)
Author:
djay
Message:

Add status_code key to the lenv section to support returning a specific HTTP error code from the service code. Fix callback invocation to support inputs arrays at step 1 and 2. Fix issue with cpu usage. Fix issue with mapserver publication when an input is optional. Fix callback invocation at step 7 in case the service has failed on the HPC side.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/prototype-v0/zoo-project/zoo-kernel/service_internal_ms.c

    r854 r860  
    7676
    7777/**
     78 * Return the current publish_id value
     79 * @param elem and maps pointer on which the search occur
     80 * @return the integer value of the publish_id field, if any, 0 otherwise
     81 */
     82int getPublishedId(maps* elem){
     83  map* myIndex=getMap(elem->content,"published_id");
     84  if(myIndex!=NULL){
     85    return atoi(myIndex->value);
     86  }
     87  return 0;
     88}
     89/**
    7890 * Add width and height keys to an output maps containing the maximum width
    7991 * and height for displaying the full data extent.
     
    8799 */
    88100void setMapSize(maps* output,double minx,double miny,double maxx,double maxy){
     101  int imyIndex=getPublishedId(output);
    89102  double maxWidth=640;
    90103  double maxHeight=480;
     
    118131#endif
    119132  if(output!=NULL){
    120     addToMap(output->content,"width",sWidth);
    121     addToMap(output->content,"height",sHeight);
     133    setMapArray(output->content,"width",imyIndex,sWidth);
     134    setMapArray(output->content,"height",imyIndex,sHeight);
    122135  }
    123136}
     
    131144 */
    132145void setReferenceUrl(maps* m,maps* tmpI){
    133   outputMapfile(m,tmpI);
    134146  map *msUrl=getMapFromMaps(m,"main","mapserverAddress");
    135147  if(msUrl==NULL){
     
    138150    exit(-1);
    139151  }
     152  int imyIndex=getPublishedId(tmpI);
     153  if(getMapArray(tmpI->content,"ref_wms_link",imyIndex)!=NULL)
     154    return;
     155  outputMapfile(m,tmpI);
    140156  int finalProto=-1;
    141157  map *msOgcVersion=getMapFromMaps(m,"main","msOgcVersion");
    142158  map *dataPath=getMapFromMaps(m,"main","dataPath");
    143159  map *sid=getMapFromMaps(m,"lenv","usid");
    144   map* format=getMap(tmpI->content,"mimeType");
    145   map* rformat=getMap(tmpI->content,"requestedMimeType");
    146   map* width=getMap(tmpI->content,"width");
    147   map* height=getMap(tmpI->content,"height");
    148   map* protoMap=getMap(tmpI->content,"msOgc");
    149   map* versionMap=getMap(tmpI->content,"msOgcVersion");
     160  map* format=getMapArray(tmpI->content,"mimeType",imyIndex);
     161  map* rformat=getMapArray(tmpI->content,"requestedMimeType",imyIndex);
     162  map* width=getMapArray(tmpI->content,"width",imyIndex);
     163  map* height=getMapArray(tmpI->content,"height",imyIndex);
     164  map* protoMap=getMapArray(tmpI->content,"msOgc",imyIndex);
     165  map* versionMap=getMapArray(tmpI->content,"msOgcVersion",imyIndex);
     166  map* datatype=getMapArray(tmpI->content,"geodatatype",imyIndex);
    150167  char options[4][5][25]={
    151168    {"WMS","1.3.0","GetMap","layers=%s","wms_extent"},
     
    154171    {"WCS","1.1.0","GetCoverage","coverage=%s","wcs_extent"}
    155172  };
    156   map* datatype=getMap(tmpI->content,"geodatatype");
    157173  if(datatype==NULL || strncmp(datatype->value,"other",5)==0){
    158     setMapInMaps(m,"lenv","mapError","true");
    159     setMapInMaps(m,"lenv","locator",tmpI->name);
    160     setMapInMaps(m,"lenv","message",_("The ZOO-Kernel was able to retrieve the data but could not read it as geographic data."));
    161     if(getMapFromMaps(m,"lenv","state")==NULL)
    162       errorException (m, _("Unable to find any geographic data"), "WrongInputData", tmpI->name);
     174    map* minNb=getMap(tmpI->content,"minoccurs");
     175    if(minNb==NULL || atoi(minNb->value)>=1){
     176      setMapInMaps(m,"lenv","mapError","true");
     177      setMapInMaps(m,"lenv","locator",tmpI->name);
     178      setMapInMaps(m,"lenv","message",_("The ZOO-Kernel was able to retrieve the data but could not read it as geographic data."));
     179      if(getMapFromMaps(m,"lenv","state")==NULL)
     180        errorException (m, _("Unable to find any geographic data"), "WrongInputData", tmpI->name);
     181    }
    163182    return;
    164183  }
    165184  int proto=0;
    166185  if(rformat==NULL){
    167     rformat=getMap(tmpI->content,"mimeType");
     186    rformat=getMapArray(tmpI->content,"mimeType",imyIndex);
    168187  }
    169188  if(strncasecmp(rformat->value,"text/xml",8)==0)
     
    172191     strncasecmp(rformat->value,"image/geotiff",10)==0)
    173192    proto=2;
     193  int hasFormat=-1;
    174194  if(protoMap!=NULL){
    175     if(strncasecmp(protoMap->value,"WMS",3)==0)
     195    hasFormat=1;
     196    if(strncasecmp(protoMap->value,"WMS",3)==0){
    176197      proto=0;
     198      rformat=createMap("value","image/png");
     199    }
    177200    else{
    178       if(strncasecmp(protoMap->value,"WFS",3)==0)
     201      if(strncasecmp(protoMap->value,"WFS",3)==0){
    179202        proto=1;
    180       else
     203        rformat=createMap("value","text/xml");
     204      }
     205      else {
    181206        proto=2;
     207        rformat=createMap("value","image/tiff");
     208      }
    182209    }
    183210  }
     
    190217  }
    191218
    192   map* extent=getMap(tmpI->content,options[proto][4]);
    193   map* crs=getMap(tmpI->content,"crs");
     219
     220  map* extent=getMapArray(tmpI->content,options[proto][4],imyIndex);
     221  map* crs=getMapArray(tmpI->content,"crs",imyIndex);
    194222  int hasCRS=1;
    195223  if(crs==NULL){
     
    203231  sprintf(layers,options[proto][3],tmpI->name);
    204232
    205   char* webService_url=(char*)malloc((strlen(msUrl->value)+strlen(format->value)+strlen(tmpI->name)+strlen(width->value)+strlen(height->value)+strlen(extent->value)+256)*sizeof(char));
     233  if(format==NULL || width==NULL || height==NULL || extent==NULL){
     234    char tmpStr[1024];
     235    sprintf(tmpStr,_("Unable to create the mapfile for %s because of missing values."),tmpI->name);
     236    errorException (m, tmpStr,
     237                    "InternalError", NULL);
     238    exit(-1);
     239    return;
     240  }
     241
     242  if(proto==0){
     243    hasFormat=1;
     244    rformat=createMap("mimeType","image/png");
     245  }else{
     246    if(proto==1){
     247      rformat=createMap("mimeType","text/xml");
     248      hasFormat=1;
     249    }
     250    else
     251      if(proto==2){
     252        rformat=createMap("mimeType","image/tiff");
     253        hasFormat=1;
     254        finalProto=1;
     255      }
     256  }
    206257 
     258  char* webService_url=(char*)malloc((strlen(msUrl->value)+strlen(rformat->value)+strlen(tmpI->name)+strlen(width->value)+strlen(height->value)+strlen(extent->value)+256)*sizeof(char));
     259
     260
    207261  if(proto>0){
    208262    if(proto==2)
    209263      finalProto=1;
    210264    sprintf(webService_url,
    211             "%s?map=%s/%s_%s.map&request=%s&service=%s&version=%s&%s&format=%s&bbox=%s&crs=%s",
     265            "%s?map=%s/%s_%d_%s.map&request=%s&service=%s&version=%s&%s&format=%s&bbox=%s&crs=%s",
    212266            msUrl->value,
    213267            dataPath->value,
    214268            tmpI->name,
     269            imyIndex,
    215270            sid->value,
    216271            options[proto][2],
     
    223278            );
    224279    if(datatype!=NULL && strncasecmp(datatype->value,"raster",6)==0){
    225       addToMap(tmpI->content,"ref_wcs_link",webService_url);
     280      setMapArray(tmpI->content,"ref_wcs_link",imyIndex,webService_url);
    226281    }
    227282    else{
    228       addToMap(tmpI->content,"ref_wfs_link",webService_url);
     283      setMapArray(tmpI->content,"ref_wfs_link",imyIndex,webService_url);
    229284    }
    230285    proto=0;
     286    freeMap(&rformat);
     287    free(rformat);
    231288    rformat=createMap("mimeType","image/png");
    232289  }
    233290  else{
    234291    sprintf(webService_url,
    235             "%s?map=%s/%s_%s.map&request=%s&service=%s&version=%s&%s&width=%s&height=%s&format=%s&bbox=%s&crs=%s",
     292            "%s?map=%s/%s_%d_%s.map&request=%s&service=%s&version=%s&%s&width=%s&height=%s&format=%s&bbox=%s&crs=%s",
    236293            msUrl->value,
    237294            dataPath->value,
    238295            tmpI->name,
     296            imyIndex,
    239297            sid->value,
    240298            options[proto][2],
     
    248306            crs->value
    249307            );
    250     addToMap(tmpI->content,"ref_wms_link",webService_url);
     308    setMapArray(tmpI->content,"ref_wms_link",imyIndex,webService_url);
    251309    if(datatype!=NULL && strncasecmp(datatype->value,"raster",6)==0){
    252310      proto=2;
     311      freeMap(&rformat);
     312      free(rformat);
    253313      rformat=createMap("mimeType","image/tiff");
    254314    }
    255315    else{
    256316      proto=1;
     317      freeMap(&rformat);
     318      free(rformat);
    257319      rformat=createMap("mimeType","text/xml");
    258320    }
    259321  }
    260   addToMap(tmpI->content,"Reference",webService_url);
     322  setMapArray(tmpI->content,"Reference",imyIndex,webService_url);
    261323  memset(layers,0,128);
    262324  sprintf(layers,options[proto][3],tmpI->name);
    263325  protoVersion=options[proto][1];
    264   extent=getMap(tmpI->content,options[proto][4]);
     326  extent=getMapArray(tmpI->content,options[proto][4],imyIndex);
    265327  memset(webService_url,0,strlen(webService_url));
    266328  if(proto>0){
     
    268330      finalProto=1;
    269331    sprintf(webService_url,
    270             "%s?map=%s/%s_%s.map&request=%s&service=%s&version=%s&%s&format=%s&bbox=%s&crs=%s",
     332            "%s?map=%s/%s_%d_%s.map&request=%s&service=%s&version=%s&%s&format=%s&bbox=%s&crs=%s",
    271333            msUrl->value,
    272334            dataPath->value,
    273335            tmpI->name,
     336            imyIndex,
    274337            sid->value,
    275338            options[proto][2],
     
    282345            );
    283346    if(datatype!=NULL && strncasecmp(datatype->value,"raster",6)==0){
    284       addToMap(tmpI->content,"ref_wcs_link",webService_url);
     347      setMapArray(tmpI->content,"ref_wcs_link",imyIndex,webService_url);
    285348    }
    286349    else{
    287       addToMap(tmpI->content,"ref_wfs_link",webService_url);
     350      setMapArray(tmpI->content,"ref_wfs_link",imyIndex,webService_url);
    288351    }
    289352  }else{
    290353    sprintf(webService_url,
    291             "%s?map=%s/%s_%s.map&request=%s&service=%s&version=%s&%s&width=%s&height=%s&format=%s&bbox=%s&crs=%s",
     354            "%s?map=%s/%s_%d_%s.map&request=%s&service=%s&version=%s&%s&width=%s&height=%s&format=%s&bbox=%s&crs=%s",
    292355            msUrl->value,
    293356            dataPath->value,
    294357            tmpI->name,
     358            imyIndex,
    295359            sid->value,
    296360            options[proto][2],
     
    304368            crs->value
    305369            );
    306     addToMap(tmpI->content,"ref_wms_link",webService_url);
     370    setMapArray(tmpI->content,"ref_wms_link",imyIndex,webService_url);
    307371  }
    308372  if(finalProto>0){
     
    311375    sprintf(layers,options[proto][3],tmpI->name);
    312376    protoVersion=options[proto][1];
    313     extent=getMap(tmpI->content,options[proto][4]);
     377    extent=getMapArray(tmpI->content,options[proto][4],imyIndex);
    314378    memset(webService_url,0,strlen(webService_url));
     379    freeMap(&rformat);
     380    free(rformat);
     381    rformat=createMap("value","image/tiff");
    315382    sprintf(webService_url,
    316             "%s?map=%s/%s_%s.map&request=%s&service=%s&version=%s&%s&format=%s&bbox=%s&crs=%s",
     383            "%s?map=%s/%s_%d_%s.map&request=%s&service=%s&version=%s&%s&format=%s&bbox=%s&crs=%s",
    317384            msUrl->value,
    318385            dataPath->value,
    319386            tmpI->name,
     387            imyIndex,
    320388            sid->value,
    321389            options[proto][2],
     
    327395            crs->value
    328396            );
    329     addToMap(tmpI->content,"ref_wcs_preview_link",webService_url);
     397    setMapArray(tmpI->content,"ref_wcs_preview_link",imyIndex,webService_url);
    330398  }
    331399  if(hasCRS==0){
     
    352420  OGRSpatialReferenceH  hSRS;
    353421  map* msSrs=NULL;
     422  int imyIndex=getPublishedId(output);
    354423  hSRS = OSRNewSpatialReference(NULL);
    355424  if( pszProjection!=NULL && strlen(pszProjection)>1){
     
    375444        if(output!=NULL){
    376445          if(OSRIsGeographic(hSRS)==TRUE)
    377             addToMap(output->content,"crs_isGeographic","true");
     446            setMapArray(output->content,"crs_isGeographic",imyIndex,"true");
    378447          else
    379             addToMap(output->content,"crs_isGeographic","false");
    380           addToMap(output->content,"crs",tmpSrs);
     448            setMapArray(output->content,"crs_isGeographic",imyIndex,"false");
     449          setMapArray(output->content,"crs",imyIndex,tmpSrs);
    381450        }
    382451      }
     
    391460          if(output!=NULL){
    392461            if(OSRIsGeographic(hSRS)==TRUE)
    393               addToMap(output->content,"crs_isGeographic","true");
     462              setMapArray(output->content,"crs_isGeographic",imyIndex,"true");
    394463            else
    395               addToMap(output->content,"crs_isGeographic","false");
     464              setMapArray(output->content,"crs_isGeographic",imyIndex,"false");
    396465          }
    397466          free(proj4Str);
     
    401470          msLoadProjectionStringEPSG(&myLayer->projection,"EPSG:4326");
    402471          if(output!=NULL){
    403             addToMap(output->content,"crs_isGeographic","true");
     472            setMapArray(output->content,"crs_isGeographic",imyIndex,"true");
    404473          }
    405474        }
    406475        if(output!=NULL){
    407           addToMap(output->content,"crs","EPSG:4326");
    408           addToMap(output->content,"real_extent","true");
     476          setMapArray(output->content,"crs",imyIndex,"EPSG:4326");
     477          setMapArray(output->content,"real_extent",imyIndex,"true");
    409478        }
    410479        msInsertHashTable(&(m->web.metadata),"ows_srs", "EPSG:4326 EPSG:900913 EPSG:3857");
     
    415484  else{
    416485    if(output!=NULL){
    417       msSrs=getMap(output->content,"msSrs");
     486      msSrs=getMapArray(output->content,"msSrs",imyIndex);
    418487    }
    419488    if(msSrs!=NULL){
     
    431500    }
    432501    if(output!=NULL){
    433       addToMap(output->content,"crs",msSrs->value);
    434       addToMap(output->content,"crs_isGeographic","true");
     502      setMapArray(output->content,"crs",imyIndex,msSrs->value);
     503      setMapArray(output->content,"crs_isGeographic",imyIndex,"true");
    435504    }
    436505  }
     
    454523void setMsExtent(maps* output,mapObj* m,layerObj* myLayer,
    455524                 double minX,double minY,double maxX,double maxY){
     525  int imyIndex=getPublishedId(output);
    456526  msMapSetExtent(m,minX,minY,maxX,maxY);
    457527#ifdef DEBUGMS
     
    466536 
    467537  if(output!=NULL){
    468     map* test=getMap(output->content,"real_extent");
     538    map* test=getMapArray(output->content,"real_extent",imyIndex);
     539    pointObj min, max;
     540    projectionObj tempSrs;
     541    min.x = m->extent.minx;
     542    min.y = m->extent.miny;
     543    max.x = m->extent.maxx;
     544    max.y = m->extent.maxy;
     545    char tmpSrsStr[1024];
     546    msInitProjection(&tempSrs);
     547    msLoadProjectionStringEPSG(&tempSrs,"EPSG:4326");
     548
     549    msProjectPoint(&(myLayer->projection),&tempSrs,&min);
     550    msProjectPoint(&myLayer->projection,&tempSrs,&max);
     551 
    469552    if(test!=NULL){
    470       pointObj min, max;
    471       projectionObj tempSrs;
    472       min.x = m->extent.minx;
    473       min.y = m->extent.miny;
    474       max.x = m->extent.maxx;
    475       max.y = m->extent.maxy;
    476       char tmpSrsStr[1024];
    477       msInitProjection(&tempSrs);
    478       msLoadProjectionStringEPSG(&tempSrs,"EPSG:4326");
    479 
    480       msProjectPoint(&(m->projection),&tempSrs,&min);
    481       msProjectPoint(&m->projection,&tempSrs,&max);
    482      
    483553      sprintf(tmpExtent,"%.3f,%.3f,%.3f,%.3f",min.y,min.x,max.y,max.x);
    484       map* isGeo=getMap(output->content,"crs_isGeographic");
     554      map* isGeo=getMapArray(output->content,"crs_isGeographic",imyIndex);
    485555#ifdef DEBUGMS
    486556      fprintf(stderr,"isGeo = %s\n",isGeo->value);
    487557#endif
    488       if(isGeo!=NULL && strcasecmp("true",isGeo->value)==0)
     558      if(isGeo!=NULL && strcasecmp("true",isGeo->value)==0){
     559        sprintf(tmpExtent,"%.3f,%.3f,%.3f,%.3f",min.y,min.x,max.y,max.x);
     560        setMapArray(output->content,"wgs84_extent",imyIndex,tmpExtent);
    489561        sprintf(tmpExtent,"%f,%f,%f,%f", minY,minX, maxY, maxX);
    490       addToMap(output->content,"wms_extent",tmpExtent);
     562      }else{
     563        sprintf(tmpExtent,"%.3f,%.3f,%.3f,%.3f",min.x,min.y,max.x,max.y);
     564        setMapArray(output->content,"wgs84_extent",imyIndex,tmpExtent);
     565      }
     566      setMapArray(output->content,"wms_extent",imyIndex,tmpExtent);
    491567      sprintf(tmpSrsStr,"%.3f,%.3f,%.3f,%.3f",min.x,min.y,max.x,max.y);
    492       addToMap(output->content,"wcs_extent",tmpExtent);
     568      setMapArray(output->content,"wcs_extent",imyIndex,tmpExtent);
    493569    }else{
     570      sprintf(tmpExtent,"%.3f,%.3f,%.3f,%.3f",min.x,min.y,max.x,max.y);
     571      setMapArray(output->content,"wgs84_extent",imyIndex,tmpExtent);
    494572      sprintf(tmpExtent,"%f,%f,%f,%f",minX, minY, maxX, maxY);
    495       map* isGeo=getMap(output->content,"crs_isGeographic");
     573      map* isGeo=getMapArray(output->content,"crs_isGeographic",imyIndex);
    496574      if(isGeo!=NULL){
    497575#ifdef DEBUGMS
     
    501579          sprintf(tmpExtent,"%f,%f,%f,%f", minY,minX, maxY, maxX);
    502580      }
    503       addToMap(output->content,"wms_extent",tmpExtent);
     581      setMapArray(output->content,"wms_extent",imyIndex,tmpExtent);
    504582      sprintf(tmpExtent,"%.3f,%.3f,%.3f,%.3f",minX,minY,maxX,maxY);
    505       addToMap(output->content,"wcs_extent",tmpExtent);
     583      setMapArray(output->content,"wcs_extent",imyIndex,tmpExtent);
    506584    }
    507585  }
     
    518596 */
    519597int tryOgr(maps* conf,maps* output,mapObj* m){
    520 
    521   map* tmpMap=getMap(output->content,"storage");
     598  int imyIndex=getPublishedId(output);
     599  map* tmpMap=getMapArray(output->content,"storage",imyIndex);
    522600  char *pszDataSource=tmpMap->value;
    523601
     
    643721#endif
    644722    setMapInMaps(conf,"lenv","message","Unable to open datasource in read only mode");
    645     //OGR_DS_Destroy(poDS);
    646     //OGRCleanupAll();
    647723#ifdef DEBUGMS
    648724    fprintf(stderr,"Unable to access the DataSource, exit! \n");
     
    651727  }
    652728
    653   addToMap(output->content,"geodatatype","vector");
     729  setMapArray(output->content,"geodatatype",imyIndex,"vector");
    654730  int iLayer = 0;
    655731  for( iLayer=0; iLayer < OGR_DS_GetLayerCount(poDS); iLayer++ ){
     
    687763    msConnectLayer(myLayer,MS_OGR,pszDataSource);
    688764
    689     addIntToMap(output->content,"nb_features",OGR_L_GetFeatureCount(poLayer,1));
     765    addIntToMapArray(output->content,"nb_features",imyIndex,OGR_L_GetFeatureCount(poLayer,1));
    690766
    691767    /**
     
    739815    }
    740816    else{
    741       addToMap(output->content,"crs","EPSG:4326");
    742       addToMap(output->content,"crs_isGeographic","true");
     817      setMapArray(output->content,"crs",imyIndex,"EPSG:4326");
     818      setMapArray(output->content,"crs_isGeographic",imyIndex,"true");
    743819      msLoadProjectionStringEPSG(&m->projection,"EPSG:4326");
    744820      msInsertHashTable(&(m->web.metadata), "ows_srs", "EPSG:4326 EPSG:900913 EPSG:3857");
     
    752828      memset(&extent,0,1024);
    753829      sprintf(extent,"%d,%d,%d,%d",oExt.MinX, oExt.MinY, oExt.MaxX, oExt.MaxY);
    754       addToMap(output->content,"boundingbox",extent);
     830      setMapArray(output->content,"boundingbox",imyIndex,extent);
    755831    }
    756832 
     
    771847    msInsertHashTable(&(myLayer->metadata), "gml_include_items", "all");
    772848    msInsertHashTable(&(myLayer->metadata), "ows_name", output->name);
    773     map* tmpMap=getMap(output->content,"title");
     849    map* tmpMap=getMapArray(output->content,"title",imyIndex);
    774850    if(tmpMap!=NULL)
    775851      msInsertHashTable(&(myLayer->metadata), "ows_title", tmpMap->value);
     
    839915 */
    840916int tryGdal(maps* conf,maps* output,mapObj* m){
    841   map* tmpMap=getMap(output->content,"storage");
     917  int imyIndex=getPublishedId(output);
     918  map* tmpMap=getMapArray(output->content,"storage",imyIndex);
    842919  char *pszFilename=tmpMap->value;
    843920  GDALDatasetH hDataset;
     
    855932    fprintf(stderr,"Unable to access the DataSource %s \n",pszFilename);
    856933#endif
    857     addToMap(output->content,"geodatatype","other");
     934    setMapArray(output->content,"geodatatype",imyIndex,"other");
    858935    setMapInMaps(conf,"lenv","message","gdalinfo failed - unable to open");
    859936    GDALDestroyDriverManager();
     
    864941#endif
    865942
    866   addToMap(output->content,"geodatatype","raster");
     943  setMapArray(output->content,"geodatatype",imyIndex,"raster");
    867944  /**
    868945   * Add a new layer set name, data
     
    886963
    887964  char *title=output->name;
    888   tmpMap=getMap(output->content,"title");
     965  tmpMap=getMapArray(output->content,"title",imyIndex);
    889966  if(tmpMap!=NULL)
    890967    title=tmpMap->value;
    891968  char *abstract=output->name;
    892   tmpMap=getMap(output->content,"abstract");
     969  tmpMap=getMapArray(output->content,"abstract",imyIndex);
    893970  if(tmpMap!=NULL)
    894971    abstract=tmpMap->value;
     
    905982  m->width=GDALGetRasterXSize( hDataset );
    906983  m->height=GDALGetRasterYSize( hDataset );
    907   addIntToMap(output->content,"nb_pixels",GDALGetRasterXSize( hDataset )*GDALGetRasterYSize( hDataset ));
     984  addIntToMapArray(output->content,"nb_pixels",imyIndex,GDALGetRasterXSize( hDataset )*GDALGetRasterYSize( hDataset ));
    908985 
    909986  /**
     
    9471024      memset(&extent,0,1024);
    9481025      sprintf(extent,"%d,%d,%d,%d",minX,minY,maxX,maxY);
    949       addToMap(output->content,"boundingbox",extent);
     1026      setMapArray(output->content,"boundingbox",imyIndex,extent);
    9501027    }
    9511028  }else{
    9521029    int scale=1;
    9531030    if(m->width>2048){
    954       addIntToMap(output->content,"width",2048);
     1031      addIntToMapArray(output->content,"width",imyIndex,2048);
    9551032      scale=2048/m->width;
    9561033    }else
    957       addIntToMap(output->content,"width",m->width);
    958     addIntToMap(output->content,"height",m->height*scale);
     1034      addIntToMapArray(output->content,"width",imyIndex,m->width);
     1035    addIntToMapArray(output->content,"height",imyIndex,m->height*scale);
    9591036  }
    9601037
     
    11301207   * First store the value on disk
    11311208   */
    1132   map* mime=getMap(outputs->content,"mimeType");
     1209  int imyIndex=getPublishedId(outputs);
     1210  map* mime=getMapArray(outputs->content,"mimeType",imyIndex);
    11331211  char *ext="data";
    11341212  if(mime!=NULL)
     
    11361214      ext="json";
    11371215
    1138   map* storage=getMap(outputs->content,"storage");
     1216  map* storage=getMapArray(outputs->content,"storage",imyIndex);
    11391217  if(storage==NULL){
    11401218    map* tmpMap=getMapFromMaps(conf,"main","dataPath");
    11411219    map* sidMap=getMapFromMaps(conf,"lenv","usid");
    11421220    char *pszDataSource=(char*)malloc((strlen(tmpMap->value)+strlen(sidMap->value)+strlen(outputs->name)+17)*sizeof(char));
    1143     sprintf(pszDataSource,"%s/ZOO_DATA_%s_%s.%s",tmpMap->value,outputs->name,sidMap->value,ext);
     1221    sprintf(pszDataSource,"%s/ZOO_DATA_%d_%s_%s.%s",tmpMap->value,imyIndex,outputs->name,sidMap->value,ext);
    11441222    int f=zOpen(pszDataSource,O_WRONLY|O_CREAT,S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
    1145     map *gfile=getMap(outputs->content,"generated_file");
     1223    map *gfile=getMapArray(outputs->content,"generated_file",imyIndex);
    11461224    if(gfile!=NULL){
    11471225      readGeneratedFile(conf,outputs->content,gfile->value);       
    11481226    }
    1149     map* sizeMap=getMap(outputs->content,"size");
    1150     map* vData=getMap(outputs->content,"value");
     1227    map* sizeMap=getMapArray(outputs->content,"size",imyIndex);
     1228    map* vData=getMapArray(outputs->content,"value",imyIndex);
    11511229    if(sizeMap!=NULL){
    11521230      zWrite(f,vData->value,atoi(sizeMap->value)*sizeof(char));
     
    11561234    }
    11571235    close(f);
    1158     addToMap(outputs->content,"storage",pszDataSource);
     1236    setMapArray(outputs->content,"storage",imyIndex,pszDataSource);
    11591237    free(pszDataSource);
    11601238  }
     
    13271405  map* sid=getMapFromMaps(conf,"lenv","usid");
    13281406  char *mapPath=
    1329     (char*)malloc((7+strlen(sid->value)+strlen(outputs->name)+strlen(tmp1->value))*sizeof(char));
    1330   sprintf(mapPath,"%s/%s_%s.map",tmp1->value,outputs->name,sid->value);
     1407    (char*)malloc((14+strlen(sid->value)+strlen(outputs->name)+strlen(tmp1->value))*sizeof(char));
     1408  sprintf(mapPath,"%s/%s_%d_%s.map",tmp1->value,outputs->name,imyIndex,sid->value);
    13311409  msSaveMap(myMap,mapPath);
    13321410  free(mapPath);
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

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