您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GDALDestroyDriverManager函数代码示例

51自学网 2021-06-01 20:49:42
  C++
这篇教程C++ GDALDestroyDriverManager函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中GDALDestroyDriverManager函数的典型用法代码示例。如果您正苦于以下问题:C++ GDALDestroyDriverManager函数的具体用法?C++ GDALDestroyDriverManager怎么用?C++ GDALDestroyDriverManager使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了GDALDestroyDriverManager函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char* argv[]){    CPLJoinableThread* hThread;    printf("main thread %p/n", (void*)CPLGetPID());    argc = GDALGeneralCmdLineProcessor( argc, &argv, 0 );    CPLSetConfigOption("GDAL_CACHEMAX", "0");    CPLSetConfigOption("GDAL_DEBUG_BLOCK_CACHE", "ON");    MyDataset* poDS = new MyDataset();    char buf1[] = { 1 } ;    CPL_IGNORE_RET_VAL(GDALRasterIO(GDALGetRasterBand(poDS, 1), GF_Write, 0, 0, 1, 1, buf1, 1, 1, GDT_Byte, 0, 0));    hThread = CPLCreateJoinableThread(thread_func, NULL);    CPLSleep(0.3);    CPL_IGNORE_RET_VAL(GDALRasterIO(GDALGetRasterBand(poDS, 1), GF_Write, 1, 0, 1, 1, buf1, 1, 1, GDT_Byte, 0, 0));    GDALFlushCacheBlock();    CPLJoinThread(hThread);    delete poDS;    GDALDestroyDriverManager();    CSLDestroy( argv );    return 0;}
开发者ID:nextgis-borsch,项目名称:tests,代码行数:29,


示例2: GDALDestroyDriverManager

