当前位置: 首页>>代码示例>>C++>>正文


C++ GDALDriver::GetMetadataItem方法代码示例

本文整理汇总了C++中GDALDriver::GetMetadataItem方法的典型用法代码示例。如果您正苦于以下问题:C++ GDALDriver::GetMetadataItem方法的具体用法?C++ GDALDriver::GetMetadataItem怎么用?C++ GDALDriver::GetMetadataItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GDALDriver的用法示例。


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

示例1: CPL_get_rgdal_drivers

// [[Rcpp::export]]
Rcpp::List CPL_get_rgdal_drivers(int dummy) {

	int ndr = GetGDALDriverManager()->GetDriverCount();
	Rcpp::CharacterVector name(ndr);
	Rcpp::CharacterVector long_name(ndr);
	Rcpp::LogicalVector create(ndr);
	Rcpp::LogicalVector copy(ndr);
	Rcpp::LogicalVector vattr(ndr);
	Rcpp::LogicalVector rattr(ndr);
	Rcpp::LogicalVector vsi_attr(ndr);
	for (int i = 0; i < ndr; i++) {
		GDALDriver *pDriver = GetGDALDriverManager()->GetDriver(i);
		name(i) = GDALGetDriverShortName( pDriver );
		long_name(i) = GDALGetDriverLongName( pDriver );
		create(i) = (pDriver->GetMetadataItem(GDAL_DCAP_CREATE) != NULL);
		copy(i) =   (pDriver->GetMetadataItem(GDAL_DCAP_CREATECOPY) != NULL);
		vattr(i) =  (pDriver->GetMetadataItem(GDAL_DCAP_VECTOR) != NULL);
		rattr(i) =  (pDriver->GetMetadataItem(GDAL_DCAP_RASTER) != NULL);
		vsi_attr(i) =  (pDriver->GetMetadataItem(GDAL_DCAP_VIRTUALIO) != NULL);
	}
	return Rcpp::DataFrame::create(
		Rcpp::Named("name") = name,
		Rcpp::Named("long_name") = long_name,
		Rcpp::Named("write") = create,
		Rcpp::Named("copy") = copy,
		Rcpp::Named("is_raster") = rattr,
		Rcpp::Named("is_vector") = vattr,
		Rcpp::Named("vsi") = vsi_attr);
}
开发者ID:rundel,项目名称:sfr,代码行数:30,代码来源:gdal.cpp

示例2: GDALAllRegister

System::System()
{
    // setup GDAL
    GDALAllRegister();

    _trimOldestTiles = true;
    _numUnusedDatasetsToTrimFromCache = 10;
    _maxNumDatasets = (unsigned int)(double(vpb::getdtablesize()) * 0.8);

    _logDirectory = "logs";
    _taskDirectory = "tasks";

    _maxNumberOfFilesPerDirectory = 1000;

    readEnvironmentVariables();

    // preload the .osg plugin so its available in case we need to output source files containing core osg nodes
    osgDB::Registry::instance()->loadLibrary(osgDB::Registry::instance()->createLibraryNameForExtension("osg"));

    GDALDriverManager *driverManager = GetGDALDriverManager();
    if (driverManager)
    {
        for (int i = 0; i < driverManager->GetDriverCount(); ++i)
        {
            GDALDriver *driver = driverManager->GetDriver(i);
            if (driver)
            {
                const char *ext = driver->GetMetadataItem("DMD_EXTENSION");
                if (ext && strlen(ext) != 0)
                {
                    addSupportedExtension(ext,
                                          Source::IMAGE | Source::HEIGHT_FIELD,
                                          driver->GetMetadataItem(GDAL_DMD_LONGNAME));
                }
            }
        }
    }

    // add entries that GDAL doesn't list via it's DMD_EXTENSIONS but is known to support
    addSupportedExtension("jpeg", Source::IMAGE | Source::HEIGHT_FIELD, "JPEG");
    addSupportedExtension("tiff", Source::IMAGE | Source::HEIGHT_FIELD, "GeoTiff");
    addSupportedExtension("pgm", Source::IMAGE | Source::HEIGHT_FIELD, "Netpbm");
    addSupportedExtension("ppm", Source::IMAGE | Source::HEIGHT_FIELD, "Netpbm");

    addSupportedExtension("shp", Source::SHAPEFILE, "Shape file loader");

    addSupportedExtension("osgb", Source::MODEL, "OpenSceneGraph binary format");
    addSupportedExtension("osgx", Source::MODEL, "OpenSceneGraph xml format");
    addSupportedExtension("osgt", Source::MODEL, "OpenSceneGraph text/ascii format");

    addSupportedExtension("osg", Source::MODEL, "OpenSceneGraph .osg ascii format");
    addSupportedExtension("ive", Source::MODEL, "OpenSceneGraph .ive binary format");
}
开发者ID:nixz,项目名称:covise,代码行数:53,代码来源:System.cpp

