Ignore:
Timestamp:
Sep 8, 2020, 4:51:09 PM (4 years ago)
Author:
djay
Message:

Make sure not to try accessing mimetype and provenance in case a local file is used. Fix issue with addMapsToMaps. Produce value string only when memory=load for Python support. Make gdal/profile service usable in case memory=protect.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-services/gdal/profile/service.c

    r945 r961  
    3535#include "cpl_conv.h"
    3636#include "ogr_api.h"
     37#if GDAL_VERSION_MAJOR >= 2
     38#include <gdal_priv.h>
     39#endif
    3740
    3841#ifdef ZOO_SERVICE
     
    8790          GDALComputeRasterMinMax( hBand, TRUE, adfMinMax );
    8891#ifdef ZOO_SERVICE
     92        OGRGeometryH geometry=NULL;
     93        // Verify if there is a cache file for this input, use it if available
     94        tmp1=getMapFromMaps(inputs,"Geometry","cache_file");
     95        if(tmp1!=NULL){
     96#if GDAL_VERSION_MAJOR >= 2
     97          char* pszDataSource=strdup(tmp1->value);
     98          GDALDatasetH poDS
     99            = GDALOpenEx( pszDataSource,
     100                          GDAL_OF_READONLY | GDAL_OF_VECTOR,
     101                          NULL, NULL, NULL );
     102#endif
     103          for( int iLayer = 0; iLayer < OGR_DS_GetLayerCount(poDS) ;
     104               iLayer++ )
     105            {
     106              OGRLayerH        poLayer = OGR_DS_GetLayer(poDS,iLayer);
     107
     108              if( poLayer == NULL )
     109                {
     110                  fprintf( stderr, "FAILURE: Couldn't fetch advertised layer %d!\n",
     111                           iLayer );
     112                  char tmp[1024];
     113                  sprintf(tmp,"Couldn't fetch advertised layer %d!",iLayer);
     114                  setMapInMaps(conf,"lenv","message",tmp);
     115                  return SERVICE_FAILED;
     116                }
     117              OGRFeatureH  poFeature;
     118              int         nFeaturesInTransaction = 0;
     119              int fCount=0;
     120              OGR_L_ResetReading(poLayer);
     121              while( TRUE )
     122                {
     123                  poFeature = OGR_L_GetNextFeature(poLayer);
     124                  if( poFeature == NULL ){
     125                    break;
     126                  }
     127                  geometry=OGR_G_Clone(OGR_F_GetGeometryRef(poFeature));
     128                  OGR_F_Destroy( poFeature );
     129                }
     130             
     131            }
     132        }
     133        else{
    89134          tmp1=getMapFromMaps(inputs,"Geometry","value");
    90           OGRGeometryH geometry=OGR_G_CreateGeometryFromJson(tmp1->value);
     135          geometry=OGR_G_CreateGeometryFromJson(tmp1->value);
     136        }
    91137#else
    92138          OGRGeometryH geometry=OGR_G_CreateGeometryFromJson(argv[2]);
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