GDALImageFileType::~GDALImageFileType(void){#ifdef OSG_WITH_GDAL    GDALDestroyDriverManager();    CPLCleanupTLS();#endif}
开发者ID:DaveHarrison,项目名称:OpenSGDevMaster,代码行数:7,


示例3: while

GlobalEnvironment::~GlobalEnvironment(){    while (m_threadMap.size())    {        thread_map::iterator iter = m_threadMap.begin();        ThreadEnvironment* env = iter->second;        delete env;        m_threadMap.erase(iter);    }#ifdef PDAL_HAVE_PYTHON    if (m_pythonEnvironment)        delete m_pythonEnvironment;    m_pythonEnvironment = 0;#endif#ifdef PDAL_HAVE_GDAL    if (m_bIsGDALInitialized)    {        if (m_gdal_debug)            delete m_gdal_debug;                    (void) GDALDestroyDriverManager();        m_bIsGDALInitialized = false;    }#endif    return;}
开发者ID:mweisman,项目名称:PDAL,代码行数:29,


示例4: main

int main(int argc, char *argv[]){    QgsApplication app(argc, argv, TRUE);    qDebug() << "SRS DB path: " << app.srsDbFilePath();    WfipsMainWindow *mainWindow = new WfipsMainWindow();    mainWindow->show();    int rc = app.exec();    GDALDestroyDriverManager();    OGRCleanupAll();    return rc;}
开发者ID:firelab,项目名称:wfips,代码行数:11,


示例5: msGDALCleanup

void msGDALCleanup( void ){    if( bGDALInitialized )    {        int iRepeat = 5;        msAcquireLock( TLOCK_GDAL );#if GDAL_RELEASE_DATE > 20101207        {            /*             ** Cleanup any unreferenced but open datasets as will tend            ** to exist due to deferred close requests.  We are careful            ** to only close one file at a time before refecting the            ** list as closing some datasets may cause others to be             ** closed (subdatasets in a VRT for instance).            */            GDALDatasetH *pahDSList = NULL;            int nDSCount = 0;            int bDidSomething;            do {                int i;                GDALGetOpenDatasets( &pahDSList, &nDSCount );                bDidSomething = FALSE;                for( i = 0; i < nDSCount && !bDidSomething; i++ )                {                    if( GDALReferenceDataset( pahDSList[i] ) == 1 )                    {                        GDALClose( pahDSList[i] );                        bDidSomething = TRUE;                    }                    else                        GDALDereferenceDataset( pahDSList[i] );                }            } while( bDidSomething );        }#endif        while( iRepeat-- )            CPLPopErrorHandler();#if GDAL_RELEASE_DATE > 20021001        GDALDestroyDriverManager();#endif        msReleaseLock( TLOCK_GDAL );        bGDALInitialized = 0;    }}
开发者ID:mapserver,项目名称:mapserver-import,代码行数:51,


示例6: OGRCleanupAll

/** * /brief Cleanup all OGR related resources. * * FIXME */void OGRCleanupAll(){    GDALDestroyDriverManager();#if defined(WIN32) && defined(_MSC_VER)// Horrible hack: for some reason MSVC doesn't export those classes&symbols// if they are not referenced from the DLL itself    if(OGRwillNeverBeTrue)    {        OGRRegisterMutexedDataSource();        OGRRegisterMutexedLayer();        OGRCreateEmulatedTransactionDataSourceWrapper(NULL,NULL,FALSE,FALSE);    }#endif}
开发者ID:Wedjaa,项目名称:node-gdal,代码行数:20,


示例7: Usage

static void Usage(const char* pszErrorMsg = nullptr){    printf(        "Usage: gdal_grid [--help-general]/n"        "    [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64//n"        "          CInt16/CInt32/CFloat32/CFloat64}]/n"        "    [-of format] [-co /"NAME=VALUE/"]/n"        "    [-zfield field_name] [-z_increase increase_value] [-z_multiply multiply_value]/n"        "    [-a_srs srs_def] [-spat xmin ymin xmax ymax]/n"        "    [-clipsrc <xmin ymin xmax ymax>|WKT|datasource|spat_extent]/n"        "    [-clipsrcsql sql_statement] [-clipsrclayer layer]/n"        "    [-clipsrcwhere expression]/n"        "    [-l layername]* [-where expression] [-sql select_statement]/n"        "    [-txe xmin xmax] [-tye ymin ymax] [-outsize xsize ysize]/n"        "    [-a algorithm[:parameter1=value1]*]"        "    [-q]/n"        "    <src_datasource> <dst_filename>/n"        "/n"        "Available algorithms and parameters with their defaults:/n"        "    Inverse distance to a power (default)/n"        "        invdist:power=2.0:smoothing=0.0:radius1=0.0:radius2=0.0:angle=0.0:max_points=0:min_points=0:nodata=0.0/n"        "    Inverse distance to a power with nearest neighbor search/n"        "        invdistnn:power=2.0:radius=1.0:max_points=12:min_points=0:nodata=0/n"        "    Moving average/n"        "        average:radius1=0.0:radius2=0.0:angle=0.0:min_points=0:nodata=0.0/n"        "    Nearest neighbor/n"        "        nearest:radius1=0.0:radius2=0.0:angle=0.0:nodata=0.0/n"        "    Various data metrics/n"        "        <metric name>:radius1=0.0:radius2=0.0:angle=0.0:min_points=0:nodata=0.0/n"        "        possible metrics are:/n"        "            minimum/n"        "            maximum/n"        "            range/n"        "            count/n"        "            average_distance/n"        "            average_distance_pts/n"        "    Linear/n"        "        linear:radius=-1.0:nodata=0.0/n"        "/n");    if( pszErrorMsg != nullptr )        fprintf(stderr, "/nFAILURE: %s/n", pszErrorMsg);    GDALDestroyDriverManager();    exit( 1 );}
开发者ID:jef-n,项目名称:gdal,代码行数:47,


示例8: GDALExit

static int GDALExit( int nCode ){  const char  *pszDebug = CPLGetConfigOption("CPL_DEBUG",NULL);  if( pszDebug && (EQUAL(pszDebug,"ON") || EQUAL(pszDebug,"") ) )  {      GDALDumpOpenDatasets( stderr );    CPLDumpSharedList( NULL );  }  GDALDestroyDriverManager();#ifdef OGR_ENABLED  OGRCleanupAll();#endif  exit( nCode );}
开发者ID:sameke,项目名称:node-gdal,代码行数:17,


示例9: GDALDestroy

void GDALDestroy(void){    if( bGDALDestroyAlreadyCalled )        return;    bGDALDestroyAlreadyCalled = TRUE;    CPLDebug("GDAL", "In GDALDestroy - unloading GDAL shared library.");    bInGDALGlobalDestructor = TRUE;    GDALDestroyDriverManager();#ifdef OGR_ENABLED    OGRCleanupAll();#endif    bInGDALGlobalDestructor = FALSE;#ifndef _MSC_VER    CPLFinalizeTLS();#endif}
开发者ID:samalone,项目名称:gdal-ios,代码行数:18,


示例10: main

int main(int argc, char* argv[]){    /*printf("test_huge_mapping/n");    test_huge_mapping();*/    printf("Physical memory : " CPL_FRMT_GIB " bytes/n", CPLGetPhysicalRAM());    if( !test_two_pages() )        return 0;    test_raw_auto(TRUE);    test_raw_auto(FALSE);    CPLVirtualMemManagerTerminate();    GDALDestroyDriverManager();    return 0;}
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:18,


示例11: SetApplication

int wxGISServerApp::OnExit(){    if(m_pServer)        m_pServer->Exit();    SetApplication(NULL);#ifdef __WXMSW__    wxSocketBase::Shutdown();#endif	SerializeLibs();	GDALDestroyDriverManager();	OGRCleanupAll();	UnLoadLibs();#ifdef wxUSE_SNGLINST_CHECKER    wxDELETE( m_pChecker ); #endif    return wxAppConsole::OnExit();//success == true ? EXIT_SUCCESS : EXIT_FAILURE;}
开发者ID:GimpoByte,项目名称:nextgismanager,代码行数:23,


示例12: main

int 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,


示例13: main

//.........这里部分代码省略.........    papszTO = CSLSetNameValue( papszTO, "METHOD", "GCP_TPS" );    papszTO = CSLSetNameValue( papszTO, "NUM_THREADS", "4" );    papszTO = CSLSetNameValue( papszTO, "DST_SRS", pszSpaRefDef );    papszTO = CSLSetNameValue( papszTO, "SRC_SRS", pszSpaRefDef );    papszTO = CSLSetNameValue( papszTO, "INSERT_CENTER_LONG", "FALSE" );    GDALDriver *poOutputDriver = (GDALDriver *) GDALGetDriverByName( "GTiff" );    CPLSetConfigOption( "CHECK_WITH_INVERT_PROJ", "TRUE" );    void* hTransformArg = GDALCreateGenImgProjTransformer2( poSrcDataset, NULL, papszTO );    GDALTransformerInfo* psInfo = (GDALTransformerInfo*)hTransformArg;    double adfThisGeoTransform[6];    double adfExtent[4];    int nThisPixels, nThisLines;    // suggest the raster output size    if( GDALSuggestedWarpOutput2( poSrcDataset, psInfo->pfnTransform, hTransformArg, adfThisGeoTransform, &nThisPixels, &nThisLines, adfExtent, 0 ) != CE_None )    {        Usage( "Suggest Output failed" );        return EXIT_FAILURE;    }    adfThisGeoTransform[0] = DstEnv.MinX;    adfThisGeoTransform[3] = DstEnv.MaxY;    int nPixels = (int) ((DstEnv.MaxX - DstEnv.MinX) / adfThisGeoTransform[1] + 0.5);    int nLines = (int) ((DstEnv.MaxY - DstEnv.MinY) / -adfThisGeoTransform[5] + 0.5);    GDALSetGenImgProjTransformerDstGeoTransform( hTransformArg, adfThisGeoTransform);    // create new raster    CPLString sOutputRasterPath = CPLResetExtension(sFileName, "tif");    GDALDataset  *poDstDataset = poOutputDriver->Create(sOutputRasterPath, nPixels, nLines, poSrcDataset->GetRasterCount(), GDT_Byte, NULL );    if( NULL == poDstDataset )    {        Usage( "Create Output failed" );        return EXIT_FAILURE;    }    poDstDataset->SetProjection( pszSpaRefDef );    poDstDataset->SetGeoTransform( adfThisGeoTransform );#ifdef APRROX_MAXERROR    hTransformArg = GDALCreateApproxTransformer( GDALGenImgProjTransform,  hTransformArg, APRROX_MAXERROR);    GDALTransformerFunc pfnTransformer = GDALApproxTransform;    GDALApproxTransformerOwnsSubtransformer(hTransformArg, TRUE);#else    GDALTransformerFunc pfnTransformer = GDALGenImgProjTransform;#endif // APRROX_MAXERROR    // warp    GDALWarpOptions *psWO = GDALCreateWarpOptions();    psWO->eWorkingDataType = GDT_Byte;    psWO->eResampleAlg = GRA_NearestNeighbour;    psWO->hSrcDS = poSrcDataset;    psWO->hDstDS = poDstDataset;    psWO->pfnTransformer = pfnTransformer;    psWO->pTransformerArg = hTransformArg;    psWO->pfnProgress = GDALTermProgress;    psWO->nBandCount = poSrcDataset->GetRasterCount();    psWO->panSrcBands = (int *) CPLMalloc(psWO->nBandCount*sizeof(int));    psWO->panDstBands = (int *) CPLMalloc(psWO->nBandCount*sizeof(int));    for(int i = 0; i < psWO->nBandCount; ++i )    {        psWO->panSrcBands[i] = i+1;        psWO->panDstBands[i] = i+1;    }    GDALWarpOperation oWO;    if( oWO.Initialize( psWO ) == CE_None )    {#ifdef MULTI        if( oWO.ChunkAndWarpMulti( 0, 0, poDstDataset->GetRasterXSize(), poDstDataset->GetRasterYSize() ) != CE_None)#else //MULTI        if( oWO.ChunkAndWarpImage( 0, 0, poDstDataset->GetRasterXSize(), poDstDataset->GetRasterYSize() ) != CE_None)#endif //MULTI        {            const char* err = CPLGetLastErrorMsg();            Usage( CPLSPrintf("Warp failed.%s", err) );            return EXIT_FAILURE;        }    }    // cleanup    GDALDestroyWarpOptions( psWO );    CSLDestroy( papszTO );    CPLFree( pszSpaRefDef );    GDALClose( (GDALDatasetH) poSrcDataset );    GDALClose( (GDALDatasetH) poDstDataset );    GDALDestroyDriverManager();    return EXIT_SUCCESS;}
开发者ID:BishopGIS,项目名称:gisconf2015,代码行数:101,


示例14: main

int main(int argc, char* argv[]){    // Register GDAL/OGR drivers    ::GDALAllRegister();    ::OGRRegisterAll();    std::cout        << "GDAL C/C++ API tests"        << " (" << ::GDALVersionInfo("--version") << ")"        << "/n---------------------------------------------------------/n";    argc = GDALGeneralCmdLineProcessor( argc, &argv, 0 );    if (argc < 1)    {        std::cout            << "/n---------------------------------------------------------/n"            << "No tests to run/n";        return EXIT_SUCCESS;    }            // Initialize TUT framework    int nRetCode = EXIT_FAILURE;    {        tut::reporter visi;        tut::runner.get().set_callback(&visi);        try        {            if (argc == 1)            {                tut::runner.get().run_tests();            }            else if (argc == 2 && std::string(argv[1]) == "--list")            {                tut::groupnames gl = tut::runner.get().list_groups();                tut::groupnames::const_iterator b = gl.begin();                tut::groupnames::const_iterator e = gl.end();                tut::groupnames::difference_type d = std::distance(b, e);                std::cout << "Registered " << d << " test groups:/n" << std::endl;                while (b != e)                {                    std::cout << "  " << *b << std::endl;                    ++b;                }            }            else if (argc == 2 && std::string(argv[1]) != "--list")            {                tut::check_test_group(argv[1]);                tut::runner.get().run_tests(argv[1]);            }            else if (argc == 3)            {                tut::check_test_group(argv[1]);                tut::test_result result;                tut::runner.get().run_test(argv[1], std::atoi(argv[2]), result);            }            nRetCode = EXIT_SUCCESS;        }        catch (const std::exception& ex)        {            std::cerr << "GDAL C/C++ API tests error: " << ex.what() << std::endl;            nRetCode = EXIT_FAILURE;        }    }    CSLDestroy(argv);    GDALDestroyDriverManager();    OGRCleanupAll();    CPLDumpSharedList( NULL );    CPLCleanupTLS();    return nRetCode;}
开发者ID:Mavrx-inc,项目名称:gdal,代码行数:77,


示例15: main

//.........这里部分代码省略.........            eErr = GDALRasterIO ( hMaskBand, GF_Write, 0, iLine, nXSize, 1,                                  pabyMask, nXSize, 1, GDT_Byte,                                  0, 0 );                                         if( eErr != CE_None ) {                CPLError(CE_Warning, CPLE_AppDefined,                         "ERROR writeing out line to mask band.");               break;            }        }                if (!bQuiet)            GDALTermProgress( 0.5 * ((iLine+1) / (double) nYSize), NULL, NULL );    }/* -------------------------------------------------------------------- *//*      Now process from the bottom back up                            .*//* -------------------------------------------------------------------- */    memset( panLastLineCounts, 0, sizeof(int) * nXSize);        for( iLine = nYSize-1; iLine >= 0; iLine-- )    {        CPLErr eErr;        eErr = GDALDatasetRasterIO( hOutDS, GF_Read, 0, iLine, nXSize, 1,                                     pabyLine, nXSize, 1, GDT_Byte,                                     nDstBands, NULL, nDstBands, nXSize * nDstBands, 1 );        if( eErr != CE_None )            break;        /***** read the mask band line back in *****/        if (bSetMask) {            eErr = GDALRasterIO ( hMaskBand, GF_Read, 0, iLine, nXSize, 1,                                  pabyMask, nXSize, 1, GDT_Byte,                                  0, 0 );                                                                         if( eErr != CE_None )                break;        }                ProcessLine( pabyLine, pabyMask, 0, nXSize-1, nBands, nDstBands,                     nNearDist, nMaxNonBlack, bNearWhite, &oColors,                     panLastLineCounts,                     TRUE, // bDoHorizontalCheck                     TRUE, // bDoVerticalCheck                     TRUE  // bBottomUp                   );        ProcessLine( pabyLine, pabyMask, nXSize-1, 0, nBands, nDstBands,                     nNearDist, nMaxNonBlack, bNearWhite, &oColors,                     panLastLineCounts,                     TRUE,  // bDoHorizontalCheck                     FALSE, // bDoVerticalCheck                     TRUE   // bBottomUp                    );                eErr = GDALDatasetRasterIO( hOutDS, GF_Write, 0, iLine, nXSize, 1,                                     pabyLine, nXSize, 1, GDT_Byte,                                     nDstBands, NULL, nDstBands, nXSize * nDstBands, 1 );        if( eErr != CE_None )            break;        /***** write out the mask band line *****/        if (bSetMask) {            eErr = GDALRasterIO ( hMaskBand, GF_Write, 0, iLine, nXSize, 1,                                  pabyMask, nXSize, 1, GDT_Byte,                                  0, 0 );                                                                         if( eErr != CE_None )                break;        }                if (!bQuiet)            GDALTermProgress( 0.5 + 0.5 * (nYSize-iLine) / (double) nYSize,                             NULL, NULL );    }    CPLFree(pabyLine);    if (bSetMask)        CPLFree(pabyMask);        CPLFree( panLastLineCounts );    GDALClose( hOutDS );    if( hInDS != hOutDS )        GDALClose( hInDS );    GDALDumpOpenDatasets( stderr );    CSLDestroy( argv );    CSLDestroy( papszCreationOptions );    GDALDestroyDriverManager();        return 0;}
开发者ID:Joe-xXx,项目名称:gdal,代码行数:101,


示例16: main

//.........这里部分代码省略........./*      Create a transformation object from the source to               *//*      destination coordinate system.                                  *//* -------------------------------------------------------------------- */    if( nGCPCount != 0 && nOrder == -1 )    {        pfnTransformer = GDALTPSTransform;        hTransformArg =             GDALCreateTPSTransformer( nGCPCount, pasGCPs, FALSE );    }    else if( nGCPCount != 0 )    {        pfnTransformer = GDALGCPTransform;        hTransformArg =             GDALCreateGCPTransformer( nGCPCount, pasGCPs, nOrder, FALSE );    }    else    {        pfnTransformer = GDALGenImgProjTransform;        hTransformArg =             GDALCreateGenImgProjTransformer2( hSrcDS, hDstDS, papszTO );    }    CSLDestroy( papszTO );    if( hTransformArg == NULL )    {        exit( 1 );    }/* -------------------------------------------------------------------- *//*      Read points from stdin, transform and write to stdout.          *//* -------------------------------------------------------------------- */    while( !feof(stdin) )    {        char szLine[1024];        if( fgets( szLine, sizeof(szLine)-1, stdin ) == NULL )            break;        char **papszTokens = CSLTokenizeString(szLine);        double dfX, dfY, dfZ = 0.0;        int bSuccess = TRUE;        if( CSLCount(papszTokens) < 2 )        {            CSLDestroy(papszTokens);            continue;        }        dfX = atof(papszTokens[0]);        dfY = atof(papszTokens[1]);        if( CSLCount(papszTokens) >= 3 )            dfZ = atof(papszTokens[2]);        if( pfnTransformer( hTransformArg, bInverse, 1,                             &dfX, &dfY, &dfZ, &bSuccess )            && bSuccess )        {            printf( "%.15g %.15g %.15g/n", dfX, dfY, dfZ );        }        else        {            printf( "transformation failed./n" );        }        CSLDestroy(papszTokens);    }    if( nGCPCount != 0 && nOrder == -1 )    {        GDALDestroyTPSTransformer(hTransformArg);    }    else if( nGCPCount != 0 )    {        GDALDestroyGCPTransformer(hTransformArg);    }    else    {        GDALDestroyGenImgProjTransformer(hTransformArg);    }    if (nGCPCount)    {        GDALDeinitGCPs( nGCPCount, pasGCPs );        CPLFree( pasGCPs );    }    if (hSrcDS)        GDALClose(hSrcDS);    if (hDstDS)        GDALClose(hDstDS);    GDALDumpOpenDatasets( stderr );    GDALDestroyDriverManager();    CSLDestroy( argv );    return 0;}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:101,


示例17: main

//.........这里部分代码省略.........            }        }    }    else if(stOper == op_kpaths)    {        if(pszDataSource == NULL)            Usage("No network dataset provided");        if(nFromFID == -1 || nToFID == -1)            Usage("Invalid input from or to identificators");        // open        poDS = (GNMNetwork*) GDALOpenEx( pszDataSource,                             GDAL_OF_UPDATE | GDAL_OF_GNM, NULL, NULL, NULL );        if(NULL == poDS)        {            fprintf( stderr, "/nFailed to open network at %s/n", pszDataSource);            nRet = 1;            goto exit;        }        if(CSLFindName(papszALO, GNM_MD_NUM_PATHS) == -1)        {            CPLDebug("GNM", "No K in options, add %d value", nK);            papszALO = CSLAddNameValue(papszALO, GNM_MD_NUM_PATHS,                                       CPLSPrintf("%d", nK));        }        poResultLayer = poDS->GetPath(nFromFID, nToFID, GATKShortestPath,                                      papszALO);        if(NULL == pszDataset)        {            ReportOnLayer(poResultLayer, bQuiet == FALSE);        }        else        {            if(CreateAndFillOutputDataset(poResultLayer, pszDataset, pszFormat,                                          pszLayer, papszDSCO, papszLCO, bQuiet)                    != OGRERR_NONE)            {                nRet = 1;                goto exit;            }        }    }    else if(stOper == op_resource)    {        if(pszDataSource == NULL)            Usage("No network dataset provided");        // open        poDS = (GNMNetwork*) GDALOpenEx( pszDataSource,                             GDAL_OF_UPDATE | GDAL_OF_GNM, NULL, NULL, NULL );        if(NULL == poDS)        {            fprintf( stderr, "/nFailed to open network at %s/n", pszDataSource);            nRet = 1;            goto exit;        }        poResultLayer = poDS->GetPath(nFromFID, nToFID, GATConnectedComponents,                                      papszALO);        if(NULL == pszDataset)        {            ReportOnLayer(poResultLayer, bQuiet == FALSE);        }        else        {            if(CreateAndFillOutputDataset(poResultLayer, pszDataset, pszFormat,                                          pszLayer, papszDSCO, papszLCO, bQuiet)                    != OGRERR_NONE)            {                nRet = 1;                goto exit;            }        }    }    else    {        printf("/nNeed an operation. See help what you can do with gnmanalyse:/n");        Usage();    } exit:    CSLDestroy(papszDSCO);    CSLDestroy(papszLCO);    CSLDestroy(papszALO);    if(poResultLayer != NULL)        poDS->ReleaseResultSet(poResultLayer);    if( poDS != NULL )        GDALClose( (GDALDatasetH)poDS );    GDALDestroyDriverManager();    return nRet;}
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:101,


示例18: MAIN_START

MAIN_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,


示例19: main

int 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,


示例20: main

//.........这里部分代码省略.........        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();/* -------------------------------------------------------------------- *//*      Open dataset.                                                   *//* -------------------------------------------------------------------- */    hDataset = GDALOpen( pszFilename, GA_ReadOnly );        if( hDataset == NULL )    {        fprintf( stderr,                 "gdalinfo failed - unable to open '%s'./n",                 pszFilename );        CSLDestroy( argv );            GDALDumpOpenDatasets( stderr );        GDALDestroyDriverManager();        CPLDumpSharedList( NULL );        exit( 1 );    }    /* -------------------------------------------------------------------- *//*      Report general info.                                            *//* -------------------------------------------------------------------- */    hDriver = GDALGetDatasetDriver( hDataset );    printf( "Driver: %s/%s/n",            GDALGetDriverShortName( hDriver ),            GDALGetDriverLongName( hDriver ) );    papszFileList = GDALGetFileList( hDataset );    if( CSLCount(papszFileList) == 0 )    {        printf( "Files: none associated/n" );    }    else    {        printf( "Files: %s/n", papszFileList[0] );        for( i = 1; papszFileList[i] != NULL; i++ )            printf( "       %s/n", papszFileList[i] );    }    CSLDestroy( papszFileList );    printf( "Size is %d, %d/n",            GDALGetRasterXSize( hDataset ),             GDALGetRasterYSize( hDataset ) );/* -------------------------------------------------------------------- */
开发者ID:469447793,项目名称:World-Wind-Java,代码行数:67,


示例21: main

int 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,


示例22: main

//.........这里部分代码省略.........        }        else        {            Usage();        }    }    if( pszSrcFilename == NULL )        Usage();/* -------------------------------------------------------------------- *//*      Open the input file.                                            *//* -------------------------------------------------------------------- */    GDALDatasetH hSrcDS = GDALOpen( pszSrcFilename, GA_ReadOnly );    if( hSrcDS == NULL )        exit( 1 );/* ==================================================================== *//*      Process all bands.                                              *//* ==================================================================== */    int iBand;    int nBandCount = GDALGetRasterCount( hSrcDS );    for( iBand = 0; iBand < nBandCount; iBand++ )    {        GDALRasterBandH hBaseBand = GDALGetRasterBand( hSrcDS, iBand+1 );/* -------------------------------------------------------------------- *//*      Process all overviews.                                          *//* -------------------------------------------------------------------- */        int iOverview;        int nOverviewCount = GDALGetOverviewCount( hBaseBand );        for( iOverview = 0; iOverview < nOverviewCount; iOverview++ )        {            GDALRasterBandH hSrcOver = GDALGetOverview( hBaseBand, iOverview );            if (hSrcOver == NULL)            {                fprintf(stderr, "skipping overview %d as being null/n", iOverview);                continue;            }/* -------------------------------------------------------------------- *//*      Is this a requested overview?                                   *//* -------------------------------------------------------------------- */            if( nReqOverviewCount > 0 )            {                int i;                for( i = 0; i < nReqOverviewCount; i++ )                {                    if( anReqOverviews[i] == iOverview )                        break;                }                if( i == nReqOverviewCount )                    continue;            }/* -------------------------------------------------------------------- *//*      Create matching output file.                                    *//* -------------------------------------------------------------------- */            CPLString osFilename;            osFilename.Printf( "%s_%d_%d.tif",                               CPLGetBasename(pszSrcFilename),                               iBand+1, iOverview );            DumpBand( hSrcDS, hSrcOver, osFilename );            if( bMasks )            {                CPLString osFilename;                osFilename.Printf( "%s_%d_%d_mask.tif",                                CPLGetBasename(pszSrcFilename),                                iBand+1, iOverview );                DumpBand( hSrcDS, GDALGetMaskBand(hSrcOver), osFilename );            }        }/* -------------------------------------------------------------------- *//*      Do we dump the mask?                                            *//* -------------------------------------------------------------------- */        if( bMasks )        {            CPLString osFilename;            osFilename.Printf( "%s_%d_mask.tif",                               CPLGetBasename(pszSrcFilename),                               iBand+1 );            DumpBand( hSrcDS, GDALGetMaskBand(hBaseBand), osFilename );        }    }    GDALClose( hSrcDS );    CSLDestroy( argv );    GDALDestroyDriverManager();    return 0;}
开发者ID:StephenHolzman,项目名称:UVAmisc,代码行数:101,


示例23: main

//.........这里部分代码省略.........            }        }        else if ( EQUAL(argv[i], "-clipsrcsql") )        {            CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1);            pszClipSrcSQL = argv[i + 1];            i++;        }        else if ( EQUAL(argv[i], "-clipsrclayer") )        {            CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1);            pszClipSrcLayer = argv[i + 1];            i++;        }        else if ( EQUAL(argv[i], "-clipsrcwhere") )        {            CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1);            pszClipSrcWhere = argv[i + 1];            i++;        }        else if( EQUAL(argv[i],"-a_srs") )        {            CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1);            OGRSpatialReference oOutputSRS;            if( oOutputSRS.SetFromUserInput( argv[i+1] ) != OGRERR_NONE )            {                fprintf( stderr, "Failed to process SRS definition: %s/n",                          argv[i+1] );                GDALDestroyDriverManager();                exit( 1 );            }            oOutputSRS.exportToWkt( &pszOutputSRS );            i++;        }           else if( EQUAL(argv[i],"-a") )        {            CHECK_HAS_ENOUGH_ADDITIONAL_ARGS(1);            if ( ParseAlgorithmAndOptions( argv[++i], &eAlgorithm, &pOptions )                 != CE_None )            {                fprintf( stderr,                         "Failed to process algorithm name and parameters./n" );                exit( 1 );            }        }        else if( argv[i][0] == '-' )        {            Usage(CPLSPrintf("Unknown option name '%s'", argv[i]));        }        else if( pszSource == NULL )        {            pszSource = argv[i];        }        else if( pszDest == NULL )        {            pszDest = argv[i];
开发者ID:GeospatialDaryl,项目名称:VS2013__00_GDAL_111_x64,代码行数:67,


示例24: MAIN_START

//.........这里部分代码省略.........                else if( nMaxFieldSize == 0 ||                         strlen(projectionRef) <= nMaxFieldSize )                {                    OGR_F_SetFieldString(hFeature, i_SrcSRSName, projectionRef);                }                else                {                    char* pszProj4 = nullptr;                    if( OSRExportToProj4(hSourceSRS, &pszProj4) == OGRERR_NONE )                    {                        OGR_F_SetFieldString( hFeature, i_SrcSRSName,                                              pszProj4 );                        CPLFree(pszProj4);                    }                    else                    {                        OGR_F_SetFieldString( hFeature, i_SrcSRSName,                                              projectionRef );                    }                }            }            else if( eSrcSRSFormat == FORMAT_WKT )            {                if( nMaxFieldSize == 0 ||                    strlen(projectionRef) <= nMaxFieldSize )                {                    OGR_F_SetFieldString( hFeature, i_SrcSRSName,                                          projectionRef );                }                else                {                    fprintf(stderr,                            "Cannot write WKT for file %s as it is too long!/n",                            fileNameToWrite);                }            }            else if( eSrcSRSFormat == FORMAT_PROJ )            {                char* pszProj4 = nullptr;                if( OSRExportToProj4(hSourceSRS, &pszProj4) == OGRERR_NONE )                {                    OGR_F_SetFieldString( hFeature, i_SrcSRSName, pszProj4 );                    CPLFree(pszProj4);                }            }            else if( eSrcSRSFormat == FORMAT_EPSG )            {                if( pszAuthorityName != nullptr && pszAuthorityCode != nullptr )                    OGR_F_SetFieldString(                        hFeature, i_SrcSRSName,                        CPLSPrintf("%s:%s",                                   pszAuthorityName, pszAuthorityCode) );            }        }        if( hSourceSRS )            OSRDestroySpatialReference( hSourceSRS );        OGRGeometryH hPoly = OGR_G_CreateGeometry(wkbPolygon);        OGRGeometryH hRing = OGR_G_CreateGeometry(wkbLinearRing);        for( int k = 0; k < 5; k++ )            OGR_G_SetPoint_2D(hRing, k, adfX[k], adfY[k]);        OGR_G_AddGeometryDirectly( hPoly, hRing );        OGR_F_SetGeometryDirectly( hFeature, hPoly );        if( OGR_L_CreateFeature( hLayer, hFeature ) != OGRERR_NONE )        {           printf( "Failed to create feature in shapefile./n" );           break;        }        OGR_F_Destroy( hFeature );        CPLFree(fileNameToWrite);        GDALClose( hDS );    }    CPLFree(current_path);    if (nExistingFiles)    {        for( int i = 0; i < nExistingFiles; i++ )        {            CPLFree(existingFilesTab[i]);        }        CPLFree(existingFilesTab);    }    CPLFree(alreadyExistingProjectionRef);    if ( hTargetSRS )        OSRDestroySpatialReference( hTargetSRS );    GDALClose( hTileIndexDS );    GDALDestroyDriverManager();    OGRCleanupAll();    CSLDestroy(argv);    exit( 0 );}
开发者ID:AsgerPetersen,项目名称:gdal,代码行数:101,


示例25: rtpg_assignHookGDALEnabledDrivers

/* postgis.gdal_enabled_drivers */static voidrtpg_assignHookGDALEnabledDrivers(const char *enabled_drivers, void *extra) {	int enable_all = 0;	int disable_all = 0;	char **enabled_drivers_array = NULL;	int enabled_drivers_count = 0;	bool *enabled_drivers_found = NULL;	char *gdal_skip = NULL;	uint32_t i;	uint32_t j;	POSTGIS_RT_DEBUGF(4, "GDAL_SKIP = %s", CPLGetConfigOption("GDAL_SKIP", ""));	POSTGIS_RT_DEBUGF(4, "enabled_drivers = %s", enabled_drivers);	/* if NULL, nothing to do */	if (enabled_drivers == NULL)		return;	/* destroy the driver manager */	/* this is the only way to ensure GDAL_SKIP is recognized */	GDALDestroyDriverManager();	CPLSetConfigOption("GDAL_SKIP", NULL);	/* force wrapper function to call GDALAllRegister() */	rt_util_gdal_register_all(1);	enabled_drivers_array = rtpg_strsplit(enabled_drivers, " ", &enabled_drivers_count);	enabled_drivers_found = palloc(sizeof(bool) * enabled_drivers_count);	memset(enabled_drivers_found, FALSE, sizeof(bool) * enabled_drivers_count);	/* scan for keywords DISABLE_ALL and ENABLE_ALL */	disable_all = 0;	enable_all = 0;	if (strstr(enabled_drivers, GDAL_DISABLE_ALL) != NULL) {		for (i = 0; i < enabled_drivers_count; i++) {			if (strstr(enabled_drivers_array[i], GDAL_DISABLE_ALL) != NULL) {				enabled_drivers_found[i] = TRUE;				disable_all = 1;			}		}	}	else if (strstr(enabled_drivers, GDAL_ENABLE_ALL) != NULL) {		for (i = 0; i < enabled_drivers_count; i++) {			if (strstr(enabled_drivers_array[i], GDAL_ENABLE_ALL) != NULL) {				enabled_drivers_found[i] = TRUE;				enable_all = 1;			}		}	}	if (!enable_all) {		int found = 0;		uint32_t drv_count = 0;		rt_gdaldriver drv_set = rt_raster_gdal_drivers(&drv_count, 0);		POSTGIS_RT_DEBUGF(4, "driver count = %d", drv_count);		/* all other drivers than those in new drivers are added to GDAL_SKIP */		for (i = 0; i < drv_count; i++) {			found = 0;			if (!disable_all) {				/* gdal driver found in enabled_drivers, continue to thorough search */				if (strstr(enabled_drivers, drv_set[i].short_name) != NULL) {					/* thorough search of enabled_drivers */					for (j = 0; j < enabled_drivers_count; j++) {						/* driver found */						if (strcmp(enabled_drivers_array[j], drv_set[i].short_name) == 0) {							enabled_drivers_found[j] = TRUE;							found = 1;						}					}				}			}			/* driver found, continue */			if (found)				continue;			/* driver not found, add to gdal_skip */			if (gdal_skip == NULL) {				gdal_skip = palloc(sizeof(char) * (strlen(drv_set[i].short_name) + 1));				gdal_skip[0] = '/0';			}			else {				gdal_skip = repalloc(					gdal_skip,					sizeof(char) * (						strlen(gdal_skip) + 1 + strlen(drv_set[i].short_name) + 1					)				);				strcat(gdal_skip, " "); 			}			strcat(gdal_skip, drv_set[i].short_name);		}		for (i = 0; i < drv_count; i++) {//.........这里部分代码省略.........
开发者ID:NianYue,项目名称:pipelinedb,代码行数:101,


示例26: main

//.........这里部分代码省略.........        {            poDS = (GDALDataset*)GDALOpen(pszDataset, GA_ReadOnly);            if( poDS == NULL )                exit(1);        }        if( bMigrate )        {            Resource* psResource = (Resource*)CPLMalloc(sizeof(Resource));            psResource->poDS = poDS;            int nBufferSize;            if( eStrategy == STRATEGY_RANDOM )                nBufferSize = CreateRandomStrategyRequests(                        poDS, nMaxRequests, psGlobalRequestList, psGlobalRequestLast);            else if( eStrategy == STRATEGY_LINE )                nBufferSize = CreateLineStrategyRequests(                        poDS, nMaxRequests, psGlobalRequestList, psGlobalRequestLast);            else                nBufferSize = CreateBlockStrategyRequests(                        poDS, nMaxRequests, psGlobalRequestList, psGlobalRequestLast);            psResource->pBuffer = CPLMalloc(nBufferSize);            PutResourceAtEnd(psResource);        }        else        {            ThreadDescription sThreadDescription;            sThreadDescription.poDS = poDS;            sThreadDescription.psRequestList = NULL;            Request* psRequestLast = NULL;            if( eStrategy == STRATEGY_RANDOM )                sThreadDescription.nBufferSize = CreateRandomStrategyRequests(                        poDS, nMaxRequests, sThreadDescription.psRequestList, psRequestLast);            else if( eStrategy == STRATEGY_LINE )                sThreadDescription.nBufferSize = CreateLineStrategyRequests(                        poDS, nMaxRequests, sThreadDescription.psRequestList, psRequestLast);            else                sThreadDescription.nBufferSize = CreateBlockStrategyRequests(                        poDS, nMaxRequests, sThreadDescription.psRequestList, psRequestLast);            asThreadDescription.push_back(sThreadDescription);        }    }    if( bCreatedDataset && poMEMDS == NULL && bOnDisk )    {        CPLPushErrorHandler(CPLQuietErrorHandler);        VSIUnlink(pszDataset);        CPLPopErrorHandler();    }        if( bMigrate )    {        psLock = CPLCreateLock(LOCK_SPIN);    }    for(i = 0; i < nThreads; i++ )    {        CPLJoinableThread* pThread;        if( bMigrate )            pThread = CPLCreateJoinableThread(ThreadFuncWithMigration, NULL);        else            pThread = CPLCreateJoinableThread(ThreadFuncDedicatedDataset,                                              &(asThreadDescription[i]));        apsThreads.push_back(pThread);    }    for(i = 0; i < nThreads; i++ )    {        CPLJoinThread(apsThreads[i]);        if( !bMigrate && poMEMDS == NULL )            GDALClose(asThreadDescription[i].poDS);    }    while( psGlobalResourceList != NULL )    {        CPLFree( psGlobalResourceList->pBuffer);        if( poMEMDS == NULL )            GDALClose(psGlobalResourceList->poDS);        Resource* psNext = psGlobalResourceList->psNext;        CPLFree( psGlobalResourceList );        psGlobalResourceList = psNext;    }    if( psLock )    {        CPLDestroyLock( psLock );    }    if( bCreatedDataset && poMEMDS == NULL  )    {        CPLPushErrorHandler(CPLQuietErrorHandler);        VSIUnlink(pszDataset);        CPLPopErrorHandler();    }    if( poMEMDS )        GDALClose(poMEMDS);    assert( GDALGetCacheUsed64() == 0 );    GDALDestroyDriverManager();    CSLDestroy( argv );    return 0;}
开发者ID:nextgis-borsch,项目名称:tests,代码行数:101,


示例27: main

int 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,


示例28: main

int 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,


示例29: ProxyMain

//.........这里部分代码省略........./* -------------------------------------------------------------------- *//*      Handle command line arguments.                                  *//* -------------------------------------------------------------------- */    for( i = 1; i < argc; i++ )    {        if( EQUAL(argv[i],"-of") && i < argc-1 )            pszFormat = argv[++i];        else if( EQUAL(argv[i],"-q") || EQUAL(argv[i],"-quiet") )        {            bQuiet = TRUE;            pfnProgress = GDALDummyProgress;        }        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( EQUAL(argv[i],"-not_strict")  )            bStrict = FALSE;                    else if( EQUAL(argv[i],"-strict")  )            bStrict = TRUE;                    else if( EQUAL(argv[i],"-a_nodata") && i < argc - 1 )        {            if (EQUAL(argv[i+1], "none"))            {                bUnsetNoData = TRUE;            }            else            {                bSetNoData = TRUE;                dfNoDataReal = CPLAtofM(argv[i+1]);            }            i += 1;        }           else if( EQUAL(argv[i],"-co") && i < argc-1 )        {            papszCreateOptions = CSLAddString( papszCreateOptions, argv[++i] );        }           else if( EQUAL(argv[i],"-replace_ids") && i < argc-3 )	{
开发者ID:etiennesky,项目名称:scripts,代码行数:67,



注:本文中的GDALDestroyDriverManager函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ GDALGetDataTypeName函数代码示例
C++ GDALCreate函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。