示例3: GetGDALDriverManager

    GeoResource::GeoResource(int xsz, int ysz, int bsz, GDALDataType datatype, string filename, dictionary options)
        : _Filename(filename) {

        // format, driver, and file extension
        string format = Options::DefaultFormat();
        //if (format == "GTiff") options["COMPRESS"] = "LZW";
        GDALDriver *driver = GetGDALDriverManager()->GetDriverByName(format.c_str());
        // TODO check for null driver and create method
        // Check extension
        string ext = driver->GetMetadataItem(GDAL_DMD_EXTENSION);
        if (ext != "" && _Filename.extension().string() != ('.'+ext)) _Filename = boost::filesystem::path(_Filename.string() + '.' + ext);

        // add options
        char **papszOptions = NULL;
        if (options.size()) {
            for (dictionary::const_iterator imap=options.begin(); imap!=options.end(); imap++)
                papszOptions = CSLSetNameValue(papszOptions,imap->first.c_str(),imap->second.c_str());
        }

        // create file
        //BOOST_LOG_TRIVIAL(info) << Basename() << ": create new file " << xsz << " x " << ysz << " x " << bsz << std::endl;
        if (Options::Verbose() > 4)
            std::cout << Basename() << ": create new file " << xsz << " x " << ysz << " x " << bsz << std::endl;
        _GDALDataset.reset( driver->Create(_Filename.string().c_str(), xsz,ysz,bsz,datatype, papszOptions) );
        if (_GDALDataset.get() == NULL) {
            //BOOST_LOG_TRIVIAL(fatal) << "Error creating " << _Filename.string() << CPLGetLastErrorMsg() << std::endl;
            std::cout << "Error creating " << _Filename.string() << CPLGetLastErrorMsg() << std::endl;
        }
    }
开发者ID:Applied-GeoSolutions,项目名称:gippy,代码行数:29,代码来源:GeoResource.cpp

示例4: GetGDALDriverManager

GDALDriver *OGRSFDriverRegistrar::GetDriverByName( const char * pszName )

{
    GDALDriverManager* poDriverManager = GetGDALDriverManager();
    GDALDriver* poGDALDriver =
        poDriverManager->GetDriverByName(CPLSPrintf("OGR_%s", pszName));
    if( poGDALDriver == NULL )
        poGDALDriver = poDriverManager->GetDriverByName(pszName);
    if( poGDALDriver == NULL ||
        poGDALDriver->GetMetadataItem(GDAL_DCAP_VECTOR) == NULL )
        return NULL;
    return poGDALDriver;
}
开发者ID:Wedjaa,项目名称:node-gdal,代码行数:13,代码来源:ogrsfdriverregistrar.cpp

示例5: GetDriverCount

int OGRSFDriverRegistrar::GetDriverCount()

{
    /* We must be careful only to return drivers that are actual OGRSFDriver* */
    GDALDriverManager* poDriverManager = GetGDALDriverManager();
    int nTotal = poDriverManager->GetDriverCount();
    int nOGRDriverCount = 0;
    for(int i=0;i<nTotal;i++)
    {
        GDALDriver* poDriver = poDriverManager->GetDriver(i);
        if( poDriver->GetMetadataItem(GDAL_DCAP_VECTOR) != NULL )
            nOGRDriverCount ++;
    }
    return nOGRDriverCount;
}
开发者ID:Wedjaa,项目名称:node-gdal,代码行数:15,代码来源:ogrsfdriverregistrar.cpp

