[gdal-dev] GDALDriver question

Even Rouault even.rouault at mines-paris.org
Wed Feb 10 15:12:28 EST 2010


Did you have a look at http://gdal.org/gdal_8h.html ?

Extract from gcore/gdal_misc.cpp that answer all your questions :

/* -------------------------------------------------------------------- */
/*      --formats                                                       */
/* -------------------------------------------------------------------- */
        else if( EQUAL(papszArgv[iArg], "--formats") )
        {
            int iDr;

            printf( "Supported Formats:\n" );
            for( iDr = 0; iDr < GDALGetDriverCount(); iDr++ )
            {
                GDALDriverH hDriver = GDALGetDriver(iDr);
                const char *pszRWFlag, *pszVirtualIO;
                
                if( GDALGetMetadataItem( hDriver, GDAL_DCAP_CREATE, NULL ) )
                    pszRWFlag = "rw+";
                else if( GDALGetMetadataItem( hDriver, GDAL_DCAP_CREATECOPY, 
                                              NULL ) )
                    pszRWFlag = "rw";
                else
                    pszRWFlag = "ro";
                
                if( GDALGetMetadataItem( hDriver, GDAL_DCAP_VIRTUALIO, NULL) )
                    pszVirtualIO = "v";
                else
                    pszVirtualIO = "";

                printf( "  %s (%s%s): %s\n",
                        GDALGetDriverShortName( hDriver ),
                        pszRWFlag, pszVirtualIO,
                        GDALGetDriverLongName( hDriver ) );
            }

            CSLDestroy( papszReturn );
            return 0;
        }



Le Wednesday 10 February 2010 21:09:21 Alejandro Mostovoi, vous avez écrit :
> Hi All,
>
> I need to get the Long Format Name and the Code of GDAL Raster Formats
> (BMP, FAST, ENVI, etc) from a GDALDataset. I'm looking for a method like
> OGRSFDriver::GetName();
>
> Any idea?
>
> Thanks in Advance.
> Alejandro.




More information about the gdal-dev mailing list