这篇教程C++ GDALVersionInfo函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GDALVersionInfo函数的典型用法代码示例。如果您正苦于以下问题:C++ GDALVersionInfo函数的具体用法?C++ GDALVersionInfo怎么用?C++ GDALVersionInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GDALVersionInfo函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: wxStringbool wxGISApplicationEx::SetupSys(const wxString &sSysPath){ if(!wxGISApplication::SetupSys(sSysPath)) return false;#ifdef __WINDOWS__ wxString sGdalDataDir = sSysPath + wxFileName::GetPathSeparator() + wxString(wxT("gdal")) + wxFileName::GetPathSeparator(); CPLSetConfigOption("GDAL_DATA", sGdalDataDir.ToUTF8() ); #ifdef wxGIS_USE_PROJ sGdalDataDir = sSysPath + wxFileName::GetPathSeparator() + wxString(wxT("proj")) + wxFileName::GetPathSeparator(); //CPLSetConfigOption("PROJ_LIB", sGdalDataDir.mb_str(wxConvUTF8) ); CPLString pszPROJ_LIB(sGdalDataDir.mb_str(wxConvUTF8)); const char *path = pszPROJ_LIB.c_str(); pj_set_searchpath(1, &path); #endif // wxGIS_USE_PROJ#endif // __WINDOWS__#ifdef __UNIX__ wxString sGdalDataGCS = wxString::Format(wxT("/usr/share/gdal/%s/gcs.csv"), GDALVersionInfo("RELEASE_NAME")); if(!wxFileName::FileExists(sGdalDataGCS)) { sGdalDataGCS = wxString(wxT("/usr/share/gdal/gcs.csv")); if(!wxFileName::FileExists(sGdalDataGCS)) { sGdalDataGCS = wxString::Format(wxT("/usr/local/share/gdal/%s/gcs.csv"), GDALVersionInfo("RELEASE_NAME")); if(!wxFileName::FileExists(sGdalDataGCS)) { sGdalDataGCS = wxString(wxT("/usr/local/share/gdal/gcs.csv")); if(!wxFileName::FileExists(sGdalDataGCS)) { return false; } } } } wxFileName Name(sGdalDataGCS); CPLSetConfigOption("GDAL_DATA", Name.GetPath().ToUTF8() ); //TODO: set path to proj lib #ifdef wxGIS_USE_PROJ #endif // wxGIS_USE_PROJ#endif //__UNIX__#ifndef CPL_RECODE_ICONV //the gdal compiled without iconv support //we should recode string by ourselthes CPLSetConfigOption("SHAPE_ENCODING", CPL_ENC_ASCII); CPLSetConfigOption("DXF_ENCODING", CPL_ENC_ASCII);#endif //CPL_RECODE_ICONV return true;}
开发者ID:GimpoByte,项目名称:nextgismanager,代码行数:50,
示例2: debugInformationstd::string debugInformation(){ Utils::screenWidth(); std::string headline(Utils::screenWidth(), '-'); std::ostringstream os; os << headline << std::endl; os << "PDAL debug information" << std::endl ; os << headline << std::endl << std::endl; os << "Version information" << std::endl; os << headline << std::endl; os << "(" << fullVersionString() << ")" << std::endl; os << std::endl; os << "Debug build status" << std::endl; os << headline << std::endl; os << PDAL_BUILD_TYPE << std::endl << std::endl; os << "Enabled libraries" << std::endl; os << headline << std::endl << std::endl; os << "GDAL (" << GDALVersionInfo("RELEASE_NAME") << ") - " << "http://www.gdal.org" << std::endl;#ifdef PDAL_HAVE_LIBXML2 os << "libxml (" << LIBXML_DOTTED_VERSION << ") - " << "http://www.xmlsoft.org/" << std::endl;#endif return os.str();}
开发者ID:PDAL,项目名称:PDAL,代码行数:33,
示例3: Usagestatic void Usage(){ int iDr; printf( "Usage: gdalasyncread [--help-general]/n" " [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64//n" " CInt16/CInt32/CFloat32/CFloat64}]/n" " [-of format] [-b band]/n" " [-outsize xsize[%%] ysize[%%]]/n" " [-srcwin xoff yoff xsize ysize]/n" " [-co /"NAME=VALUE/"]* [-ao /"NAME=VALUE/"]/n" " [-to timeout] [-multi]/n" " src_dataset dst_dataset/n/n" ); printf( "%s/n/n", GDALVersionInfo( "--version" ) ); printf( "The following format drivers are configured and support output:/n" ); for( iDr = 0; iDr < GDALGetDriverCount(); iDr++ ) { GDALDriverH hDriver = GDALGetDriver(iDr); if( GDALGetMetadataItem( hDriver, GDAL_DCAP_CREATE, NULL ) != NULL || GDALGetMetadataItem( hDriver, GDAL_DCAP_CREATECOPY, NULL ) != NULL ) { printf( " %s: %s/n", GDALGetDriverShortName( hDriver ), GDALGetDriverLongName( hDriver ) ); } }}
开发者ID:rouault,项目名称:gdal,代码行数:31,
示例4: QStringvoid Hoot::_init(){# ifdef TGS_HAVE_LIBSTXXL // initialize the environment variable for loading STXXL configuration. If the environment // variable has already been set then don't overwrite it (that is the 0 at the end). QString stxxlConf = QString(getenv("HOOT_HOME")) + "/conf/stxxl.conf"; Tgs::Stxxl::getInstance().setConfig(stxxlConf);# endif SignalCatcher::registerHandlers(); Log::getInstance().setLevel(Log::Info); // make sure our GDAL versions are consistent. const char* gdalVersion = GDALVersionInfo("RELEASE_NAME"); if (gdalVersion != QString(GDAL_RELEASE_NAME)) { LOG_ERROR("GDAL Version mismatch. Runtime: " << gdalVersion << " Build time: " << GDAL_RELEASE_NAME); } std::string geosVersion = geos::geom::geosversion(); if (QString::fromStdString(geosVersion) != QString(GEOS_VERSION)) { LOG_ERROR("GEOS Version mismatch. Runtime: " << geosVersion << " Build time: " << GEOS_VERSION); } reinit();}
开发者ID:BSteine,项目名称:hootenanny,代码行数:30,
示例5: Usagestatic void Usage(){ int iDr; printf("Usage: gdal_translate [--help-general]/n" " [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64//n" " CInt16/CInt32/CFloat32/CFloat64}] [-strict]/n" " [-of format] [-b band] [-mask band] [-expand {gray|rgb|rgba}]/n" " [-outsize xsize[%%] ysize[%%]]/n" " [-unscale] [-scale [src_min src_max [dst_min dst_max]]]/n" " [-srcwin xoff yoff xsize ysize] [-projwin ulx uly lrx lry]/n" " [-a_srs srs_def] [-a_ullr ulx uly lrx lry] [-a_nodata value]/n" " [-gcp pixel line easting northing [elevation]]*/n" " [-mo /"META-TAG=VALUE/"]* [-q] [-sds]/n" " [-co /"NAME=VALUE/"]* [-stats]/n" " src_dataset dst_dataset/n/n"); printf("%s/n/n", GDALVersionInfo("--version")); printf("The following format drivers are configured and support output:/n"); for (iDr = 0; iDr < GDALGetDriverCount(); iDr++) { GDALDriverH hDriver = GDALGetDriver(iDr); if (GDALGetMetadataItem(hDriver, GDAL_DCAP_CREATE, NULL) != NULL || GDALGetMetadataItem(hDriver, GDAL_DCAP_CREATECOPY, NULL) != NULL) { printf(" %s: %s/n", GDALGetDriverShortName(hDriver), GDALGetDriverLongName(hDriver)); } }}
开发者ID:hyyh619,项目名称:OpenSceneGraph-3.4.0,代码行数:35,
示例6: CPLSetConfigOption ERMsg COGRBaseOption::ParseOption(int argc, char* argv[]) { ERMsg msg; // Must process GDAL_SKIP before GDALAllRegister(), but we can't call // GDALGeneralCmdLineProcessor before it needs the drivers to be registered // for the --format or --formats options for (int i = 1; i < argc; i++) { if (IsEqual(argv[i], "--config") && i + 2 < argc && IsEqual(argv[i + 1], "GDAL_SKIP")) { CPLSetConfigOption(argv[i + 1], argv[i + 2]); i += 2; } } // -------------------------------------------------------------------- // Register standard GDAL drivers, and process generic GDAL // command options. // -------------------------------------------------------------------- OGRRegisterAll(); argc = OGRGeneralCmdLineProcessor(argc, &argv, 0); if (argc < 1) exit(-argc); // -------------------------------------------------------------------- // Parse arguments. // -------------------------------------------------------------------- for (int i = 1; i < argc; i++) { msg += ProcessOption(i, argc, argv); } if (m_bVersion) { string error = Format("%s was compiled against GDAL %s and is running against GDAL %s/n", argv[0], GDAL_RELEASE_NAME, GDALVersionInfo("RELEASE_NAME")); msg.ajoute(error); //return msg; } if (m_bNeedHelp) { msg.ajoute(GetUsage()); msg.ajoute(GetHelp()); //return msg; } return msg; }
开发者ID:RNCan,项目名称:WeatherBasedSimulationFramework,代码行数:52,
示例7: OGR2SQLITE_ogr_versionstaticvoid OGR2SQLITE_ogr_version(sqlite3_context* pContext, int argc, sqlite3_value** argv){ if( argc == 0 || sqlite3_value_type (argv[0]) != SQLITE_TEXT ) { sqlite3_result_text( pContext, GDAL_RELEASE_NAME, -1, SQLITE_STATIC ); } else { sqlite3_result_text( pContext, GDALVersionInfo((const char*)sqlite3_value_text(argv[0])), -1, SQLITE_TRANSIENT ); }}
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:15,
示例8: Usagestatic void Usage(const char* pszErrorMsg, int bShort){ printf( "Usage: gdal_translate [--help-general] [--long-usage]/n" " [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64//n" " CInt16/CInt32/CFloat32/CFloat64}] [-strict]/n" " [-of format] [-b band] [-mask band] [-expand {gray|rgb|rgba}]/n" " [-outsize xsize[%%]|0 ysize[%%]|0] [-tr xres yres]/n" " [-r {nearest,bilinear,cubic,cubicspline,lanczos,average,mode}]/n" " [-unscale] [-scale[_bn] [src_min src_max [dst_min dst_max]]]* [-exponent[_bn] exp_val]*/n" " [-srcwin xoff yoff xsize ysize] [-epo] [-eco]/n" " [-projwin ulx uly lrx lry] [-projwin_srs srs_def]/n" " [-a_srs srs_def] [-a_ullr ulx uly lrx lry] [-a_nodata value]/n" " [-a_scale value] [-a_offset value]/n" " [-gcp pixel line easting northing [elevation]]*/n" " |-colorinterp{_bn} {red|green|blue|alpha|gray|undefined}]/n" " |-colorinterp {red|green|blue|alpha|gray|undefined},...]/n" " [-mo /"META-TAG=VALUE/"]* [-q] [-sds]/n" " [-co /"NAME=VALUE/"]* [-stats] [-norat]/n" " [-oo NAME=VALUE]*/n" " src_dataset dst_dataset/n" ); if( !bShort ) { printf( "/n%s/n/n", GDALVersionInfo( "--version" ) ); printf( "The following format drivers are configured and support output:/n" ); for( int iDr = 0; iDr < GDALGetDriverCount(); iDr++ ) { GDALDriverH hDriver = GDALGetDriver(iDr); if( GDALGetMetadataItem( hDriver, GDAL_DCAP_RASTER, nullptr) != nullptr && (GDALGetMetadataItem( hDriver, GDAL_DCAP_CREATE, nullptr ) != nullptr || GDALGetMetadataItem( hDriver, GDAL_DCAP_CREATECOPY, nullptr ) != nullptr) ) { printf( " %s: %s/n", GDALGetDriverShortName( hDriver ), GDALGetDriverLongName( hDriver ) ); } } } if( pszErrorMsg != nullptr ) fprintf(stderr, "/nFAILURE: %s/n", pszErrorMsg); exit(1);}
开发者ID:AsgerPetersen,项目名称:gdal,代码行数:46,
示例9: GetFullVersionString/// Tell the user a bit about PDAL's compilationstd::string GetFullVersionString(){ std::ostringstream os;#ifdef PDAL_HAVE_LIBGEOTIFF os << " GeoTIFF " << (LIBGEOTIFF_VERSION / 1000) << '.' << (LIBGEOTIFF_VERSION / 100 % 10) << '.' << (LIBGEOTIFF_VERSION % 100 / 10);#endif#ifdef PDAL_HAVE_GDAL os << " GDAL " << GDALVersionInfo("RELEASE_NAME");#endif#ifdef PDAL_HAVE_LASZIP os << " LASzip " << LASZIP_VERSION_MAJOR << "." << LASZIP_VERSION_MINOR << "." << LASZIP_VERSION_REVISION;#endif if (IsEmbeddedBoost()) os << " Embed "; else os << " System "; std::string info(os.str()); os.str(""); os << "PDAL " << PDAL_VERSION_STRING; std::ostringstream revs; revs << g_GIT_SHA1; os << " (" << revs.str().substr(0, 6) <<")"; if (!info.empty()) { os << " with" << info; } return os.str();}
开发者ID:AsherBond,项目名称:PDAL,代码行数:46,
示例10: Usagestatic void Usage(){ printf( "Usage: gdalenhance [--help-general]/n" " [-of format] [-co /"NAME=VALUE/"]*/n" " [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64//n" " CInt16/CInt32/CFloat32/CFloat64}]/n" " [-src_scale[_n] src_min src_max]/n" " [-dst_scale[_n] dst_min dst_max]/n" " [-lutbins count]/n" " [-s_nodata[_n] value]/n" " [-stddev multiplier]/n" " [-equalize]/n" " [-config filename]/n" " src_dataset dst_dataset/n/n" ); printf( "%s/n/n", GDALVersionInfo( "--version" ) ); exit( 1 );}
开发者ID:brunosimoes,项目名称:WorldWind,代码行数:18,
示例11: mainint main(int argc, char* argv[]){ bool bVerbose = TRUE; GDALAllRegister(); argc = GDALGeneralCmdLineProcessor( argc, &argv, 0 ); if( argc < 1 ) exit( -argc ); /* -------------------------------------------------------------------- */ /* Parse arguments. */ /* -------------------------------------------------------------------- */ int i = 0; for( i = 1; i < argc; i++ ) { if( EQUAL(argv[i], "--version") ) { std::cout << " -GDAL version: " << GDAL_RELEASE_NAME << " (" << GDALVersionInfo("RELEASE_NAME") << ")." <<std::endl; std::cout << " -PCL version: " << PCL_MAJOR_VERSION << "." << PCL_MINOR_VERSION << std::endl; return 0; } else if( EQUAL(argv[i],"--help") ) { printUsage("Help"); } else if( EQUAL(argv[i], "-verbose") ) { bVerbose = TRUE; } else if( argv[i][0] == '-' ) { std::stringstream temp; std::string buffer; temp << "Unknown option name '" << argv[i] << "'"; temp >> buffer; printUsage(buffer); } else if( inputFile == "" )
开发者ID:jeromeOrfila,项目名称:decodetiff,代码行数:40,
示例12: mainint main( int argc, char ** argv ){ const char *pszSrcFilename = NULL; const char *pszDstFilename = NULL; int nOrder = 0; void *hTransformArg; GDALTransformerFunc pfnTransformer = NULL; int nGCPCount = 0; GDAL_GCP *pasGCPs = NULL; int bInverse = FALSE; char **papszTO = NULL; /* Check that we are running against at least GDAL 1.5 */ /* Note to developers : if we use newer API, please change the requirement */ if (atoi(GDALVersionInfo("VERSION_NUM")) < 1500) { fprintf(stderr, "At least, GDAL >= 1.5.0 is required for this version of %s, " "which was compiled against GDAL %s/n", argv[0], GDAL_RELEASE_NAME); exit(1); } GDALAllRegister(); argc = GDALGeneralCmdLineProcessor( argc, &argv, 0 ); if( argc < 1 ) exit( -argc );/* -------------------------------------------------------------------- *//* Parse arguments. *//* -------------------------------------------------------------------- */ int i; for( i = 1; i < argc; i++ ) { if( EQUAL(argv[i], "--utility_version") ) { printf("%s was compiled against GDAL %s and is running against GDAL %s/n", argv[0], GDAL_RELEASE_NAME, GDALVersionInfo("RELEASE_NAME")); return 0; } else if( EQUAL(argv[i],"-t_srs") && i < argc-1 ) { char *pszSRS = SanitizeSRS(argv[++i]); papszTO = CSLSetNameValue( papszTO, "DST_SRS", pszSRS ); CPLFree( pszSRS ); } else if( EQUAL(argv[i],"-s_srs") && i < argc-1 ) { char *pszSRS = SanitizeSRS(argv[++i]); papszTO = CSLSetNameValue( papszTO, "SRC_SRS", pszSRS ); CPLFree( pszSRS ); } else if( EQUAL(argv[i],"-order") && i < argc-1 ) { nOrder = atoi(argv[++i]); papszTO = CSLSetNameValue( papszTO, "MAX_GCP_ORDER", argv[i] ); } else if( EQUAL(argv[i],"-tps") ) { papszTO = CSLSetNameValue( papszTO, "METHOD", "GCP_TPS" ); nOrder = -1; } else if( EQUAL(argv[i],"-rpc") ) { papszTO = CSLSetNameValue( papszTO, "METHOD", "RPC" ); } else if( EQUAL(argv[i],"-geoloc") ) { papszTO = CSLSetNameValue( papszTO, "METHOD", "GEOLOC_ARRAY" ); } else if( EQUAL(argv[i],"-i") ) { bInverse = TRUE; } else if( EQUAL(argv[i],"-to") && i < argc-1 ) { papszTO = CSLAddString( papszTO, argv[++i] ); } else if( EQUAL(argv[i],"-gcp") && i < argc - 4 ) { char* endptr = NULL; /* -gcp pixel line easting northing [elev] */ nGCPCount++; pasGCPs = (GDAL_GCP *) CPLRealloc( pasGCPs, sizeof(GDAL_GCP) * nGCPCount ); GDALInitGCPs( 1, pasGCPs + nGCPCount - 1 ); pasGCPs[nGCPCount-1].dfGCPPixel = atof(argv[++i]); pasGCPs[nGCPCount-1].dfGCPLine = atof(argv[++i]); pasGCPs[nGCPCount-1].dfGCPX = atof(argv[++i]); pasGCPs[nGCPCount-1].dfGCPY = atof(argv[++i]); if( argv[i+1] != NULL && (CPLStrtod(argv[i+1], &endptr) != 0.0 || argv[i+1][0] == '0') ) { /* Check that last argument is really a number and not a filename */ /* looking like a number (see ticket #863) */ if (endptr && *endptr == 0) pasGCPs[nGCPCount-1].dfGCPZ = atof(argv[++i]); }//.........这里部分代码省略.........
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:101,
示例13: MAIN_STARTMAIN_START(argc, argv){ // Check that we are running against at least GDAL 1.4. // Note to developers: if we use newer API, please change the requirement. if( atoi(GDALVersionInfo("VERSION_NUM")) < 1400 ) { fprintf(stderr, "At least, GDAL >= 1.4.0 is required for this version of %s, " "which was compiled against GDAL %s/n", argv[0], GDAL_RELEASE_NAME); exit(1); } GDALAllRegister(); OGRRegisterAll(); argc = GDALGeneralCmdLineProcessor( argc, &argv, 0 ); if( argc < 1 ) exit( -argc );/* -------------------------------------------------------------------- *//* Get commandline arguments other than the GDAL raster filenames. *//* -------------------------------------------------------------------- */ const char* pszIndexLayerName = nullptr; const char *index_filename = nullptr; const char *tile_index = "location"; const char* pszDriverName = nullptr; size_t nMaxFieldSize = 254; bool write_absolute_path = false; char* current_path = nullptr; bool skip_different_projection = false; const char *pszTargetSRS = ""; bool bSetTargetSRS = false; const char* pszSrcSRSName = nullptr; int i_SrcSRSName = -1; bool bSrcSRSFormatSpecified = false; SrcSRSFormat eSrcSRSFormat = FORMAT_AUTO; int iArg = 1; // Used after for. for( ; iArg < argc; iArg++ ) { if( EQUAL(argv[iArg], "--utility_version") ) { printf("%s was compiled against GDAL %s and is running against " "GDAL %s/n", argv[0], GDAL_RELEASE_NAME, GDALVersionInfo("RELEASE_NAME")); CSLDestroy( argv ); return 0; } else if( EQUAL(argv[iArg],"--help") ) Usage(nullptr); else if( (strcmp(argv[iArg],"-f") == 0 || strcmp(argv[iArg],"-of") == 0) ) { CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1); pszDriverName = argv[++iArg]; } else if( strcmp(argv[iArg],"-lyr_name") == 0 ) { CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1); pszIndexLayerName = argv[++iArg]; } else if( strcmp(argv[iArg],"-tileindex") == 0 ) { CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1); tile_index = argv[++iArg]; } else if( strcmp(argv[iArg],"-t_srs") == 0 ) { CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1); pszTargetSRS = argv[++iArg]; bSetTargetSRS = true; } else if ( strcmp(argv[iArg],"-write_absolute_path") == 0 ) { write_absolute_path = true; } else if ( strcmp(argv[iArg],"-skip_different_projection") == 0 ) { skip_different_projection = true; } else if( strcmp(argv[iArg], "-src_srs_name") == 0 ) { CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1); pszSrcSRSName = argv[++iArg]; } else if( strcmp(argv[iArg], "-src_srs_format") == 0 ) { const char* pszFormat; bSrcSRSFormatSpecified = true; CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1); pszFormat = argv[++iArg]; if( EQUAL(pszFormat, "AUTO") ) eSrcSRSFormat = FORMAT_AUTO; else if( EQUAL(pszFormat, "WKT") ) eSrcSRSFormat = FORMAT_WKT; else if( EQUAL(pszFormat, "EPSG") ) eSrcSRSFormat = FORMAT_EPSG; else if( EQUAL(pszFormat, "PROJ") ) eSrcSRSFormat = FORMAT_PROJ; }//.........这里部分代码省略.........
开发者ID:AsgerPetersen,项目名称:gdal,代码行数:101,
示例14: OGRGeneralCmdLineProcessorint OGRGeneralCmdLineProcessor( int nArgc, char ***ppapszArgv, int nOptions ){ char **papszReturn = NULL; int iArg; char **papszArgv = *ppapszArgv; (void) nOptions; /* -------------------------------------------------------------------- *//* Preserve the program name. *//* -------------------------------------------------------------------- */ papszReturn = CSLAddString( papszReturn, papszArgv[0] );/* ==================================================================== *//* Loop over all arguments. *//* ==================================================================== */ for( iArg = 1; iArg < nArgc; iArg++ ) {/* -------------------------------------------------------------------- *//* --version *//* -------------------------------------------------------------------- */ if( EQUAL(papszArgv[iArg],"--version") ) { printf( "%s/n", GDALVersionInfo( "--version" ) ); CSLDestroy( papszReturn ); return 0; }/* -------------------------------------------------------------------- *//* --license *//* -------------------------------------------------------------------- */ else if( EQUAL(papszArgv[iArg],"--license") ) { printf( "%s/n", GDALVersionInfo( "LICENSE" ) ); CSLDestroy( papszReturn ); return 0; }/* -------------------------------------------------------------------- *//* --config *//* -------------------------------------------------------------------- */ else if( EQUAL(papszArgv[iArg],"--config") ) { if( iArg + 2 >= nArgc ) { CPLError( CE_Failure, CPLE_AppDefined, "--config option given without a key and value argument." ); CSLDestroy( papszReturn ); return -1; } CPLSetConfigOption( papszArgv[iArg+1], papszArgv[iArg+2] ); iArg += 2; }/* -------------------------------------------------------------------- *//* --mempreload *//* -------------------------------------------------------------------- */ else if( EQUAL(papszArgv[iArg],"--mempreload") ) { int i; if( iArg + 1 >= nArgc ) { CPLError( CE_Failure, CPLE_AppDefined, "--mempreload option given without directory path."); CSLDestroy( papszReturn ); return -1; } char **papszFiles = CPLReadDir( papszArgv[iArg+1] ); if( CSLCount(papszFiles) == 0 ) { CPLError( CE_Failure, CPLE_AppDefined, "--mempreload given invalid or empty directory."); CSLDestroy( papszReturn ); return -1; } for( i = 0; papszFiles[i] != NULL; i++ ) { CPLString osOldPath, osNewPath; if( EQUAL(papszFiles[i],".") || EQUAL(papszFiles[i],"..") ) continue; osOldPath = CPLFormFilename( papszArgv[iArg+1], papszFiles[i], NULL ); osNewPath.Printf( "/vsimem/%s", papszFiles[i] ); CPLDebug( "VSI", "Preloading %s to %s.", osOldPath.c_str(), osNewPath.c_str() ); if( CPLCopyFile( osNewPath, osOldPath ) != 0 ) return -1; } CSLDestroy( papszFiles );//.........这里部分代码省略.........
开发者ID:actian-geospatial,项目名称:ogr-ingres,代码行数:101,
示例15: GDALVersionInfostd::string OGRAmigoCloudDataSource::GetUserAgentOption(){ std::stringstream userAgent; userAgent << "USERAGENT=gdal/AmigoCloud build:" << GDALVersionInfo("RELEASE_NAME"); return userAgent.str();}
开发者ID:ksshannon,项目名称:gdal,代码行数:6,
示例16: mainint main( int nArgc, char ** papszArgv ){ const char *pszWHERE = NULL; const char *pszDataSource = NULL; char **papszLayers = NULL; OGRGeometry *poSpatialFilter = NULL; int nRepeatCount = 1, bAllLayers = FALSE; const char *pszSQLStatement = NULL; const char *pszDialect = NULL; /* Check strict compilation and runtime library version as we use C++ API */ if (! GDAL_CHECK_VERSION(papszArgv[0])) exit(1);/* -------------------------------------------------------------------- *//* Register format(s). *//* -------------------------------------------------------------------- */ OGRRegisterAll(); /* -------------------------------------------------------------------- *//* Processing command line arguments. *//* -------------------------------------------------------------------- */ nArgc = OGRGeneralCmdLineProcessor( nArgc, &papszArgv, 0 ); if( nArgc < 1 ) exit( -nArgc ); for( int iArg = 1; iArg < nArgc; iArg++ ) { if( EQUAL(papszArgv[iArg], "--utility_version") ) { printf("%s was compiled against GDAL %s and is running against GDAL %s/n", papszArgv[0], GDAL_RELEASE_NAME, GDALVersionInfo("RELEASE_NAME")); return 0; } else if( EQUAL(papszArgv[iArg],"-ro") ) bReadOnly = TRUE; else if( EQUAL(papszArgv[iArg],"-q") || EQUAL(papszArgv[iArg],"-quiet")) bVerbose = FALSE; else if( EQUAL(papszArgv[iArg],"-fid") && iArg < nArgc-1 ) nFetchFID = atoi(papszArgv[++iArg]); else if( EQUAL(papszArgv[iArg],"-spat") && papszArgv[iArg+1] != NULL && papszArgv[iArg+2] != NULL && papszArgv[iArg+3] != NULL && papszArgv[iArg+4] != NULL ) { OGRLinearRing oRing; oRing.addPoint( atof(papszArgv[iArg+1]), atof(papszArgv[iArg+2]) ); oRing.addPoint( atof(papszArgv[iArg+1]), atof(papszArgv[iArg+4]) ); oRing.addPoint( atof(papszArgv[iArg+3]), atof(papszArgv[iArg+4]) ); oRing.addPoint( atof(papszArgv[iArg+3]), atof(papszArgv[iArg+2]) ); oRing.addPoint( atof(papszArgv[iArg+1]), atof(papszArgv[iArg+2]) ); poSpatialFilter = new OGRPolygon(); ((OGRPolygon *) poSpatialFilter)->addRing( &oRing ); iArg += 4; } else if( EQUAL(papszArgv[iArg],"-where") && papszArgv[iArg+1] != NULL ) { pszWHERE = papszArgv[++iArg]; } else if( EQUAL(papszArgv[iArg],"-sql") && papszArgv[iArg+1] != NULL ) { pszSQLStatement = papszArgv[++iArg]; } else if( EQUAL(papszArgv[iArg],"-dialect") && papszArgv[iArg+1] != NULL ) { pszDialect = papszArgv[++iArg]; } else if( EQUAL(papszArgv[iArg],"-rc") && papszArgv[iArg+1] != NULL ) { nRepeatCount = atoi(papszArgv[++iArg]); } else if( EQUAL(papszArgv[iArg],"-al") ) { bAllLayers = TRUE; } else if( EQUAL(papszArgv[iArg],"-so") || EQUAL(papszArgv[iArg],"-summary") ) { bSummaryOnly = TRUE; } else if( EQUALN(papszArgv[iArg],"-fields=", strlen("-fields=")) ) { char* pszTemp = (char*)CPLMalloc(32 + strlen(papszArgv[iArg])); sprintf(pszTemp, "DISPLAY_FIELDS=%s", papszArgv[iArg] + strlen("-fields=")); papszOptions = CSLAddString(papszOptions, pszTemp); CPLFree(pszTemp); } else if( EQUALN(papszArgv[iArg],"-geom=", strlen("-geom=")) ) { char* pszTemp = (char*)CPLMalloc(32 + strlen(papszArgv[iArg])); sprintf(pszTemp, "DISPLAY_GEOMETRY=%s", papszArgv[iArg] + strlen("-geom=")); papszOptions = CSLAddString(papszOptions, pszTemp); CPLFree(pszTemp); } else if( papszArgv[iArg][0] == '-' )//.........这里部分代码省略.........
开发者ID:469447793,项目名称:World-Wind-Java,代码行数:101,
示例17: MAIN_STARTMAIN_START(argc, argv){ /* Check strict compilation and runtime library version as we use C++ API */ if (! GDAL_CHECK_VERSION(argv[0])) exit(1); EarlySetConfigOptions(argc, argv);/* -------------------------------------------------------------------- *//* Generic arg processing. *//* -------------------------------------------------------------------- */ GDALAllRegister(); argc = GDALGeneralCmdLineProcessor( argc, &argv, 0 ); if( argc < 1 ) exit( -argc ); for( int i = 0; i < argc; i++ ) { if( EQUAL(argv[i], "--utility_version") ) { printf("%s was compiled against GDAL %s and is running against GDAL %s/n", argv[0], GDAL_RELEASE_NAME, GDALVersionInfo("RELEASE_NAME")); CSLDestroy( argv ); return 0; } else if( EQUAL(argv[i],"--help") ) { Usage(); } } GDALGridOptionsForBinary* psOptionsForBinary = GDALGridOptionsForBinaryNew(); /* coverity[tainted_data] */ GDALGridOptions *psOptions = GDALGridOptionsNew(argv + 1, psOptionsForBinary); CSLDestroy( argv ); if( psOptions == nullptr ) { Usage(); } if( !(psOptionsForBinary->bQuiet) ) { GDALGridOptionsSetProgress(psOptions, GDALTermProgress, nullptr); } if( psOptionsForBinary->pszSource == nullptr ) Usage("No input file specified."); if( psOptionsForBinary->pszDest== nullptr ) Usage("No output file specified."); if( psOptionsForBinary->pszDest == nullptr ) psOptionsForBinary->pszDest = CPLStrdup(psOptionsForBinary->pszSource); /* -------------------------------------------------------------------- *//* Open input file. *//* -------------------------------------------------------------------- */ GDALDatasetH hInDS = GDALOpenEx( psOptionsForBinary->pszSource, GDAL_OF_VECTOR | GDAL_OF_VERBOSE_ERROR, nullptr, nullptr, nullptr ); if( hInDS == nullptr ) exit( 1 ); int bUsageError = FALSE; GDALDatasetH hOutDS = GDALGrid(psOptionsForBinary->pszDest, hInDS, psOptions, &bUsageError); if(bUsageError == TRUE) Usage(); int nRetCode = hOutDS ? 0 : 1; GDALClose(hInDS); GDALClose(hOutDS); GDALGridOptionsFree(psOptions); GDALGridOptionsForBinaryFree(psOptionsForBinary); OGRCleanupAll(); GDALDestroyDriverManager(); return nRetCode;}
开发者ID:jef-n,项目名称:gdal,代码行数:80,
示例18: mainint main( int nArgc, char ** papszArgv ){ int bQuiet = FALSE; const char *pszDataSource = NULL; GNMGFID nFromFID = -1; GNMGFID nToFID = -1; int nK = 1; const char *pszDataset = NULL; const char *pszFormat = "ESRI Shapefile"; const char *pszLayer = NULL; GNMNetwork *poDS = NULL; OGRLayer* poResultLayer = NULL; char **papszDSCO = NULL, **papszLCO = NULL, **papszALO = NULL; operation stOper = op_unknown; int nRet = 0; // Check strict compilation and runtime library version as we use C++ API if (! GDAL_CHECK_VERSION(papszArgv[0])) exit(1); EarlySetConfigOptions(nArgc, papszArgv);/* -------------------------------------------------------------------- *//* Register format(s). *//* -------------------------------------------------------------------- */ GDALAllRegister();/* -------------------------------------------------------------------- *//* Processing command line arguments. *//* -------------------------------------------------------------------- */ nArgc = GDALGeneralCmdLineProcessor( nArgc, &papszArgv, GDAL_OF_GNM ); if( nArgc < 1 ) { exit( -nArgc ); } for( int iArg = 1; iArg < nArgc; iArg++ ) { if( EQUAL(papszArgv[1], "--utility_version") ) { printf("%s was compiled against GDAL %s and is running against GDAL %s/n", papszArgv[0], GDAL_RELEASE_NAME, GDALVersionInfo("RELEASE_NAME")); return 0; } else if( EQUAL(papszArgv[iArg],"--help") ) { Usage(); } else if ( EQUAL(papszArgv[iArg], "--long-usage") ) { Usage(FALSE); } else if( EQUAL(papszArgv[iArg],"-q") || EQUAL(papszArgv[iArg],"-quiet") ) { bQuiet = TRUE; } else if( EQUAL(papszArgv[iArg],"dijkstra") ) { CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(2); stOper = op_dijkstra; nFromFID = atoi(papszArgv[++iArg]); nToFID = atoi(papszArgv[++iArg]); } else if( EQUAL(papszArgv[iArg],"kpaths") ) { CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(3); stOper = op_kpaths; nFromFID = atoi(papszArgv[++iArg]); nToFID = atoi(papszArgv[++iArg]); nK = atoi(papszArgv[++iArg]); } else if( EQUAL(papszArgv[iArg],"resource") ) { stOper = op_resource; } else if( EQUAL(papszArgv[iArg],"-ds") ) { CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1); pszDataset = papszArgv[++iArg]; } else if( EQUAL(papszArgv[iArg],"-f") ) { CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1); pszFormat = papszArgv[++iArg];//.........这里部分代码省略.........
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:101,
示例19: mainint main( int argc, char ** argv ){ GDALDatasetH hDataset; GDALRasterBandH hBand; int i, iBand; double adfGeoTransform[6]; GDALDriverH hDriver; char **papszMetadata; int bComputeMinMax = FALSE, bSample = FALSE; int bShowGCPs = TRUE, bShowMetadata = TRUE, bShowRAT=TRUE; int bStats = FALSE, bApproxStats = TRUE, iMDD; int bShowColorTable = TRUE, bComputeChecksum = FALSE; int bReportHistograms = FALSE; const char *pszFilename = NULL; char **papszExtraMDDomains = NULL, **papszFileList; const char *pszProjection = NULL; OGRCoordinateTransformationH hTransform = NULL; /* Check that we are running against at least GDAL 1.5 */ /* Note to developers : if we use newer API, please change the requirement */ if (atoi(GDALVersionInfo("VERSION_NUM")) < 1500) { fprintf(stderr, "At least, GDAL >= 1.5.0 is required for this version of %s, " "which was compiled against GDAL %s/n", argv[0], GDAL_RELEASE_NAME); exit(1); } /* Must process GDAL_SKIP before GDALAllRegister(), but we can't call */ /* GDALGeneralCmdLineProcessor before it needs the drivers to be registered */ /* for the --format or --formats options */ for( i = 1; i < argc; i++ ) { if( EQUAL(argv[i],"--config") && i + 2 < argc && EQUAL(argv[i + 1], "GDAL_SKIP") ) { CPLSetConfigOption( argv[i+1], argv[i+2] ); i += 2; } } GDALAllRegister(); argc = GDALGeneralCmdLineProcessor( argc, &argv, 0 ); if( argc < 1 ) exit( -argc );/* -------------------------------------------------------------------- *//* Parse arguments. *//* -------------------------------------------------------------------- */ for( i = 1; i < argc; i++ ) { if( EQUAL(argv[i], "--utility_version") ) { printf("%s was compiled against GDAL %s and is running against GDAL %s/n", argv[0], GDAL_RELEASE_NAME, GDALVersionInfo("RELEASE_NAME")); return 0; } else if( EQUAL(argv[i], "-mm") ) bComputeMinMax = TRUE; else if( EQUAL(argv[i], "-hist") ) bReportHistograms = TRUE; else if( EQUAL(argv[i], "-stats") ) { bStats = TRUE; bApproxStats = FALSE; } else if( EQUAL(argv[i], "-approx_stats") ) { bStats = TRUE; bApproxStats = TRUE; } else if( EQUAL(argv[i], "-sample") ) bSample = TRUE; else if( EQUAL(argv[i], "-checksum") ) bComputeChecksum = TRUE; else if( EQUAL(argv[i], "-nogcp") ) bShowGCPs = FALSE; else if( EQUAL(argv[i], "-nomd") ) bShowMetadata = FALSE; else if( EQUAL(argv[i], "-norat") ) bShowRAT = FALSE; else if( EQUAL(argv[i], "-noct") ) bShowColorTable = FALSE; else if( EQUAL(argv[i], "-mdd") && i < argc-1 ) papszExtraMDDomains = CSLAddString( papszExtraMDDomains, argv[++i] ); else if( argv[i][0] == '-' ) Usage(); else if( pszFilename == NULL ) pszFilename = argv[i]; else Usage(); } if( pszFilename == NULL ) Usage();/* -------------------------------------------------------------------- *///.........这里部分代码省略.........
开发者ID:469447793,项目名称:World-Wind-Java,代码行数:101,
示例20: mainint main( int argc, char ** argv ){ /* Check that we are running against at least GDAL 1.4 (probably older in fact !) */ /* Note to developers : if we use newer API, please change the requirement */ if (atoi(GDALVersionInfo("VERSION_NUM")) < 1400) { fprintf(stderr, "At least, GDAL >= 1.4.0 is required for this version of %s, " "which was compiled against GDAL %s/n", argv[0], GDAL_RELEASE_NAME); exit(1); }/* -------------------------------------------------------------------- *//* Generic arg processing. *//* -------------------------------------------------------------------- */ GDALAllRegister(); GDALSetCacheMax( 100000000 ); argc = GDALGeneralCmdLineProcessor( argc, &argv, 0 ); if( argc < 1 ) exit( -argc ); /* -------------------------------------------------------------------- *//* Parse arguments. *//* -------------------------------------------------------------------- */ int i; const char *pszOutFile = NULL; const char *pszInFile = NULL; int nMaxNonBlack = 2; int nNearDist = 15; int bNearWhite = FALSE; int bSetAlpha = FALSE; int bSetMask = FALSE; const char* pszDriverName = "HFA"; int bFormatExplicitelySet = FALSE; char** papszCreationOptions = NULL; int bQuiet = FALSE; Colors oColors; for( i = 1; i < argc; i++ ) { if( EQUAL(argv[i], "--utility_version") ) { printf("%s was compiled against GDAL %s and is running against GDAL %s/n", argv[0], GDAL_RELEASE_NAME, GDALVersionInfo("RELEASE_NAME")); return 0; } else if( EQUAL(argv[i], "-o") && i < argc-1 ) pszOutFile = argv[++i]; else if( EQUAL(argv[i], "-of") && i < argc-1 ) { pszDriverName = argv[++i]; bFormatExplicitelySet = TRUE; } else if( EQUAL(argv[i], "-white") ) { bNearWhite = TRUE; } /***** -color c1,c2,c3...cn *****/ else if( EQUAL(argv[i], "-color") && i < argc-1 ) { Color oColor; /***** tokenize the arg on , *****/ char **papszTokens; papszTokens = CSLTokenizeString2( argv[++i], ",", 0 ); /***** loop over the tokens *****/ int iToken; for( iToken = 0; papszTokens && papszTokens[iToken]; iToken++ ) { /***** ensure the token is an int and add it to the color *****/ if ( IsInt( papszTokens[iToken] ) ) oColor.push_back( atoi( papszTokens[iToken] ) ); else { CPLError(CE_Failure, CPLE_AppDefined, "Colors must be valid integers." ); CSLDestroy( papszTokens ); exit(1); } } CSLDestroy( papszTokens ); /***** check if the number of bands is consistant *****/ if ( oColors.size() > 0 && oColors.front().size() != oColor.size() ) { CPLError(CE_Failure, CPLE_AppDefined, "ERROR: all -color args must have the same number of values./n" ); exit(1); } /***** add the color to the colors *****/ //.........这里部分代码省略.........
开发者ID:Joe-xXx,项目名称:gdal,代码行数:101,
示例21: mainint main(int argc, char** argv){ /* Check strict compilation and runtime library version as we use C++ API */ if (! GDAL_CHECK_VERSION(argv[0])) exit(1); EarlySetConfigOptions(argc, argv);/* -------------------------------------------------------------------- *//* Generic arg processing. *//* -------------------------------------------------------------------- */ GDALAllRegister(); argc = GDALGeneralCmdLineProcessor( argc, &argv, 0 ); if( argc < 1 ) exit( -argc ); for( int i = 0; i < argc; i++ ) { if( EQUAL(argv[i], "--utility_version") ) { printf("%s was compiled against GDAL %s and is running against GDAL %s/n", argv[0], GDAL_RELEASE_NAME, GDALVersionInfo("RELEASE_NAME")); CSLDestroy( argv ); return 0; } else if( EQUAL(argv[i],"--help") ) { Usage(); } } GDALRasterizeOptionsForBinary* psOptionsForBinary = GDALRasterizeOptionsForBinaryNew(); GDALRasterizeOptions *psOptions = GDALRasterizeOptionsNew(argv + 1, psOptionsForBinary); CSLDestroy( argv ); if( psOptions == NULL ) { Usage(); } if( !(psOptionsForBinary->bQuiet) ) { GDALRasterizeOptionsSetProgress(psOptions, GDALTermProgress, NULL); } if( psOptionsForBinary->pszSource == NULL ) Usage("No input file specified."); if( psOptionsForBinary->pszDest == NULL ) Usage("No output file specified.");/* -------------------------------------------------------------------- *//* Open input file. *//* -------------------------------------------------------------------- */ GDALDatasetH hInDS = GDALOpenEx( psOptionsForBinary->pszSource, GDAL_OF_VECTOR | GDAL_OF_VERBOSE_ERROR, NULL, NULL, NULL ); if( hInDS == NULL ) exit( 1 );/* -------------------------------------------------------------------- *//* Open output file if it exists. *//* -------------------------------------------------------------------- */ GDALDatasetH hDstDS = NULL; if( !(psOptionsForBinary->bCreateOutput) ) { CPLPushErrorHandler( CPLQuietErrorHandler ); hDstDS = GDALOpenEx( psOptionsForBinary->pszDest, GDAL_OF_RASTER | GDAL_OF_VERBOSE_ERROR | GDAL_OF_UPDATE, NULL, NULL, NULL ); CPLPopErrorHandler(); } if (hDstDS == NULL && !psOptionsForBinary->bQuiet && !psOptionsForBinary->bFormatExplicitlySet) CheckExtensionConsistency(psOptionsForBinary->pszDest, psOptionsForBinary->pszFormat); int bUsageError = FALSE; GDALDatasetH hRetDS = GDALRasterize(psOptionsForBinary->pszDest, hDstDS, hInDS, psOptions, &bUsageError); if(bUsageError == TRUE) Usage(); int nRetCode = (hRetDS) ? 0 : 1; GDALClose(hInDS); GDALClose(hRetDS); GDALRasterizeOptionsFree(psOptions); GDALRasterizeOptionsForBinaryFree(psOptionsForBinary); GDALDestroyDriverManager(); return nRetCode;}
开发者ID:sameke,项目名称:node-gdal,代码行数:94,
示例22: mainint main( int nArgc, char ** papszArgv ){ int nFirstSourceDataset = -1, bLayersWildcarded = TRUE, iArg; const char *pszFormat = "ESRI Shapefile"; const char *pszTileIndexField = "LOCATION"; const char *pszOutputName = NULL; int write_absolute_path = FALSE; int skip_different_projection = FALSE; char* current_path = NULL; int accept_different_schemas = FALSE; int bFirstWarningForNonMatchingAttributes = TRUE; /* Check strict compilation and runtime library version as we use C++ API */ if (! GDAL_CHECK_VERSION(papszArgv[0])) exit(1);/* -------------------------------------------------------------------- *//* Register format(s). *//* -------------------------------------------------------------------- */ OGRRegisterAll(); /* -------------------------------------------------------------------- *//* Processing command line arguments. *//* -------------------------------------------------------------------- */ for( iArg = 1; iArg < nArgc; iArg++ ) { if( EQUAL(papszArgv[iArg], "--utility_version") ) { printf("%s was compiled against GDAL %s and is running against GDAL %s/n", papszArgv[0], GDAL_RELEASE_NAME, GDALVersionInfo("RELEASE_NAME")); return 0; } else if( EQUAL(papszArgv[iArg],"-f") && iArg < nArgc-1 ) { pszFormat = papszArgv[++iArg]; } else if( EQUAL(papszArgv[iArg],"-write_absolute_path")) { write_absolute_path = TRUE; } else if( EQUAL(papszArgv[iArg],"-skip_different_projection")) { skip_different_projection = TRUE; } else if( EQUAL(papszArgv[iArg],"-accept_different_schemas")) { accept_different_schemas = TRUE; } else if( EQUAL(papszArgv[iArg],"-tileindex") && iArg < nArgc-1 ) { pszTileIndexField = papszArgv[++iArg]; } else if( EQUAL(papszArgv[iArg],"-lnum") || EQUAL(papszArgv[iArg],"-lname") ) { iArg++; bLayersWildcarded = FALSE; } else if( papszArgv[iArg][0] == '-' ) Usage(); else if( pszOutputName == NULL ) pszOutputName = papszArgv[iArg]; else if( nFirstSourceDataset == -1 ) nFirstSourceDataset = iArg; } if( pszOutputName == NULL || nFirstSourceDataset == -1 ) Usage();/* -------------------------------------------------------------------- *//* Try to open as an existing dataset for update access. *//* -------------------------------------------------------------------- */ OGRDataSource *poDstDS; OGRLayer *poDstLayer = NULL; poDstDS = OGRSFDriverRegistrar::Open( pszOutputName, TRUE );/* -------------------------------------------------------------------- *//* If that failed, find the driver so we can create the tile index.*//* -------------------------------------------------------------------- */ if( poDstDS == NULL ) { OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar(); OGRSFDriver *poDriver = NULL; int iDriver; for( iDriver = 0; iDriver < poR->GetDriverCount() && poDriver == NULL; iDriver++ ) { if( EQUAL(poR->GetDriver(iDriver)->GetName(),pszFormat) ) { poDriver = poR->GetDriver(iDriver); } } if( poDriver == NULL ) { fprintf( stderr, "Unable to find driver `%s'./n", pszFormat ); fprintf( stderr, "The following drivers are available:/n" );//.........这里部分代码省略.........
开发者ID:469447793,项目名称:World-Wind-Java,代码行数:101,
示例23: mainint main( int nArgc, char ** papszArgv ){ GDALDatasetH hDataset; const char *pszResampling = "nearest"; const char *pszFilename = NULL; int anLevels[1024]; int nLevelCount = 0; int nResultStatus = 0; int bReadOnly = FALSE; int bClean = FALSE; GDALProgressFunc pfnProgress = GDALTermProgress; int *panBandList = NULL; int nBandCount = 0; char **papszOpenOptions = NULL; /* Check that we are running against at least GDAL 1.7 */ /* Note to developers : if we use newer API, please change the requirement */ if (atoi(GDALVersionInfo("VERSION_NUM")) < 1700) { fprintf(stderr, "At least, GDAL >= 1.7.0 is required for this version of %s, " "which was compiled against GDAL %s/n", papszArgv[0], GDAL_RELEASE_NAME); exit(1); } GDALAllRegister(); nArgc = GDALGeneralCmdLineProcessor( nArgc, &papszArgv, 0 ); if( nArgc < 1 ) exit( -nArgc );/* -------------------------------------------------------------------- *//* Parse commandline. *//* -------------------------------------------------------------------- */ for( int iArg = 1; iArg < nArgc; iArg++ ) { if( EQUAL(papszArgv[iArg], "--utility_version") ) { printf("%s was compiled against GDAL %s and is running against GDAL %s/n", papszArgv[0], GDAL_RELEASE_NAME, GDALVersionInfo("RELEASE_NAME")); CSLDestroy( papszArgv ); return 0; } else if( EQUAL(papszArgv[iArg],"--help") ) Usage(); else if( EQUAL(papszArgv[iArg],"-r") ) { CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1); pszResampling = papszArgv[++iArg]; } else if( EQUAL(papszArgv[iArg],"-ro")) bReadOnly = TRUE; else if( EQUAL(papszArgv[iArg],"-clean")) bClean = TRUE; else if( EQUAL(papszArgv[iArg],"-q") || EQUAL(papszArgv[iArg],"-quiet") ) pfnProgress = GDALDummyProgress; else if( EQUAL(papszArgv[iArg],"-b")) { CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1); const char* pszBand = papszArgv[iArg+1]; int nBand = atoi(pszBand); if( nBand < 1 ) { printf( "Unrecognizable band number (%s)./n", papszArgv[iArg+1] ); Usage(); GDALDestroyDriverManager(); exit( 2 ); } iArg++; nBandCount++; panBandList = (int *) CPLRealloc(panBandList, sizeof(int) * nBandCount); panBandList[nBandCount-1] = nBand; } else if( EQUAL(papszArgv[iArg], "-oo") ) { CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1); papszOpenOptions = CSLAddString( papszOpenOptions, papszArgv[++iArg] ); } else if( papszArgv[iArg][0] == '-' ) Usage(CPLSPrintf("Unknown option name '%s'", papszArgv[iArg])); else if( pszFilename == NULL ) pszFilename = papszArgv[iArg]; else if( atoi(papszArgv[iArg]) > 0 ) { anLevels[nLevelCount++] = atoi(papszArgv[iArg]); if( anLevels[nLevelCount-1] == 1 ) { printf("Warning: Overview with subsampling factor of 1 requested. This will copy the full resolution dataset in the overview !/n"); } } else Usage("Too many command options."); } if( pszFilename == NULL ) Usage("No datasource specified.");//.........这里部分代码省略.........
开发者ID:sameke,项目名称:node-gdal,代码行数:101,
示例24: mainint main( int argc, char ** argv ){ GDALDriverH hDriver; const char *pszSource=NULL, *pszDest=NULL, *pszFormat = "GTiff"; int bFormatExplicitelySet = FALSE; char **papszLayers = NULL; const char *pszBurnAttribute = NULL; double dfIncreaseBurnValue = 0.0; double dfMultiplyBurnValue = 1.0; const char *pszWHERE = NULL, *pszSQL = NULL; GDALDataType eOutputType = GDT_Float64; char **papszCreateOptions = NULL; GUInt32 nXSize = 0, nYSize = 0; double dfXMin = 0.0, dfXMax = 0.0, dfYMin = 0.0, dfYMax = 0.0; int bIsXExtentSet = FALSE, bIsYExtentSet = FALSE; GDALGridAlgorithm eAlgorithm = GGA_InverseDistanceToAPower; void *pOptions = NULL; char *pszOutputSRS = NULL; int bQuiet = FALSE; GDALProgressFunc pfnProgress = GDALTermProgress; int i; OGRGeometry *poSpatialFilter = NULL; int bClipSrc = FALSE; OGRGeometry *poClipSrc = NULL; const char *pszClipSrcDS = NULL; const char *pszClipSrcSQL = NULL; const char *pszClipSrcLayer = NULL; const char *pszClipSrcWhere = NULL; /* Check strict compilation and runtime library version as we use C++ API */ if (! GDAL_CHECK_VERSION(argv[0])) exit(1); GDALAllRegister(); OGRRegisterAll(); argc = GDALGeneralCmdLineProcessor( argc, &argv, 0 ); if( argc < 1 ) exit( -argc );/* -------------------------------------------------------------------- *//* Parse arguments. *//* -------------------------------------------------------------------- */ for( i = 1; i < argc; i++ ) { if( EQUAL(argv[i], "--utility_version") ) { printf("%s was compiled against GDAL %s and is running against GDAL %s/n", argv[0], GDAL_RELEASE_NAME, GDALVersionInfo("RELEASE_NAME")); return 0; } else if( EQUAL(argv[i],"--help") ) Usage(); else if( EQUAL(argv[i],"-of") ) { CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1); pszFormat = argv[++i]; bFormatExplicitelySet = TRUE; } else if( EQUAL(argv[i],"-q") || EQUAL(argv[i],"-quiet") ) { bQuiet = TRUE; pfnProgress = GDALDummyProgress; } else if( EQUAL(argv[i],"-ot") ) { CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1); int iType; for( iType = 1; iType < GDT_TypeCount; iType++ ) { if( GDALGetDataTypeName((GDALDataType)iType) != NULL && EQUAL(GDALGetDataTypeName((GDALDataType)iType), argv[i+1]) ) { eOutputType = (GDALDataType) iType; } } if( eOutputType == GDT_Unknown ) { Usage(CPLSPrintf("Unknown output pixel type: %s.", argv[i + 1] )); } i++; } else if( EQUAL(argv[i],"-txe") ) { CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(2); dfXMin = atof(argv[++i]); dfXMax = atof(argv[++i]); bIsXExtentSet = TRUE; } else if( EQUAL(argv[i],"-tye") ) { CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(2);//.........这里部分代码省略.........
开发者ID:GeospatialDaryl,项目名称:VS2013__00_GDAL_111_x64,代码行数:101,
示例25: mainint main( int argc, char ** argv ){ EarlySetConfigOptions(argc, argv);/* -------------------------------------------------------------------- *//* Register standard GDAL drivers, and process generic GDAL *//* command options. *//* -------------------------------------------------------------------- */ GDALAllRegister(); argc = GDALGeneralCmdLineProcessor( argc, &argv, 0 ); if( argc < 1 ) exit( -argc ); for( int i = 0; argv != NULL && argv[i] != NULL; i++ ) { if( EQUAL(argv[i], "--utility_version") ) { printf("%s was compiled against GDAL %s and is running against GDAL %s/n", argv[0], GDAL_RELEASE_NAME, GDALVersionInfo("RELEASE_NAME")); CSLDestroy( argv ); return 0; } else if( EQUAL(argv[i],"--help") ) { Usage(NULL); } } GDALBuildVRTOptionsForBinary* psOptionsForBinary = GDALBuildVRTOptionsForBinaryNew(); /* coverity[tainted_data] */ GDALBuildVRTOptions *psOptions = GDALBuildVRTOptionsNew(argv + 1, psOptionsForBinary); CSLDestroy( argv ); if( psOptions == NULL ) { Usage(NULL); } if( psOptionsForBinary->pszDstFilename == NULL ) { Usage("No target filename specified."); } if( !(psOptionsForBinary->bQuiet) ) { GDALBuildVRTOptionsSetProgress(psOptions, GDALTermProgress, NULL); } /* Avoid overwriting a non VRT dataset if the user did not put the */ /* filenames in the right order */ VSIStatBuf sBuf; if (!psOptionsForBinary->bOverwrite) { int bExists = (VSIStat(psOptionsForBinary->pszDstFilename, &sBuf) == 0); if (bExists) { GDALDriverH hDriver = GDALIdentifyDriver( psOptionsForBinary->pszDstFilename, NULL ); if (hDriver && !(EQUAL(GDALGetDriverShortName(hDriver), "VRT") || (EQUAL(GDALGetDriverShortName(hDriver), "API_PROXY") && EQUAL(CPLGetExtension(psOptionsForBinary->pszDstFilename), "VRT"))) ) { fprintf(stderr, "'%s' is an existing GDAL dataset managed by %s driver./n" "There is an high chance you did not put filenames in the right order./n" "If you want to overwrite %s, add -overwrite option to the command line./n/n", psOptionsForBinary->pszDstFilename, GDALGetDriverShortName(hDriver), psOptionsForBinary->pszDstFilename); Usage(); } } } int bUsageError = FALSE; GDALDatasetH hOutDS = GDALBuildVRT(psOptionsForBinary->pszDstFilename, psOptionsForBinary->nSrcFiles, NULL, (const char* const*)psOptionsForBinary->papszSrcFiles, psOptions, &bUsageError); if( bUsageError ) Usage(); int nRetCode = (hOutDS) ? 0 : 1; GDALBuildVRTOptionsFree(psOptions); GDALBuildVRTOptionsForBinaryFree(psOptionsForBinary); CPLErrorReset(); // The flush to disk is only done at that stage, so check if any error has // happened GDALClose( hOutDS ); if( CPLGetLastErrorType() != CE_None ) nRetCode = 1; GDALDumpOpenDatasets( stderr ); GDALDestroyDriverManager(); OGRCleanupAll(); return nRetCode;}
开发者ID:bbradbury,项目名称:lib_gdal,代码行数:100,
示例26: mainint main( int argc, char ** argv ){ /* Check strict compilation and runtime library version as we use C++ API */ if (! GDAL_CHECK_VERSION(argv[0])) exit(1); EarlySetConfigOptions(argc, argv);/* -------------------------------------------------------------------- *//* Register standard GDAL drivers, and process generic GDAL *//* command options. *//* -------------------------------------------------------------------- */ GDALAllRegister(); argc = GDALGeneralCmdLineProcessor( argc, &argv, 0 ); if( argc < 2 ) { Usage("Not enough arguments."); } if( EQUAL(argv[1], "--utility_version") || EQUAL(argv[1], "--utility-version") ) { printf("%s was compiled against GDAL %s and is running against GDAL %s/n", argv[0], GDAL_RELEASE_NAME, GDALVersionInfo("RELEASE_NAME")); CSLDestroy( argv ); return 0; } else if( EQUAL(argv[1],"--help") ) Usage(); GDALDEMProcessingOptionsForBinary* psOptionsForBinary = GDALDEMProcessingOptionsForBinaryNew(); GDALDEMProcessingOptions *psOptions = GDALDEMProcessingOptionsNew(argv + 1, psOptionsForBinary); CSLDestroy( argv ); if( psOptions == NULL ) { Usage(); } if( !(psOptionsForBinary->bQuiet) ) { GDALDEMProcessingOptionsSetProgress(psOptions, GDALTermProgress, NULL); } if( psOptionsForBinary->pszSrcFilename == NULL ) { Usage("Missing source."); } if ( EQUAL(psOptionsForBinary->pszProcessing, "color-relief") && psOptionsForBinary->pszColorFilename == NULL ) { Usage("Missing color file."); } if( psOptionsForBinary->pszDstFilename == NULL ) { Usage("Missing destination."); } if (!psOptionsForBinary->bQuiet && !psOptionsForBinary->bFormatExplicitlySet) CheckExtensionConsistency(psOptionsForBinary->pszDstFilename, psOptionsForBinary->pszFormat); // Open Dataset and get raster band GDALDatasetH hSrcDataset = GDALOpen( psOptionsForBinary->pszSrcFilename, GA_ReadOnly ); if( hSrcDataset == NULL ) { fprintf( stderr, "GDALOpen failed - %d/n%s/n", CPLGetLastErrorNo(), CPLGetLastErrorMsg() ); GDALDestroyDriverManager(); exit( 1 ); } int bUsageError = FALSE; GDALDatasetH hOutDS = GDALDEMProcessing(psOptionsForBinary->pszDstFilename, hSrcDataset, psOptionsForBinary->pszProcessing, psOptionsForBinary->pszColorFilename, psOptions, &bUsageError); if(bUsageError == TRUE) Usage(); int nRetCode = (hOutDS) ? 0 : 1; GDALClose(hSrcDataset); GDALClose(hOutDS); GDALDEMProcessingOptionsFree(psOptions); GDALDEMProcessingOptionsForBinaryFree(psOptionsForBinary); GDALDestroyDriverManager(); return nRetCode;}
开发者ID:sameke,项目名称:node-gdal,代码行数:90,
示例27: mainint main( int argc, char ** argv ){ GDALDatasetH hDataset, hOutDS; int i; const char *pszSource=NULL, *pszDest=NULL, *pszFormat = "GTiff"; GDALDriverH hDriver; GDALDataType eOutputType = GDT_Unknown; char **papszCreateOptions = NULL; GDALProgressFunc pfnProgress = GDALTermProgress; int nLUTBins = 256; const char *pszMethod = "minmax";// double dfStdDevMult = 0.0; double *padfScaleMin = NULL; double *padfScaleMax = NULL; int **papanLUTs = NULL; int iBand; const char *pszConfigFile = NULL; /* Check strict compilation and runtime library version as we use C++ API */ if (! GDAL_CHECK_VERSION(argv[0])) exit(1);/* -------------------------------------------------------------------- *//* Register standard GDAL drivers, and process generic GDAL *//* command options. *//* -------------------------------------------------------------------- */ GDALAllRegister(); argc = GDALGeneralCmdLineProcessor( argc, &argv, 0 ); if( argc < 1 ) exit( -argc );/* -------------------------------------------------------------------- *//* Handle command line arguments. *//* -------------------------------------------------------------------- */ for( i = 1; i < argc; i++ ) { if( EQUAL(argv[i], "--utility_version") ) { printf("%s was compiled against GDAL %s and is running against GDAL %s/n", argv[0], GDAL_RELEASE_NAME, GDALVersionInfo("RELEASE_NAME")); return 0; } else if( EQUAL(argv[i],"-of") && i < argc-1 ) pszFormat = argv[++i]; else if( EQUAL(argv[i],"-ot") && i < argc-1 ) { int iType; for( iType = 1; iType < GDT_TypeCount; iType++ ) { if( GDALGetDataTypeName((GDALDataType)iType) != NULL && EQUAL(GDALGetDataTypeName((GDALDataType)iType), argv[i+1]) ) { eOutputType = (GDALDataType) iType; } } if( eOutputType == GDT_Unknown ) { printf( "Unknown output pixel type: %s/n", argv[i+1] ); Usage(); GDALDestroyDriverManager(); exit( 2 ); } i++; } else if( EQUALN(argv[i],"-s_nodata",9) ) { // TODO i += 1; } else if( EQUAL(argv[i],"-co") && i < argc-1 ) { papszCreateOptions = CSLAddString( papszCreateOptions, argv[++i] ); } else if( EQUALN(argv[i],"-src_scale",10) && i < argc-2) { // TODO i += 2; } else if( EQUALN(argv[i],"-dst_scale",10) && i < argc-2 ) { // TODO i += 2; } else if( EQUAL(argv[i],"-config") && i < argc-1 ) { pszConfigFile = argv[++i]; } else if( EQUAL(argv[i],"-equalize") ) { pszMethod = "equalize";//.........这里部分代码省略.........
开发者ID:brunosimoes,项目名称:WorldWind,代码行数:101,
示例28: QgsDebugMsgLONG WINAPI QgsCrashHandler::handle( LPEXCEPTION_POINTERS exception ){ QgsDebugMsg( "CRASH!!!" ); DWORD processID = GetCurrentProcessId(); DWORD threadID = GetCurrentThreadId(); QString symbolPath; if ( !QgsApplication::isRunningFromBuildDir() ) { symbolPath = getenv( "QGIS_PREFIX_PATH" ); symbolPath = symbolPath + "//pdb;http://msdl.microsoft.com/download/symbols;http://download.osgeo.org/osgeo4w/symstore"; } else { QString pdbPath = getenv( "QGIS_PDB_PATH" ); QString appPath = QgsApplication::applicationDirPath(); symbolPath += QString( "%1;%2;http://msdl.microsoft.com/download/symbols;http://download.osgeo.org/osgeo4w/symstore" ) .arg( appPath ) .arg( pdbPath ); } QString ptrStr = QString( "0x%1" ).arg( ( quintptr )exception, QT_POINTER_SIZE * 2, 16, QChar( '0' ) ); QString fileName = QStandardPaths::standardLocations( QStandardPaths::TempLocation ).at( 0 ) + "/qgis-crash-info-" + QString::number( processID ); QgsDebugMsg( fileName ); QStringList arguments; arguments = QCoreApplication::arguments(); // TODO In future this needs to be moved out into a "session state" file because we can't trust this is valid in // a crash. arguments << QgsProject::instance()->fileName(); QStringList reportData; reportData.append( QStringLiteral( "QGIS Version: %1" ).arg( Qgis::QGIS_VERSION ) ); if ( QString( Qgis::QGIS_DEV_VERSION ) == QLatin1String( "exported" ) ) { reportData.append( QStringLiteral( "QGIS code branch: Release %1.%2" ) .arg( Qgis::QGIS_VERSION_INT / 10000 ).arg( Qgis::QGIS_VERSION_INT / 100 % 100 ) ); } else { reportData.append( QStringLiteral( "QGIS code revision: %1" ).arg( Qgis::QGIS_DEV_VERSION ) ); } reportData.append( QStringLiteral( "Compiled against Qt: %1" ).arg( QT_VERSION_STR ) ); reportData.append( QStringLiteral( "Running against Qt: %1" ).arg( qVersion() ) ); reportData.append( QStringLiteral( "Compiled against GDAL: %1" ).arg( GDAL_RELEASE_NAME ) ); reportData.append( QStringLiteral( "Running against GDAL: %1" ).arg( GDALVersionInfo( "RELEASE_NAME" ) ) ); QFile file( fileName ); if ( file.open( QIODevice::WriteOnly | QIODevice::Text ) ) { QTextStream stream( &file ); stream << QString::number( processID ) << endl; stream << QString::number( threadID ) << endl; stream << ptrStr << endl; stream << symbolPath << endl; stream << arguments.join( " " ) << endl; stream << reportData.join( "/n" ) << endl; } file.close(); QStringList args; args << fileName; QString prefixPath( getenv( "QGIS_PREFIX_PATH" ) ? getenv( "QGIS_PREFIX_PATH" ) : QApplication::applicationDirPath() ); QString path = prefixPath + "/qgiscrashhandler.exe"; QgsDebugMsg( path ); QProcess::execute( path, args ); return TRUE;}
开发者ID:CS-SI,项目名称:QGIS,代码行数:75,
注:本文中的GDALVersionInfo函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GDBUS_METHOD函数代码示例 C++ GDALSwapWords函数代码示例 |