Changeset 961 for trunk/zoo-project/zoo-services
- Timestamp:
- Sep 8, 2020, 4:51:09 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-services/gdal/profile/service.c
r945 r961 35 35 #include "cpl_conv.h" 36 36 #include "ogr_api.h" 37 #if GDAL_VERSION_MAJOR >= 2 38 #include <gdal_priv.h> 39 #endif 37 40 38 41 #ifdef ZOO_SERVICE … … 87 90 GDALComputeRasterMinMax( hBand, TRUE, adfMinMax ); 88 91 #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{ 89 134 tmp1=getMapFromMaps(inputs,"Geometry","value"); 90 OGRGeometryH geometry=OGR_G_CreateGeometryFromJson(tmp1->value); 135 geometry=OGR_G_CreateGeometryFromJson(tmp1->value); 136 } 91 137 #else 92 138 OGRGeometryH geometry=OGR_G_CreateGeometryFromJson(argv[2]);
Note: See TracChangeset
for help on using the changeset viewer.