示例6: OGR_Dr_CopyDataSource

OGRDataSourceH OGR_Dr_CopyDataSource( OGRSFDriverH hDriver,
                                      OGRDataSourceH hSrcDS,
                                      const char *pszNewName,
                                      char **papszOptions )

{
    VALIDATE_POINTER1( hDriver, "OGR_Dr_CopyDataSource", NULL );
    VALIDATE_POINTER1( hSrcDS, "OGR_Dr_CopyDataSource", NULL );
    VALIDATE_POINTER1( pszNewName, "OGR_Dr_CopyDataSource", NULL );

    GDALDriver* poDriver = (GDALDriver*)hDriver;
    if( !poDriver->GetMetadataItem( GDAL_DCAP_CREATE ) )
    {
        CPLError( CE_Failure, CPLE_NotSupported,
                  "%s driver does not support data source creation.",
                  poDriver->GetDescription() );
        return NULL;
    }

    GDALDataset *poSrcDS = (GDALDataset*) hSrcDS;
    GDALDataset *poODS;

    poODS = poDriver->Create( pszNewName, 0, 0, 0, GDT_Unknown, papszOptions );
    if( poODS == NULL )
        return NULL;

/* -------------------------------------------------------------------- */
/*      Process each data source layer.                                 */
/* -------------------------------------------------------------------- */
    for( int iLayer = 0; iLayer < poSrcDS->GetLayerCount(); iLayer++ )
    {
        OGRLayer        *poLayer = poSrcDS->GetLayer(iLayer);

        if( poLayer == NULL )
            continue;

        poODS->CopyLayer( poLayer, poLayer->GetLayerDefn()->GetName(),
                          papszOptions );
    }

    return (OGRDataSourceH)poODS;
}
开发者ID:bbradbury,项目名称:lib_gdal,代码行数:42,代码来源:ogrsfdriver.cpp

示例7: RegisterDriver

void OGRSFDriverRegistrar::RegisterDriver( OGRSFDriver * poDriver )

{
    GDALDriver* poGDALDriver = (GDALDriver*) GDALGetDriverByName( poDriver->GetName() ) ;
    if( poGDALDriver == NULL)
    {
        poDriver->SetDescription( poDriver->GetName() );
        poDriver->SetMetadataItem("OGR_DRIVER", "YES");

        if( poDriver->GetMetadataItem(GDAL_DMD_LONGNAME) == NULL )
            poDriver->SetMetadataItem(GDAL_DMD_LONGNAME, poDriver->GetName() );

        poDriver->pfnOpenWithDriverArg = OpenWithDriverArg;

        if( poDriver->TestCapability(ODrCCreateDataSource) )
        {
            poDriver->SetMetadataItem( GDAL_DCAP_CREATE, "YES" );
            poDriver->pfnCreateVectorOnly = CreateVectorOnly;
        }
        if( poDriver->TestCapability(ODrCDeleteDataSource) )
        {
            poDriver->pfnDeleteDataSource = DeleteDataSource;
        }

        poDriver->SetMetadataItem( GDAL_DCAP_VECTOR, "YES" );

        GetGDALDriverManager()->RegisterDriver( poDriver );
    }
    else
    {
        if( poGDALDriver->GetMetadataItem("OGR_DRIVER") == NULL)
        {
            CPLError(CE_Failure, CPLE_AppDefined,
                    "A non OGR driver is registered with the same name: %s", poDriver->GetName());
        }
        delete poDriver;
    }
}
开发者ID:Wedjaa,项目名称:node-gdal,代码行数:38,代码来源:ogrsfdriverregistrar.cpp

示例8: FileExtension

 std::string FileExtension() {
     std::string format = Options::DefaultFormat();
     GDALDriver *driver = GetGDALDriverManager()->GetDriverByName(format.c_str());
     return driver->GetMetadataItem(GDAL_DMD_EXTENSION);
 }
开发者ID:Applied-GeoSolutions,项目名称:gippy,代码行数:5,代码来源:gip_gdal.cpp


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