Changeset 766
- Timestamp:
- Jun 6, 2016, 3:29:50 PM (9 years ago)
- Location:
- trunk/zoo-project
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/HISTORY.txt
r753 r766 1 1 Version 1.6.0-dev 2 * Support GDAL version 2.1.0. 2 3 * Add the MapServer 7.0.1 internal support. 3 4 * Support for exotic location of openssl. -
trunk/zoo-project/zoo-api/java/zoo-api.c
r525 r766 5 5 6 6 JNIEXPORT jstring JNICALL Java_ZOO__1 7 (JNIEnv *env, jclass class, jstring msg){ 8 const char *message = (*env)->GetStringUTFChars(env,msg, 0); 7 (JNIEnv *env, jclass _class, jstring msg){ 8 const char *message = 9 #ifdef JAVA7 10 (*env).GetStringUTFChars(msg,0); 11 return (*env).NewStringUTF(_(message)); 12 #else 13 (*env)->GetStringUTFChars(env,msg, 0); 9 14 return (*env)->NewStringUTF(env, _(message)); 15 #endif 10 16 11 17 } 12 18 13 19 JNIEXPORT jobject JNICALL Java_ZOO_updateStatus 14 (JNIEnv *env, jclass class, jobject conf, jstring pourc, jstring msg){20 (JNIEnv *env, jclass _class, jobject conf, jstring pourc, jstring msg){ 15 21 16 22 jclass scHashMapClass,scHashMap_class; 17 23 #ifdef JAVA7 18 24 scHashMapClass = (*env).FindClass("java/util/HashMap"); 25 const char *pourcent = (*env).GetStringUTFChars(pourc,0); 26 const char *message = (*env).GetStringUTFChars(msg,0); 19 27 #else 20 28 scHashMapClass = (*env)->FindClass(env, "java/util/HashMap"); 21 #endif22 29 const char *pourcent = (*env)->GetStringUTFChars(env,pourc, 0); 23 30 const char *message = (*env)->GetStringUTFChars(env,msg, 0); 31 #endif 24 32 maps* m = mapsFromHashMap(env,conf,scHashMapClass); 25 33 setMapInMaps(m,"lenv","status",pourcent); -
trunk/zoo-project/zoo-services/gdal/contour/service.c
r743 r766 388 388 OGR_FD_GetFieldIndex( OGR_L_GetLayerDefn( hLayer ), 389 389 pszElevAttrib ), 390 390 (GDALProgressFunc)pfnProgress1, conf ); 391 391 392 392 OGR_DS_Destroy( hDS ); -
trunk/zoo-project/zoo-services/ogr/base-vect-ops/service.c
r499 r766 26 26 #include "ogr_api.h" 27 27 #include "ogr_geometry.h" 28 #if GDAL_VERSION_MAJOR >= 2 29 #include <gdal_priv.h> 30 #endif 28 31 29 32 #include "cpl_minixml.h" … … 41 44 #include <libxml/xpathInternals.h> 42 45 43 #include <openssl/sha.h>46 /*#include <openssl/sha.h> 44 47 #include <openssl/hmac.h> 45 48 #include <openssl/evp.h> 46 49 #include <openssl/bio.h> 47 50 #include <openssl/buffer.h> 51 */ 48 52 49 53 void printExceptionReportResponse(maps*,map*); … … 119 123 OGRLayer *poDstLayer; 120 124 const char *oDriver1; 121 OGRDataSource *poODS; 125 #if GDAL_VERSION_MAJOR >= 2 126 GDALDataset *poODS; 127 #else 128 OGRDataSource *poODS; 129 #endif 122 130 map* tmp=getMapFromMaps(inputs,"InputPolygon","value"); 123 131 if(!tmp){ … … 138 146 VSILFILE *ifile=VSIFileFromMemBuffer(filename,(GByte*)tmp->value,strlen(tmp->value),FALSE); 139 147 VSIFCloseL(ifile); 140 OGRDataSource* ipoDS = OGRSFDriverRegistrar::Open(filename,FALSE); 148 149 #if GDAL_VERSION_MAJOR >= 2 150 GDALDataset *ipoDS = 151 (GDALDataset*) GDALOpenEx( filename, 152 GDAL_OF_READONLY | GDAL_OF_VECTOR, 153 NULL, NULL, NULL ); 154 GDALDriverManager* poR=GetGDALDriverManager(); 155 GDALDriver *poDriver = NULL; 156 #else 157 OGRDataSource* ipoDS = 158 OGRSFDriverRegistrar::Open(filename,FALSE); 159 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar(); 160 OGRSFDriver *poDriver = NULL; 161 #endif 141 162 char pszDestDataSource[100]; 142 163 if( ipoDS == NULL ) 143 164 { 144 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar();145 146 165 fprintf( stderr, "FAILURE:\n" 147 166 "Unable to open datasource `%s' with the following drivers.\n", … … 150 169 for( int iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ ) 151 170 { 171 #if GDAL_VERSION_MAJOR >= 2 172 fprintf( stderr, " -> %s\n", poR->GetDriver(iDriver)->GetDescription() ); 173 #else 152 174 fprintf( stderr, " -> %s\n", poR->GetDriver(iDriver)->GetName() ); 175 #endif 153 176 } 154 177 char tmp[1024]; … … 173 196 174 197 OGRFeature *poFeature; 175 176 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar(); 177 OGRSFDriver *poDriver = NULL; 198 178 199 int iDriver; 179 200 … … 192 213 iDriver++ ) 193 214 { 215 #if GDAL_VERSION_MAJOR >=2 216 if( EQUAL(poR->GetDriver(iDriver)->GetDescription(),oDriver1) ) 217 #else 194 218 if( EQUAL(poR->GetDriver(iDriver)->GetName(),oDriver1) ) 219 #endif 195 220 { 196 221 poDriver = poR->GetDriver(iDriver); … … 206 231 for( iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ ) 207 232 { 233 #if GDAL_VERSION_MAJOR >=2 234 sprintf( emessage, "%s -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetDescription() ); 235 #else 208 236 sprintf( emessage, "%s -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetName() ); 237 #endif 209 238 } 210 239 … … 214 243 } 215 244 216 if( !poDriver->TestCapability( ODrCCreateDataSource ) ){ 217 char emessage[1024]; 218 sprintf( emessage, "%s driver does not support data source creation.\n", 219 "json" ); 220 setMapInMaps(conf,"lenv","message",emessage); 221 return SERVICE_FAILED; 222 } 245 #if GDAL_VERSION_MAJOR >=2 246 if( !CPLTestBool( CSLFetchNameValueDef(poDriver->GetMetadata(), GDAL_DCAP_CREATE, "FALSE") ) ) 247 #else 248 if( !poDriver->TestCapability( ODrCCreateDataSource ) ) 249 #endif 250 { 251 char emessage[1024]; 252 sprintf( emessage, "%s driver does not support data source creation.\n", 253 "json" ); 254 setMapInMaps(conf,"lenv","message",emessage); 255 return SERVICE_FAILED; 256 } 223 257 224 258 char **papszDSCO=NULL; 259 #if GDAL_VERSION_MAJOR >=2 260 poODS = poDriver->Create( pszDestDataSource, 0, 0, 0, GDT_Unknown, papszDSCO ); 261 #else 225 262 poODS = poDriver->CreateDataSource( pszDestDataSource, papszDSCO ); 263 #endif 226 264 if( poODS == NULL ){ 227 265 char emessage[1024]; … … 326 364 327 365 OGRCleanupAll(); 366 dumpMaps(outputs); 328 367 return SERVICE_SUCCEEDED; 329 368 330 369 } 331 370 332 371 int applyOne(maps*& conf,maps*& inputs,maps*& outputs,OGRGeometry* (OGRGeometry::*myFunc)() const,const char* schema){ 333 372 OGRRegisterAll(); 334 373 … … 337 376 OGRLayer *poDstLayer; 338 377 const char *oDriver1; 339 OGRDataSource *poODS; 378 #if GDAL_VERSION_MAJOR >= 2 379 GDALDataset *poODS; 380 #else 381 OGRDataSource *poODS; 382 #endif 340 383 map* tmp=getMapFromMaps(inputs,"InputPolygon","value"); 341 384 if(!tmp){ … … 356 399 VSILFILE *ifile=VSIFileFromMemBuffer(filename,(GByte*)tmp->value,strlen(tmp->value),FALSE); 357 400 VSIFCloseL(ifile); 358 OGRDataSource* ipoDS = OGRSFDriverRegistrar::Open(filename,FALSE); 401 #if GDAL_VERSION_MAJOR >= 2 402 GDALDataset *ipoDS = 403 (GDALDataset*) GDALOpenEx( filename, 404 GDAL_OF_READONLY | GDAL_OF_VECTOR, 405 NULL, NULL, NULL ); 406 GDALDriverManager* poR=GetGDALDriverManager(); 407 GDALDriver *poDriver = NULL; 408 #else 409 OGRDataSource* ipoDS = 410 OGRSFDriverRegistrar::Open(filename,FALSE); 411 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar(); 412 OGRSFDriver *poDriver = NULL; 413 #endif 359 414 char pszDestDataSource[100]; 360 415 if( ipoDS == NULL ) 361 416 { 362 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar();363 364 417 fprintf( stderr, "FAILURE:\n" 365 418 "Unable to open datasource `%s' with the following drivers.\n", 366 419 filename ); 367 420 char emessage[1024]; 368 421 for( int iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ ) 369 422 { 370 fprintf( stderr, " -> %s\n", poR->GetDriver(iDriver)->GetName() ); 423 #if GDAL_VERSION_MAJOR >=2 424 sprintf( emessage, "%s -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetDescription() ); 425 fprintf( stderr, " -> %s\n", poR->GetDriver(iDriver)->GetDescription() ); 426 #else 427 sprintf( emessage, "%s -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetName() ); 428 fprintf( stderr, " -> %s\n", poR->GetDriver(iDriver)->GetName() ); 429 #endif 371 430 } 372 431 char tmp[1024]; 373 sprintf(tmp,"Unable to open datasource `%s' with the following drivers. ",filename);432 sprintf(tmp,"Unable to open datasource `%s' with the following drivers.\n%s",filename,emessage); 374 433 setMapInMaps(conf,"lenv","message",tmp); 375 434 return SERVICE_FAILED; 376 435 } 436 377 437 for( int iLayer = 0; iLayer < ipoDS->GetLayerCount(); 378 438 iLayer++ ) … … 396 456 /* -------------------------------------------------------------------- */ 397 457 398 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar();399 OGRSFDriver *poDriver = NULL;400 458 int iDriver; 401 459 … … 414 472 iDriver++ ) 415 473 { 416 if( EQUAL(poR->GetDriver(iDriver)->GetName(),oDriver1) ) 474 475 if( EQUAL( 476 #if GDAL_VERSION_MAJOR >=2 477 poR->GetDriver(iDriver)->GetDescription() 478 #else 479 poR->GetDriver(iDriver)->GetName() 480 #endif 481 ,oDriver1) ) 417 482 { 418 483 poDriver = poR->GetDriver(iDriver); … … 425 490 sprintf( emessage, "Unable to find driver `%s'.\n", oDriver ); 426 491 sprintf( emessage, "%sThe following drivers are available:\n",emessage ); 427 428 for( iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ ) 429 { 492 for( iDriver = 0;iDriver < poR->GetDriverCount();iDriver++ ) 493 { 494 #if GDAL_VERSION_MAJOR >=2 495 sprintf( emessage, "%s -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetDescription() ); 496 #else 430 497 sprintf( emessage, "%s -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetName() ); 498 #endif 431 499 } 432 500 … … 436 504 } 437 505 438 if( !poDriver->TestCapability( ODrCCreateDataSource ) ){ 506 #if GDAL_VERSION_MAJOR >=2 507 if( !CPLTestBool( CSLFetchNameValueDef(poDriver->GetMetadata(), GDAL_DCAP_CREATE, "FALSE") ) ) 508 #else 509 if( !poDriver->TestCapability( ODrCCreateDataSource ) ) 510 #endif 511 { 439 512 char emessage[1024]; 440 513 sprintf( emessage, "%s driver does not support data source creation.\n", … … 449 522 //map* tpath=getMapFromMaps(conf,"main","tmpPath"); 450 523 char **papszDSCO=NULL; 524 #if GDAL_VERSION_MAJOR >=2 525 poODS = poDriver->Create( pszDestDataSource, 0, 0, 0, GDT_Unknown, papszDSCO ); 526 #else 451 527 poODS = poDriver->CreateDataSource( pszDestDataSource, papszDSCO ); 528 #endif 452 529 if( poODS == NULL ){ 453 530 char emessage[1024]; … … 471 548 } 472 549 473 //CPLErrorReset();474 550 475 551 poDstLayer = poODS->CreateLayer( "Result", NULL,wkbUnknown,NULL); … … 566 642 OGRLayer *poDstLayer; 567 643 const char *oDriver1; 568 OGRDataSource *poODS; 644 #if GDAL_VERSION_MAJOR >= 2 645 GDALDataset *poODS; 646 #else 647 OGRDataSource *poODS; 648 #endif 569 649 map* tmp=getMapFromMaps(inputs,"InputPolygon","value"); 570 650 if(!tmp){ … … 585 665 VSILFILE *ifile=VSIFileFromMemBuffer(filename,(GByte*)tmp->value,strlen(tmp->value),FALSE); 586 666 VSIFCloseL(ifile); 587 OGRDataSource* ipoDS = OGRSFDriverRegistrar::Open(filename,FALSE); 667 #if GDAL_VERSION_MAJOR >= 2 668 GDALDataset *ipoDS = 669 (GDALDataset*) GDALOpenEx( filename, 670 GDAL_OF_READONLY | GDAL_OF_VECTOR, 671 NULL, NULL, NULL ); 672 GDALDriverManager* poR=GetGDALDriverManager(); 673 GDALDriver *poDriver = NULL; 674 #else 675 OGRDataSource* ipoDS = 676 OGRSFDriverRegistrar::Open(filename,FALSE); 677 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar(); 678 OGRSFDriver *poDriver = NULL; 679 #endif 588 680 char pszDestDataSource[100]; 589 681 if( ipoDS == NULL ) 590 682 { 591 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar();592 683 593 684 fprintf( stderr, "FAILURE:\n" … … 597 688 for( int iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ ) 598 689 { 690 #if GDAL_VERSION_MAJOR >= 2 691 fprintf( stderr, " -> %s\n", poR->GetDriver(iDriver)->GetDescription() ); 692 #else 599 693 fprintf( stderr, " -> %s\n", poR->GetDriver(iDriver)->GetName() ); 694 #endif 600 695 } 601 696 char tmp[1024]; … … 625 720 /* -------------------------------------------------------------------- */ 626 721 627 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar();628 OGRSFDriver *poDriver = NULL;629 722 int iDriver; 630 723 … … 643 736 iDriver++ ) 644 737 { 738 #if GDAL_VERSION_MAJOR >=2 739 if( EQUAL(poR->GetDriver(iDriver)->GetDescription(),oDriver1) ) 740 #else 645 741 if( EQUAL(poR->GetDriver(iDriver)->GetName(),oDriver1) ) 742 #endif 646 743 { 647 744 poDriver = poR->GetDriver(iDriver); … … 657 754 for( iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ ) 658 755 { 756 #if GDAL_VERSION_MAJOR >=2 757 sprintf( emessage, "%s -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetDescription() ); 758 #else 659 759 sprintf( emessage, "%s -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetName() ); 760 #endif 660 761 } 661 762 … … 665 766 } 666 767 667 if( !poDriver->TestCapability( ODrCCreateDataSource ) ){ 768 #if GDAL_VERSION_MAJOR >=2 769 if( !CPLTestBool( CSLFetchNameValueDef(poDriver->GetMetadata(), GDAL_DCAP_CREATE, "FALSE") ) ) 770 #else 771 if( !poDriver->TestCapability( ODrCCreateDataSource ) ) 772 #endif 773 { 668 774 char emessage[1024]; 669 775 sprintf( emessage, "%s driver does not support data source creation.\n", … … 678 784 //map* tpath=getMapFromMaps(conf,"main","tmpPath"); 679 785 char **papszDSCO=NULL; 786 #if GDAL_VERSION_MAJOR >=2 787 poODS = poDriver->Create( pszDestDataSource, 0, 0, 0, GDT_Unknown, papszDSCO ); 788 #else 680 789 poODS = poDriver->CreateDataSource( pszDestDataSource, papszDSCO ); 790 #endif 681 791 if( poODS == NULL ){ 682 792 char emessage[1024]; … … 779 889 __declspec(dllexport) 780 890 #endif 781 int Boundary(maps*& conf,maps*& inputs,maps*& outputs){ 782 return applyOne(conf,inputs,outputs,&OGRGeometry::Boundary,"http://fooa/gml/3.1.0/polygon.xsd"); 783 } 784 785 #ifdef WIN32 786 __declspec(dllexport) 787 #endif 788 int ConvexHull(maps*& conf,maps*& inputs,maps*& outputs){ 789 return applyOne(conf,inputs,outputs,&OGRGeometry::ConvexHull,"http://fooa/gml/3.1.0/polygon.xsd"); 790 } 791 792 793 OGRDataSource* loadEntity(maps* conf,maps* inputs,char **filename,const char **oDriver,const char *entity,int iter){ 794 map* tmp=getMapFromMaps(inputs,entity,"value"); 795 map* tmp1=getMapFromMaps(inputs,entity,"mimeType"); 796 *oDriver="GeoJSON"; 797 sprintf(*filename,"/vsimem/input_%d.json",getpid()+iter); 798 if(tmp1!=NULL){ 799 if(strcmp(tmp1->value,"text/xml")==0){ 800 sprintf(*filename,"/vsimem/input_%d.xml",getpid()+iter); 801 *oDriver="GML"; 802 } 803 } 804 VSILFILE *ifile=VSIFileFromMemBuffer(*filename,(GByte*)tmp->value,strlen(tmp->value),FALSE); 805 VSIFCloseL(ifile); 806 return OGRSFDriverRegistrar::Open(*filename,FALSE); 807 } 808 809 int applyOneBool(maps*& conf,maps*& inputs,maps*& outputs,OGRBoolean (OGRGeometry::*myFunc)() const){ 810 #ifdef DEBUG 811 fprintf(stderr,"\nService internal print\n"); 812 #endif 891 int Centroid(maps*& conf,maps*& inputs,maps*& outputs){ 813 892 OGRRegisterAll(); 814 893 … … 817 896 OGRLayer *poDstLayer; 818 897 const char *oDriver1; 819 OGRDataSource *poODS; 820 #ifdef DEBUG 821 dumpMaps(cursor); 898 #if GDAL_VERSION_MAJOR >= 2 899 GDALDataset *poODS; 900 #else 901 OGRDataSource *poODS; 822 902 #endif 823 903 map* tmp=getMapFromMaps(inputs,"InputPolygon","value"); … … 839 919 VSILFILE *ifile=VSIFileFromMemBuffer(filename,(GByte*)tmp->value,strlen(tmp->value),FALSE); 840 920 VSIFCloseL(ifile); 841 OGRDataSource* ipoDS = OGRSFDriverRegistrar::Open(filename,FALSE); 921 #if GDAL_VERSION_MAJOR >= 2 922 GDALDataset *ipoDS = 923 (GDALDataset*) GDALOpenEx( filename, 924 GDAL_OF_READONLY | GDAL_OF_VECTOR, 925 NULL, NULL, NULL ); 926 GDALDriverManager* poR=GetGDALDriverManager(); 927 GDALDriver *poDriver = NULL; 928 #else 929 OGRDataSource* ipoDS = 930 OGRSFDriverRegistrar::Open(filename,FALSE); 931 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar(); 932 OGRSFDriver *poDriver = NULL; 933 #endif 842 934 char pszDestDataSource[100]; 843 935 if( ipoDS == NULL ) 844 936 { 845 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar();846 937 847 938 fprintf( stderr, "FAILURE:\n" … … 851 942 for( int iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ ) 852 943 { 944 #if GDAL_VERSION_MAJOR >= 2 945 fprintf( stderr, " -> %s\n", poR->GetDriver(iDriver)->GetDescription() ); 946 #else 853 947 fprintf( stderr, " -> %s\n", poR->GetDriver(iDriver)->GetName() ); 948 #endif 949 } 950 char tmp[1024]; 951 sprintf(tmp,"Unable to open datasource `%s' with the following drivers.",filename); 952 setMapInMaps(conf,"lenv","message",tmp); 953 return SERVICE_FAILED; 954 } 955 for( int iLayer = 0; iLayer < ipoDS->GetLayerCount(); 956 iLayer++ ) 957 { 958 OGRLayer *poLayer = ipoDS->GetLayer(iLayer); 959 960 if( poLayer == NULL ) 961 { 962 fprintf( stderr, "FAILURE: Couldn't fetch advertised layer %d!\n", 963 iLayer ); 964 char tmp[1024]; 965 sprintf(tmp,"Couldn't fetch advertised layer %d!",iLayer); 966 setMapInMaps(conf,"lenv","message",tmp); 967 return SERVICE_FAILED; 968 } 969 970 OGRFeature *poFeature; 971 972 /* -------------------------------------------------------------------- */ 973 /* Try opening the output datasource as an existing, writable */ 974 /* -------------------------------------------------------------------- */ 975 976 int iDriver; 977 978 map* tmpMap=getMapFromMaps(outputs,"Result","mimeType"); 979 oDriver1="GeoJSON"; 980 sprintf(pszDestDataSource,"/vsimem/result_%d.json",getpid()); 981 if(tmpMap!=NULL){ 982 if(strcmp(tmpMap->value,"text/xml")==0){ 983 sprintf(pszDestDataSource,"/vsimem/result_%d.xml",getpid()); 984 oDriver1="GML"; 985 } 986 } 987 988 for( iDriver = 0; 989 iDriver < poR->GetDriverCount() && poDriver == NULL; 990 iDriver++ ) 991 { 992 #if GDAL_VERSION_MAJOR >=2 993 if( EQUAL(poR->GetDriver(iDriver)->GetDescription(),oDriver1) ) 994 #else 995 if( EQUAL(poR->GetDriver(iDriver)->GetName(),oDriver1) ) 996 #endif 997 { 998 poDriver = poR->GetDriver(iDriver); 999 } 1000 } 1001 1002 if( poDriver == NULL ) 1003 { 1004 char emessage[8192]; 1005 sprintf( emessage, "Unable to find driver `%s'.\n", oDriver ); 1006 sprintf( emessage, "%sThe following drivers are available:\n",emessage ); 1007 1008 for( iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ ) 1009 { 1010 #if GDAL_VERSION_MAJOR >=2 1011 sprintf( emessage, "%s -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetDescription() ); 1012 #else 1013 sprintf( emessage, "%s -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetName() ); 1014 #endif 1015 } 1016 1017 setMapInMaps(conf,"lenv","message",emessage); 1018 return SERVICE_FAILED; 1019 1020 } 1021 1022 #if GDAL_VERSION_MAJOR >=2 1023 if( !CPLTestBool( CSLFetchNameValueDef(poDriver->GetMetadata(), GDAL_DCAP_CREATE, "FALSE") ) ) 1024 #else 1025 if( !poDriver->TestCapability( ODrCCreateDataSource ) ) 1026 #endif 1027 { 1028 char emessage[1024]; 1029 sprintf( emessage, "%s driver does not support data source creation.\n", 1030 "json" ); 1031 setMapInMaps(conf,"lenv","message",emessage); 1032 return SERVICE_FAILED; 1033 } 1034 1035 /* -------------------------------------------------------------------- */ 1036 /* Create the output data source. */ 1037 /* -------------------------------------------------------------------- */ 1038 //map* tpath=getMapFromMaps(conf,"main","tmpPath"); 1039 char **papszDSCO=NULL; 1040 #if GDAL_VERSION_MAJOR >=2 1041 poODS = poDriver->Create( pszDestDataSource, 0, 0, 0, GDT_Unknown, papszDSCO ); 1042 #else 1043 poODS = poDriver->CreateDataSource( pszDestDataSource, papszDSCO ); 1044 #endif 1045 if( poODS == NULL ){ 1046 char emessage[1024]; 1047 sprintf( emessage, "%s driver failed to create %s\n", 1048 "json", pszDestDataSource ); 1049 setMapInMaps(conf,"lenv","message",emessage); 1050 return SERVICE_FAILED; 1051 } 1052 1053 /* -------------------------------------------------------------------- */ 1054 /* Create the layer. */ 1055 /* -------------------------------------------------------------------- */ 1056 if( !poODS->TestCapability( ODsCCreateLayer ) ) 1057 { 1058 char emessage[1024]; 1059 sprintf( emessage, 1060 "Layer %s not found, and CreateLayer not supported by driver.", 1061 "Result" ); 1062 setMapInMaps(conf,"lenv","message",emessage); 1063 return SERVICE_FAILED; 1064 } 1065 1066 poDstLayer = poODS->CreateLayer( "Result", NULL,wkbUnknown,NULL); 1067 if( poDstLayer == NULL ){ 1068 setMapInMaps(conf,"lenv","message","Layer creation failed.\n"); 1069 return SERVICE_FAILED; 1070 } 1071 1072 OGRFeatureDefn *poFDefn = poLayer->GetLayerDefn(); 1073 int iField; 1074 int hasMmField=0; 1075 1076 for( iField = 0; iField < poFDefn->GetFieldCount(); iField++ ) 1077 { 1078 OGRFieldDefn *tmp=poFDefn->GetFieldDefn(iField); 1079 if (iField >= 0) 1080 poDstLayer->CreateField( poFDefn->GetFieldDefn(iField) ); 1081 else 1082 { 1083 fprintf( stderr, "Field '%s' not found in source layer.\n", 1084 iField ); 1085 return SERVICE_FAILED; 1086 } 1087 } 1088 1089 while(TRUE){ 1090 OGRFeature *poDstFeature = NULL; 1091 poFeature = poLayer->GetNextFeature(); 1092 if( poFeature == NULL ) 1093 break; 1094 if(poFeature->GetGeometryRef() != NULL){ 1095 poDstFeature = OGRFeature::CreateFeature( poDstLayer->GetLayerDefn() ); 1096 if( poDstFeature->SetFrom( poFeature, TRUE ) != OGRERR_NONE ) 1097 { 1098 char tmpMsg[1024]; 1099 sprintf( tmpMsg,"Unable to translate feature %ld from layer %s.\n", 1100 poFeature->GetFID(), poFDefn->GetName() ); 1101 1102 OGRFeature::DestroyFeature( poFeature ); 1103 OGRFeature::DestroyFeature( poDstFeature ); 1104 return SERVICE_FAILED; 1105 } 1106 OGRPoint* poPoint=new OGRPoint(); 1107 poDstFeature->GetGeometryRef()->Centroid(poPoint); 1108 if(poDstFeature->SetGeometryDirectly(poPoint)!= OGRERR_NONE ){ 1109 char tmpMsg[1024]; 1110 sprintf( tmpMsg,"Unable to translate feature %ld from layer %s.\n", 1111 poFeature->GetFID(), poFDefn->GetName() ); 1112 1113 OGRFeature::DestroyFeature( poFeature ); 1114 OGRFeature::DestroyFeature( poDstFeature ); 1115 return SERVICE_FAILED; 1116 } 1117 OGRFeature::DestroyFeature( poFeature ); 1118 if( poDstLayer->CreateFeature( poDstFeature ) != OGRERR_NONE ) 1119 { 1120 OGRFeature::DestroyFeature( poDstFeature ); 1121 return SERVICE_FAILED; 1122 } 1123 OGRFeature::DestroyFeature( poDstFeature ); 1124 } 1125 } 1126 1127 } 1128 1129 delete poODS; 1130 delete ipoDS; 1131 1132 char *res1=readVSIFile(conf,pszDestDataSource); 1133 if(res1==NULL) 1134 return SERVICE_FAILED; 1135 setMapInMaps(outputs,"Result","value",res1); 1136 free(res1); 1137 1138 OGRCleanupAll(); 1139 return SERVICE_SUCCEEDED; 1140 1141 } 1142 1143 #ifdef WIN32 1144 __declspec(dllexport) 1145 #endif 1146 int Boundary(maps*& conf,maps*& inputs,maps*& outputs){ 1147 return applyOne(conf,inputs,outputs,&OGRGeometry::Boundary,"http://fooa/gml/3.1.0/polygon.xsd"); 1148 } 1149 1150 #ifdef WIN32 1151 __declspec(dllexport) 1152 #endif 1153 int ConvexHull(maps*& conf,maps*& inputs,maps*& outputs){ 1154 return applyOne(conf,inputs,outputs,&OGRGeometry::ConvexHull,"http://fooa/gml/3.1.0/polygon.xsd"); 1155 } 1156 1157 #if GDAL_VERSION_MAJOR >= 2 1158 GDALDataset* 1159 #else 1160 OGRDataSource* 1161 #endif 1162 loadEntity(maps* conf,maps* inputs,char **filename,const char **oDriver,const char *entity,int iter){ 1163 map* tmp=getMapFromMaps(inputs,entity,"value"); 1164 map* tmp1=getMapFromMaps(inputs,entity,"mimeType"); 1165 *oDriver="GeoJSON"; 1166 sprintf(*filename,"/vsimem/input_%d.json",getpid()+iter); 1167 if(tmp1!=NULL){ 1168 if(strcmp(tmp1->value,"text/xml")==0){ 1169 sprintf(*filename,"/vsimem/input_%d.xml",getpid()+iter); 1170 *oDriver="GML"; 1171 } 1172 } 1173 VSILFILE *ifile=VSIFileFromMemBuffer(*filename,(GByte*)tmp->value,strlen(tmp->value),FALSE); 1174 VSIFCloseL(ifile); 1175 #if GDAL_VERSION_MAJOR >= 2 1176 return (GDALDataset*) GDALOpenEx( *filename, 1177 GDAL_OF_READONLY | GDAL_OF_VECTOR, 1178 NULL, NULL, NULL ); 1179 #else 1180 return OGRSFDriverRegistrar::Open(*filename,FALSE); 1181 #endif 1182 } 1183 1184 int applyOneBool(maps*& conf,maps*& inputs,maps*& outputs,OGRBoolean (OGRGeometry::*myFunc)() const){ 1185 #ifdef DEBUG 1186 fprintf(stderr,"\nService internal print\n"); 1187 #endif 1188 OGRRegisterAll(); 1189 1190 maps* cursor=inputs; 1191 OGRGeometryH geometry,res; 1192 OGRLayer *poDstLayer; 1193 const char *oDriver1; 1194 OGRDataSource *poODS; 1195 #ifdef DEBUG 1196 dumpMaps(cursor); 1197 #endif 1198 map* tmp=getMapFromMaps(inputs,"InputPolygon","value"); 1199 if(!tmp){ 1200 setMapInMaps(conf,"lenv","message",_ss("Unable to parse the input geometry from InputPolygon")); 1201 return SERVICE_FAILED; 1202 } 1203 char filename[1024]; 1204 map* tmp1=getMapFromMaps(inputs,"InputPolygon","mimeType"); 1205 const char *oDriver; 1206 oDriver="GeoJSON"; 1207 sprintf(filename,"/vsimem/input_%d.json",getpid()); 1208 if(tmp1!=NULL){ 1209 if(strcmp(tmp1->value,"text/xml")==0){ 1210 sprintf(filename,"/vsimem/input_%d.xml",getpid()); 1211 oDriver="GML"; 1212 } 1213 } 1214 VSILFILE *ifile=VSIFileFromMemBuffer(filename,(GByte*)tmp->value,strlen(tmp->value),FALSE); 1215 VSIFCloseL(ifile); 1216 1217 #if GDAL_VERSION_MAJOR >= 2 1218 GDALDataset *ipoDS = 1219 (GDALDataset*) GDALOpenEx( filename, 1220 GDAL_OF_READONLY | GDAL_OF_VECTOR, 1221 NULL, NULL, NULL ); 1222 GDALDriverManager* poR=GetGDALDriverManager(); 1223 GDALDriver *poDriver = NULL; 1224 #else 1225 OGRDataSource* ipoDS = 1226 OGRSFDriverRegistrar::Open(filename,FALSE); 1227 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar(); 1228 OGRSFDriver *poDriver = NULL; 1229 #endif 1230 char pszDestDataSource[100]; 1231 if( ipoDS == NULL ) 1232 { 1233 fprintf( stderr, "FAILURE:\n" 1234 "Unable to open datasource `%s' with the following drivers.\n", 1235 filename ); 1236 1237 for( int iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ ) 1238 { 1239 #if GDAL_VERSION_MAJOR >= 2 1240 fprintf( stderr, " -> %s\n", poR->GetDriver(iDriver)->GetDescription() ); 1241 #else 1242 fprintf( stderr, " -> %s\n", poR->GetDriver(iDriver)->GetName() ); 1243 #endif 854 1244 } 855 1245 char tmp[1024]; … … 933 1323 OGRLayer *poDstLayer; 934 1324 //const char *oDriver1; 935 OGRDataSource *poODS;936 1325 #ifdef DEBUG 937 1326 dumpMaps(cursor); … … 940 1329 char *filename=(char*)malloc(1024*sizeof(char)); 941 1330 const char *oDriver1; 942 OGRDataSource* ipoDS1 = loadEntity(conf,inputs,&filename,&oDriver1,"InputEntity1",1); 943 1331 #if GDAL_VERSION_MAJOR >= 2 1332 GDALDataset* 1333 #else 1334 OGRDataSource* 1335 #endif 1336 ipoDS1 = loadEntity(conf,inputs,&filename,&oDriver1,"InputEntity1",1); 944 1337 char *filename1=(char*)malloc(1024*sizeof(char)); 945 1338 const char *oDriver2; 946 OGRDataSource* ipoDS2 = loadEntity(conf,inputs,&filename1,&oDriver2,"InputEntity2",2); 1339 #if GDAL_VERSION_MAJOR >= 2 1340 GDALDataset* 1341 #else 1342 OGRDataSource* 1343 #endif 1344 ipoDS2 = loadEntity(conf,inputs,&filename1,&oDriver2,"InputEntity2",2); 947 1345 const char *oDriver3; 948 1346 char pszDestDataSource[100]; 1347 #if GDAL_VERSION_MAJOR >= 2 1348 GDALDriverManager* poR=GetGDALDriverManager(); 1349 GDALDriver *poDriver = NULL; 1350 GDALDataset *poODS; 1351 #else 1352 OGRDataSource *poODS; 1353 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar(); 1354 OGRSFDriver *poDriver = NULL; 1355 #endif 949 1356 if( ipoDS1 == NULL || ipoDS2 == NULL ) 950 1357 { 951 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar();952 1358 953 1359 fprintf( stderr, "FAILURE:\n" … … 957 1363 for( int iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ ) 958 1364 { 1365 #if GDAL_VERSION_MAJOR >= 2 1366 fprintf( stderr, " -> %s\n", poR->GetDriver(iDriver)->GetDescription() ); 1367 #else 959 1368 fprintf( stderr, " -> %s\n", poR->GetDriver(iDriver)->GetName() ); 1369 #endif 960 1370 } 961 1371 char tmp[1024]; … … 1003 1413 /* -------------------------------------------------------------------- */ 1004 1414 1005 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar();1006 OGRSFDriver *poDriver = NULL;1007 1415 int iDriver; 1008 1416 … … 1021 1429 iDriver++ ) 1022 1430 { 1023 #ifdef DEBUG 1024 fprintf(stderr,"D:%s\n",poR->GetDriver(iDriver)->GetName()); 1025 #endif 1026 if( EQUAL(poR->GetDriver(iDriver)->GetName(),oDriver3) ) 1431 #if GDAL_VERSION_MAJOR >=2 1432 if( EQUAL(poR->GetDriver(iDriver)->GetDescription(),oDriver1) ) 1433 #else 1434 if( EQUAL(poR->GetDriver(iDriver)->GetName(),oDriver1) ) 1435 #endif 1027 1436 { 1028 1437 poDriver = poR->GetDriver(iDriver); … … 1038 1447 for( iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ ) 1039 1448 { 1449 #if GDAL_VERSION_MAJOR >= 2 1450 sprintf( emessage, "%s -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetDescription() ); 1451 #else 1040 1452 sprintf( emessage, "%s -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetName() ); 1453 #endif 1041 1454 } 1042 1455 … … 1046 1459 } 1047 1460 1048 if( !poDriver->TestCapability( ODrCCreateDataSource ) ){ 1049 char emessage[1024]; 1050 sprintf( emessage, "%s driver does not support data source creation.\n", 1051 "json" ); 1052 setMapInMaps(conf,"lenv","message",emessage); 1053 return SERVICE_FAILED; 1054 } 1461 #if GDAL_VERSION_MAJOR >= 2 1462 if( !CPLTestBool( CSLFetchNameValueDef(poDriver->GetMetadata(), GDAL_DCAP_CREATE, "FALSE") ) ) 1463 #else 1464 if( !poDriver->TestCapability( ODrCCreateDataSource ) ) 1465 #endif 1466 { 1467 char emessage[1024]; 1468 sprintf( emessage, "%s driver does not support data source creation.\n", 1469 "json" ); 1470 setMapInMaps(conf,"lenv","message",emessage); 1471 return SERVICE_FAILED; 1472 } 1055 1473 1056 1474 /* -------------------------------------------------------------------- */ … … 1059 1477 //map* tpath=getMapFromMaps(conf,"main","tmpPath"); 1060 1478 char **papszDSCO=NULL; 1479 #if GDAL_VERSION_MAJOR >= 2 1480 poODS = poDriver->Create( pszDestDataSource, 0, 0, 0, GDT_Unknown, papszDSCO ); 1481 #else 1061 1482 poODS = poDriver->CreateDataSource( pszDestDataSource, papszDSCO ); 1483 #endif 1062 1484 if( poODS == NULL ){ 1063 1485 char emessage[1024]; … … 1204 1626 OGRGeometryH geometry,res; 1205 1627 OGRLayer *poDstLayer; 1206 OGRDataSource *poODS; 1628 #if GDAL_VERSION_MAJOR >= 2 1629 GDALDataset *poODS; 1630 #else 1631 OGRDataSource *poODS; 1632 #endif 1207 1633 1208 1634 char *filename=(char*)malloc(1024*sizeof(char)); 1209 1635 const char *oDriver1; 1210 OGRDataSource* ipoDS1 = loadEntity(conf,inputs,&filename,&oDriver1,"InputEntity1",1); 1636 #if GDAL_VERSION_MAJOR >= 2 1637 GDALDataset* 1638 #else 1639 OGRDataSource* 1640 #endif 1641 ipoDS1 = loadEntity(conf,inputs,&filename,&oDriver1,"InputEntity1",1); 1211 1642 1212 1643 char *filename1=(char*)malloc(1024*sizeof(char)); 1213 1644 const char *oDriver2; 1214 OGRDataSource* ipoDS2 = loadEntity(conf,inputs,&filename1,&oDriver2,"InputEntity2",2); 1645 #if GDAL_VERSION_MAJOR >= 2 1646 GDALDataset* 1647 #else 1648 OGRDataSource* 1649 #endif 1650 ipoDS2 = loadEntity(conf,inputs,&filename1,&oDriver2,"InputEntity2",2); 1215 1651 const char *oDriver3; 1216 1652 char pszDestDataSource[100]; 1653 #if GDAL_VERSION_MAJOR >= 2 1654 GDALDriverManager* poR=GetGDALDriverManager(); 1655 GDALDriver *poDriver = NULL; 1656 #else 1657 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar(); 1658 OGRSFDriver *poDriver = NULL; 1659 #endif 1660 1217 1661 if( ipoDS1 == NULL || ipoDS2 == NULL ) 1218 1662 { 1219 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar();1220 1221 1663 fprintf( stderr, "FAILURE:\n" 1222 1664 "Unable to open datasource `%s' with the following drivers.\n", … … 1225 1667 for( int iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ ) 1226 1668 { 1669 #if GDAL_VERSION_MAJOR >= 2 1670 fprintf( stderr, " -> %s\n", poR->GetDriver(iDriver)->GetDescription() ); 1671 #else 1227 1672 fprintf( stderr, " -> %s\n", poR->GetDriver(iDriver)->GetName() ); 1673 #endif 1228 1674 } 1229 1675 char tmp[1024]; -
trunk/zoo-project/zoo-services/ogr/ogr2ogr/service.c
r395 r766 33 33 #include "cpl_string.h" 34 34 #include "ogr_api.h" 35 #if GDAL_VERSION_MAJOR >= 2 36 #include <gdal_priv.h> 37 #endif 35 38 #ifdef ZOO_SERVICE 36 39 #include "service.h" … … 50 53 static void Usage(); 51 54 52 static int TranslateLayer( OGRDataSource *poSrcDS, 53 OGRLayer * poSrcLayer, 54 OGRDataSource *poDstDS, 55 char ** papszLSCO, 56 const char *pszNewLayerName, 57 int bTransform, 58 OGRSpatialReference *poOutputSRS, 59 OGRSpatialReference *poSourceSRS, 60 char **papszSelFields, 61 int bAppend, int eGType, 62 int bOverwrite, 63 double dfMaxSegmentLength); 64 55 static int TranslateLayer( 56 #if GDAL_VERSION_MAJOR >= 2 57 GDALDataset 58 #else 59 OGRDataSource 60 #endif 61 *poSrcDS, 62 OGRLayer * poSrcLayer, 63 #if GDAL_VERSION_MAJOR >= 2 64 GDALDataset 65 #else 66 OGRDataSource 67 #endif 68 *poDstDS, 69 char ** papszLSCO, 70 const char *pszNewLayerName, 71 int bTransform, 72 OGRSpatialReference *poOutputSRS, 73 OGRSpatialReference *poSourceSRS, 74 char **papszSelFields, 75 int bAppend, int eGType, 76 int bOverwrite, 77 double dfMaxSegmentLength 78 ); 79 65 80 static int bSkipFailures = FALSE; 66 81 static int nGroupTransactions = 200; … … 575 590 /* Open data source. */ 576 591 /* -------------------------------------------------------------------- */ 577 OGRDataSource *poDS; 578 579 poDS = OGRSFDriverRegistrar::Open( pszDataSource, FALSE ); 592 #if GDAL_VERSION_MAJOR >= 2 593 GDALDataset *poDS; 594 GDALDataset *poODS; 595 GDALDriverManager* poR=GetGDALDriverManager(); 596 GDALDriver *poDriver = NULL; 597 #else 598 OGRDataSource* poDS; 599 OGRDataSource *poODS; 600 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar(); 601 OGRSFDriver *poDriver = NULL; 602 #endif 580 603 581 604 /* -------------------------------------------------------------------- */ … … 584 607 if( poDS == NULL ) 585 608 { 586 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar();587 588 609 fprintf( stderr, "FAILURE:\n" 589 610 "Unable to open datasource `%s' with the following drivers.\n", … … 592 613 for( int iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ ) 593 614 { 594 fprintf( stderr, " -> %s\n", poR->GetDriver(iDriver)->GetName() ); 615 #if GDAL_VERSION_MAJOR >= 2 616 fprintf( stderr, " -> %s\n", poR->GetDriver(iDriver)->GetDescription() ); 617 #else 618 fprintf( stderr, " -> %s\n", poR->GetDriver(iDriver)->GetName() ); 619 #endif 595 620 } 596 621 #ifdef ZOO_SERVICE … … 607 632 /* Try opening the output datasource as an existing, writable */ 608 633 /* -------------------------------------------------------------------- */ 609 OGRDataSource *poODS;610 611 634 if( bUpdate ) 612 635 { 613 poODS = OGRSFDriverRegistrar::Open( pszDestDataSource, TRUE ); 636 poODS = 637 #if GDAL_VERSION_MAJOR >= 2 638 (GDALDataset*) GDALOpenEx( pszDestDataSource, 639 GDAL_OF_UPDATE | GDAL_OF_VECTOR, 640 NULL, NULL, NULL ) 641 #else 642 OGRSFDriverRegistrar::Open( pszDestDataSource, TRUE ) 643 #endif 644 ; 614 645 if( poODS == NULL ) 615 646 { … … 639 670 else 640 671 { 641 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar();642 OGRSFDriver *poDriver = NULL;643 672 int iDriver; 644 673 … … 647 676 iDriver++ ) 648 677 { 649 if( EQUAL(poR->GetDriver(iDriver)->GetName(),pszFormat) ) 678 #if GDAL_VERSION_MAJOR >=2 679 if( EQUAL(poR->GetDriver(iDriver)->GetDescription(),pszFormat) ) 680 #else 681 if( EQUAL(poR->GetDriver(iDriver)->GetName(),pszFormat) ) 682 #endif 650 683 { 651 684 poDriver = poR->GetDriver(iDriver); … … 660 693 for( iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ ) 661 694 { 662 fprintf( stderr, " -> `%s'\n", poR->GetDriver(iDriver)->GetName() ); 695 #if GDAL_VERSION_MAJOR >= 2 696 fprintf( stderr, " -> %s\n", poR->GetDriver(iDriver)->GetDescription() ); 697 #else 698 fprintf( stderr, " -> %s\n", poR->GetDriver(iDriver)->GetName() ); 699 #endif 663 700 } 664 701 #ifdef ZOO_SERVICE … … 672 709 } 673 710 674 if( !poDriver->TestCapability( ODrCCreateDataSource ) ) 711 #if GDAL_VERSION_MAJOR >=2 712 if( !CPLTestBool( CSLFetchNameValueDef(poDriver->GetMetadata(), GDAL_DCAP_CREATE, "FALSE") ) ) 713 #else 714 if( !poDriver->TestCapability( ODrCCreateDataSource ) ) 715 #endif 675 716 { 676 717 fprintf( stderr, "%s driver does not support data source creation.\n", … … 689 730 /* Create the output data source. */ 690 731 /* -------------------------------------------------------------------- */ 691 poODS = poDriver->CreateDataSource( pszDestDataSource, papszDSCO ); 732 #if GDAL_VERSION_MAJOR >=2 733 poODS = poDriver->Create( pszDestDataSource, 0, 0, 0, GDT_Unknown, papszDSCO ); 734 #else 735 poODS = poDriver->CreateDataSource( pszDestDataSource, papszDSCO ); 736 #endif 692 737 if( poODS == NULL ) 693 738 { … … 887 932 888 933 { 889 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar(); 934 #if GDAL_VERSION_MAJOR >= 2 935 GDALDataset *poDS; 936 GDALDataset *poODS; 937 GDALDriverManager* poR=GetGDALDriverManager(); 938 GDALDriver *poDriver = NULL; 939 #else 940 OGRDataSource* poDS; 941 OGRDataSource *poODS; 942 OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar(); 943 OGRSFDriver *poDriver = NULL; 944 #endif 890 945 891 946 #ifdef ZOO_SERVICE … … 908 963 for( int iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ ) 909 964 { 910 OGRSFDriver *poDriver = poR->GetDriver(iDriver); 911 912 if( poDriver->TestCapability( ODrCCreateDataSource ) ) 913 printf( " -f \"%s\"\n", poDriver->GetName() ); 965 poDriver = poR->GetDriver(iDriver); 966 967 #if GDAL_VERSION_MAJOR >=2 968 if( !CPLTestBool( CSLFetchNameValueDef(poDriver->GetMetadata(), GDAL_DCAP_CREATE, "FALSE") ) ) 969 #else 970 if( !poDriver->TestCapability( ODrCCreateDataSource ) ) 971 #endif 972 #if GDAL_VERSION_MAJOR >= 2 973 fprintf( stderr, " -> %s\n", poDriver->GetDescription() ); 974 #else 975 fprintf( stderr, " -> %s\n", poDriver->GetName() ); 976 #endif 914 977 } 915 978 … … 962 1025 /************************************************************************/ 963 1026 964 static int TranslateLayer( OGRDataSource *poSrcDS, 965 OGRLayer * poSrcLayer, 966 OGRDataSource *poDstDS, 967 char **papszLCO, 968 const char *pszNewLayerName, 969 int bTransform, 970 OGRSpatialReference *poOutputSRS, 971 OGRSpatialReference *poSourceSRS, 972 char **papszSelFields, 973 int bAppend, int eGType, int bOverwrite, 974 double dfMaxSegmentLength) 1027 static int TranslateLayer( 1028 #if GDAL_VERSION_MAJOR >= 2 1029 GDALDataset 1030 #else 1031 OGRDataSource 1032 #endif 1033 *poSrcDS, 1034 OGRLayer * poSrcLayer, 1035 #if GDAL_VERSION_MAJOR >= 2 1036 GDALDataset 1037 #else 1038 OGRDataSource 1039 #endif 1040 *poDstDS, 1041 char **papszLCO, 1042 const char *pszNewLayerName, 1043 int bTransform, 1044 OGRSpatialReference *poOutputSRS, 1045 OGRSpatialReference *poSourceSRS, 1046 char **papszSelFields, 1047 int bAppend, int eGType, int bOverwrite, 1048 double dfMaxSegmentLength) 975 1049 976 1050 {
Note: See TracChangeset
for help on using the changeset viewer.