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

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

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

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

在下文中一共展示了CPLSetConfigOption函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: EarlySetConfigOptions

void EarlySetConfigOptions( int argc, char ** argv ){    // Must process some config options before GDALAllRegister() or    // OGRRegisterAll(), but we can't call GDALGeneralCmdLineProcessor() or    // OGRGeneralCmdLineProcessor(), because it needs the drivers to be    // registered for the --format or --formats options.    for( int i = 1; i < argc; i++ )    {        if( EQUAL(argv[i],"--config") && i + 2 < argc &&            (EQUAL(argv[i + 1], "GDAL_SKIP") ||             EQUAL(argv[i + 1], "GDAL_DRIVER_PATH") ||             EQUAL(argv[i + 1], "OGR_SKIP") ||             EQUAL(argv[i + 1], "OGR_DRIVER_PATH")) )        {            CPLSetConfigOption( argv[i+1], argv[i+2] );            i += 2;        }        else if( EQUAL(argv[i],"--debug") && i + 1 < argc )        {            CPLSetConfigOption( "CPL_DEBUG", argv[i+1] );            i += 1;        }    }}
开发者ID:ryandavid,项目名称:rotobox,代码行数:25,


示例3: simplet_init

// Initialize libraries, register the atexit handler and set up error reporting.void simplet_init() {  if (initialized) return;  CPLSetConfigOption("OGR_ENABLE_PARTIAL_REPROJECTION", "ON");#ifdef DEBUG  CPLSetConfigOption("CPL_DEBUG", "ON");#endif  OGRRegisterAll();  GDALAllRegister();  atexit(cleanup);  initialized = 1;};
开发者ID:propublica,项目名称:simple-tiles,代码行数:12,


示例4: update

	void update() const	{		QSettings settings;				/// /todo Build from driver list in GDAL/OGR >= 2.0		static const std::vector<QByteArray> default_extensions = { "shp", "shx" };		enabled_vector_extensions.reserve(default_extensions.size() + 3);		enabled_vector_extensions = default_extensions;				settings.beginGroup(gdal_manager_group);		if (settings.value(gdal_dxf_key).toBool())			enabled_vector_extensions.push_back("dxf");		if (settings.value(gdal_gpx_key).toBool())			enabled_vector_extensions.push_back("gpx");		if (settings.value(gdal_osm_key).toBool())			enabled_vector_extensions.push_back("osm");		settings.endGroup();				auto gdal_data = MapperResource::locate(MapperResource::GDAL_DATA);		if (!gdal_data.isEmpty())		{			// The user may overwrite this default in the settings.			CPLSetConfigOption("GDAL_DATA", gdal_data.toLatin1().constData());		}				settings.beginGroup(gdal_configuration_group);		QStringList new_parameters = settings.childKeys();		if (new_parameters.isEmpty())		{			// Default options for debugging and for some drivers			settings.setValue(QString::fromLatin1("CPL_DEBUG"), QVariant{QLatin1String("OFF")});			settings.setValue(QString::fromLatin1("USE_PROJ_480_FEATURES"), QVariant{QLatin1String("YES")});			settings.setValue(QString::fromLatin1("OSM_USE_CUSTOM_INDEXING"), QVariant{QLatin1String("NO")});			new_parameters = settings.childKeys();		}				new_parameters.sort();		for (auto parameter : new_parameters)		{			CPLSetConfigOption(parameter.toLatin1().constData(), settings.value(parameter).toByteArray().constData());		}		for (auto parameter : static_cast<const QStringList&>(applied_parameters))		{			if (!new_parameters.contains(parameter)			    && parameter != QLatin1String{ "GDAL_DATA" })			{				CPLSetConfigOption(parameter.toLatin1().constData(), nullptr);			}		}		applied_parameters.swap(new_parameters);				dirty = false;	}
开发者ID:sembruk,项目名称:mapper,代码行数:53,


示例5: wxString

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


示例6: CPLSetConfigOption

QgsShapeFile::QgsShapeFile( QString name, QString encoding ){  fileName = name;  features = 0;  QgsApplication::registerOgrDrivers();  QSettings settings;  CPLSetConfigOption( "SHAPE_ENCODING", settings.value( "/qgis/ignoreShapeEncoding", true ).toBool() ? "" : 0 );  ogrDataSource = OGROpen( TO8F( fileName ), false, NULL );  if ( ogrDataSource != NULL )  {    valid = true;    ogrLayer = OGR_DS_GetLayer( ogrDataSource, 0 );    features = OGR_L_GetFeatureCount( ogrLayer, true );  }  else    valid = false;  setDefaultTable();  // init the geometry types  geometries << "NULL" << "POINT" << "LINESTRING" << "POLYGON" << "MULTIPOINT"  << "MULTILINESTRING" << "MULTIPOLYGON" << "GEOMETRYCOLLECTION";  codec = QTextCodec::codecForName( encoding.toLocal8Bit().constData() );  if ( !codec )    codec = QTextCodec::codecForLocale();  Q_ASSERT( codec );}
开发者ID:ChowZenki,项目名称:QGIS,代码行数:28,


示例7: msApplyMapConfigOptions

void msApplyMapConfigOptions( mapObj *map ){    const char *key;    for( key = msFirstKeyFromHashTable( &(map->configoptions) );         key != NULL;         key = msNextKeyFromHashTable( &(map->configoptions), key ) )    {        const char *value = msLookupHashTable( &(map->configoptions), key );        if( strcasecmp(key,"PROJ_LIB") == 0 )        {            msSetPROJ_LIB( value, map->mappath );        }        else if( strcasecmp(key,"MS_ERRORFILE") == 0 )        {            msSetErrorFile( value, map->mappath );        }        else         {#if defined(USE_GDAL) && GDAL_RELEASE_DATE > 20030601            CPLSetConfigOption( key, value );#endif        }       }}
开发者ID:codeforeurope,项目名称:gim,代码行数:27,


示例8: GDALAllRegister

void SmallpatchSieveFilter::SieveFilter(const char* Src_path, const char* Dst_Path, int SizeThresthod, int Connectedness){	GDALAllRegister();	CPLSetConfigOption("GDAL_FILENAME_IS_UTF8","NO");	GDALDriver* poDriver = GetGDALDriverManager()->GetDriverByName("GTIFF");	if (poDriver == NULL)	{		cout << "不能创建指定类型的文件:" << endl;	}	GDALDataset* poSrc = (GDALDataset*)GDALOpen(Src_path,GA_ReadOnly);	int NewBandXsize = poSrc->GetRasterXSize();	int NewBandYsize = poSrc->GetRasterYSize();	GDALDataType Type = poSrc->GetRasterBand(1)->GetRasterDataType();		GDALDataset* poDstDS = poDriver->Create(Dst_Path, NewBandXsize, NewBandYsize, 1, Type, NULL);	double GeoTrans[6] = { 0 };	poSrc->GetGeoTransform(GeoTrans);	poDstDS->SetGeoTransform(GeoTrans);	poDstDS->SetProjection(poSrc->GetProjectionRef());	GDALRasterBandH HImgBand = (GDALRasterBandH)poSrc->GetRasterBand(1);	GDALRasterBandH HPDstDSBand = (GDALRasterBandH)poDstDS->GetRasterBand(1);	GDALSetRasterColorTable(HPDstDSBand, GDALGetRasterColorTable(HImgBand));	GDALSieveFilter(HImgBand, NULL, HPDstDSBand, SizeThresthod, Connectedness, NULL, NULL, NULL);	GDALClose((GDALDatasetH)poDstDS);};
开发者ID:Diyanan,项目名称:diyn,代码行数:27,


示例9: CreateFile

void CreateFile(const char *srcfile,const char *dstfile){	GDALAllRegister();	CPLSetConfigOption("GDAL_FILENAME_IS_UTF8","NO");	GDALDataset *pDataset=(GDALDataset *) GDALOpen( srcfile, GA_ReadOnly );	int bandNum=pDataset->GetRasterCount();	GDALRasterBand *pBand=pDataset->GetRasterBand(1);	GDALDataType dataType=pBand->GetRasterDataType();	GDALDriver *pDriver=GetGDALDriverManager()->GetDriverByName("GTiff");	GDALDataset *dstDataset=pDriver->Create(dstfile,800,800,bandNum,dataType,NULL);	GDALRasterBand *dstBand;	//写入光栅数据	ushort *buf= new ushort[800*800];	for (int i=1;i<=bandNum;i++)	{		pBand=pDataset->GetRasterBand(i);		pBand->RasterIO(GF_Read,3388,2204,800,800,buf,800,800,dataType,0,0);		dstBand=dstDataset->GetRasterBand(i);		dstBand->RasterIO(GF_Write,0,0,800,800,buf,800,800,dataType,0,0);	}	delete []buf;	GDALClose(pDataset);	GDALClose(dstDataset);}
开发者ID:Slipperboy,项目名称:ImageDisplay,代码行数:25,


示例10: init_ogr

    void init_ogr(const std::string& outfile) {        OGRRegisterAll();        const char* driver_name = "SQLite";        OGRSFDriver* driver = OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(driver_name);        if (driver == NULL) {            std::cerr << driver_name << " driver not available./n";            exit(1);        }        CPLSetConfigOption("OGR_SQLITE_SYNCHRONOUS", "FALSE");        const char* options[] = { "SPATIALITE=TRUE", NULL };        m_data_source = driver->CreateDataSource(outfile.c_str(), const_cast<char**>(options));        if (m_data_source == NULL) {            std::cerr << "Creation of output file failed./n";            exit(1);        }        m_layer_point   = init_layer("planet_osm_point",   m_fields_nodes, wkbPoint);        m_layer_line    = init_layer("planet_osm_line",    m_fields_ways,  wkbLineString);        m_layer_polygon = init_layer("planet_osm_polygon", m_fields_areas, wkbMultiPolygon);        stringv fields_roads;        fields_roads.push_back("railway");        fields_roads.push_back("highway");        fields_roads.push_back("boundary");        m_layer_roads = init_layer("planet_osm_roads", fields_roads, wkbLineString);    }
开发者ID:aidiandin,项目名称:hot-exports,代码行数:29,


示例11: QgsDebugMsg

void QgsApplication::applyGdalSkippedDrivers(){  mGdalSkipList.removeDuplicates();  QString myDriverList = mGdalSkipList.join( " " );  QgsDebugMsg( "Gdal Skipped driver list set to:" );  QgsDebugMsg( myDriverList );  CPLSetConfigOption( "GDAL_SKIP", myDriverList.toUtf8() );  GDALAllRegister(); //to update driver list and skip missing ones}
开发者ID:brushtyler,项目名称:Quantum-GIS,代码行数:9,


示例12: set_conf_value

static char* set_conf_value(const char* key, const char* value){    const char* old_val_const;    char* old_val = NULL;    old_val_const = CPLGetConfigOption(key, NULL);    if( old_val_const != NULL )        old_val = strdup(old_val_const);    /* Prevent a directory listing to be done */    CPLSetConfigOption(key, value);    return old_val;}
开发者ID:tsallinen,项目名称:mapcache,代码行数:11,


示例13: CPLSetConfigOption

//辐射校正处理=====================================================================================================================================================================================//绝对辐射校正long QPDLevel1Process::Level1Proc_RadiationAbsolute(const char* pathImg, const char* pathImgRad, const char* pathAbsRegFile){	CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "NO");	//中文路径	GDALAllRegister();	long lError = 0;	unsigned short *imgBuffer = NULL;	//影像数据	float* parametersA = NULL, *parametersB = NULL, *parametersAux = NULL;//校正系数	GDALDatasetH m_dataset = GDALOpen(pathImg, GA_ReadOnly);	int xsize = GDALGetRasterXSize(m_dataset);	int ysize = GDALGetRasterYSize(m_dataset);	int bands = GDALGetRasterCount(m_dataset);	char **papszOptions = NULL;	papszOptions = CSLSetNameValue(papszOptions, "INTERLEAVE", "BAND");	GDALDatasetH m_datasetdst = GDALCreate(GDALGetDriverByName("GTiff"), pathImgRad, xsize, ysize, bands, GDT_UInt16, papszOptions);	//int nSamples, nLines, nLevels;	//LevelProc_GetParameterInfo(pathImgRad, nSamples, nLines, nLevels);	try	{		parametersA = new float[bands];		parametersB = new float[bands];		imgBuffer = new unsigned short[xsize*ysize];	}	catch (bad_alloc)	{		printf("allocate memory error/n");		exit(-1);	}	Level1Proc_AbsoluteParameters(pathAbsRegFile, parametersA, parametersB);	for (int i = 0; i < bands; i++)	{		GDALRasterIO(GDALGetRasterBand(m_dataset, i + 1), GF_Read, 0, 0, xsize, ysize, imgBuffer, xsize, ysize, GDT_UInt16, 0, 0);		for (int j = 0; j < ysize; j++)		{			for (int k = 0; k < xsize; k++)			{				//扩大100倍精度为0.01				imgBuffer[k] = (unsigned short)((imgBuffer[j*xsize + k] * parametersA[i] + parametersB[i]) * 100);			}		}		GDALRasterIO(GDALGetRasterBand(m_datasetdst, i + 1), GF_Write, 0, 0, xsize, ysize, imgBuffer, xsize, ysize, GDT_UInt16, 0, 0);	}	delete[]parametersA; parametersA = NULL;	delete[]parametersB; parametersB = NULL;	delete[]imgBuffer;	 imgBuffer = NULL;	GDALClose(m_dataset);	GDALClose(m_datasetdst);	return lError;}
开发者ID:wuweiFrank,项目名称:rsProcess,代码行数:56,


示例14: GetConfig

bool wxGISApplicationBase::CreateApp(void){    wxGISAppConfig oConfig = GetConfig();	if(!oConfig.IsOk())		return false;    //load GDAL defaults    wxString sGDALCacheMax = oConfig.Read(enumGISHKCU, wxString(wxT("wxGISCommon/GDAL/cachemax")), wxString(wxT("128")));    CPLSetConfigOption("GTIFF_REPORT_COMPD_CS", "YES");    CPLSetConfigOption("GTIFF_ESRI_CITATION", "YES");    CPLSetConfigOption("GDAL_CACHEMAX", sGDALCacheMax.mb_str());    CPLSetConfigOption("LIBKML_USE_DOC.KML", "no");    CPLSetConfigOption("GDAL_USE_SOURCE_OVERVIEWS", "ON");    CPLSetConfigOption("OSR_USE_CT_GRAMMAR", "FALSE");    //GDAL_MAX_DATASET_POOL_SIZE    //OGR_ARC_STEPSIZE    //load commands	wxXmlNode* pCommandsNode = oConfig.GetConfigNode(enumGISHKCU, GetAppName() + wxString(wxT("/commands")));    if(pCommandsNode)		LoadCommands(pCommandsNode);    return true;}
开发者ID:GimpoByte,项目名称:nextgismanager,代码行数:29,


示例15: 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,


示例16: rtpg_assignHookGDALDataPath

/* postgis.gdal_datapath */static voidrtpg_assignHookGDALDataPath(const char *newpath, void *extra) {	POSTGIS_RT_DEBUGF(4, "newpath = %s", newpath);	POSTGIS_RT_DEBUGF(4, "gdaldatapath = %s", gdal_datapath);	/* clear finder cache */	CPLFinderClean();	/* clear cached OSR */	OSRCleanup();	/* set GDAL_DATA */	CPLSetConfigOption("GDAL_DATA", newpath);	POSTGIS_RT_DEBUGF(4, "GDAL_DATA = %s", CPLGetConfigOption("GDAL_DATA", ""));}
开发者ID:NianYue,项目名称:pipelinedb,代码行数:16,


示例17: LLVMFuzzerInitialize

int LLVMFuzzerInitialize(int* /*argc*/, char*** argv){    const char* exe_path = (*argv)[0];    if( CPLGetConfigOption("GDAL_DATA", nullptr) == nullptr )    {        CPLSetConfigOption("GDAL_DATA", CPLGetPath(exe_path));    }    CPLSetConfigOption("CPL_TMPDIR", "/tmp");    CPLSetConfigOption("DISABLE_OPEN_REAL_NETCDF_FILES", "YES");    // Disable PDF text rendering as fontconfig cannot access its config files    CPLSetConfigOption("GDAL_PDF_RENDERING_OPTIONS", "RASTER,VECTOR");    // to avoid timeout in WMS driver    CPLSetConfigOption("GDAL_WMS_ABORT_CURL_REQUEST", "YES");    CPLSetConfigOption("GDAL_HTTP_TIMEOUT", "1");    CPLSetConfigOption("GDAL_HTTP_CONNECTTIMEOUT", "1");    CPLSetConfigOption("GDAL_CACHEMAX", "1000"); // Limit to 1 GB    GDALAllRegister();    return 0;}
开发者ID:OSGeo,项目名称:gdal,代码行数:19,


示例18: GDALAllRegister

void HazePerfection::readHotImage(){	if (m_hotfilename.empty())		return;	const char *hotfile = m_hotfilename.c_str();	GDALAllRegister();	CPLSetConfigOption("GDAL_FILENAME_IS_UTF8", "NO");	hotDataset = (GDALDataset *)GDALOpen(hotfile, GA_ReadOnly);	if (hotDataset == nullptr)		return;	nXSize = hotDataset->GetRasterXSize();	nYSize = hotDataset->GetRasterYSize();	hotDataset->GetGeoTransform(sGeoTrans);	double minAndmax[2];	hotDataset->GetRasterBand(1)->ComputeRasterMinMax(false, minAndmax);	setInvertA(minAndmax[1] + 5.0);	setMarkB(0.0);}
开发者ID:MrXue,项目名称:removeHaze,代码行数:18,


示例19: MyOGRHandler

    MyOGRHandler(const std::string& filename) :        m_data_source(NULL),        m_layer_point(NULL),        m_filter(true),        m_tohstore() {        OGRRegisterAll();        OGRSFDriver* driver = OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName("PostgreSQL");        if (driver == NULL) {            std::cerr << "PostgreSQL OGR driver not available./n";            exit(1);        }        // using COPY is much faster than INSERT        CPLSetConfigOption("PG_USE_COPY", "YES");        const char* options[] = { NULL };        m_data_source = driver->CreateDataSource(filename.c_str(), const_cast<char**>(options));        if (m_data_source == NULL) {            std::cerr << "Database open failed./n";            exit(1);        }        // OGR can't create a table with hstore column, so we do it ourselves here        OGRLayer* dummy = m_data_source->ExecuteSQL("CREATE TABLE nodes (id VARCHAR, tags hstore);", NULL, NULL);        if (dummy) {            m_data_source->ReleaseResultSet(dummy);        }        dummy = m_data_source->ExecuteSQL("SELECT AddGeometryColumn('nodes', 'geom', 4326, 'POINT', 2);", NULL, NULL);        if (dummy) {            m_data_source->ReleaseResultSet(dummy);        }        m_layer_point = m_data_source->GetLayerByName("nodes");        if (!m_layer_point) {            std::cerr << "Something went wrong setting up the 'nodes' layer./n";            exit(1);        }        // using transactions makes this much faster than without        m_layer_point->StartTransaction();        m_filter.add(false, "created_by");        m_filter.add(false, "odbl");    }
开发者ID:Rub21,项目名称:osmium,代码行数:44,


示例20: initialize_database

OGRDataSource* initialize_database(const std::string& output_format, const std::string& output_filename) {    OGRRegisterAll();    OGRSFDriver* driver = OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(output_format.c_str());    if (!driver) {        std::cerr << output_format << " driver not available./n";        exit(1);    }    CPLSetConfigOption("OGR_SQLITE_SYNCHRONOUS", "FALSE");    const char* options[] = { "SPATIALITE=TRUE", nullptr };    OGRDataSource* data_source = driver->CreateDataSource(output_filename.c_str(), const_cast<char**>(options));    if (!data_source) {        std::cerr << "Creation of output file failed./n";        exit(1);    }    return data_source;}
开发者ID:thomersch,项目名称:libosmium,代码行数:19,


示例21: wxLogError

bool wxGISServer::SetupSys(const wxString &sSysPath){	//setup sys dir	if(!wxDirExists(sSysPath))	{		wxLogError(wxString::Format(_("wxGISServer: System folder is absent! Lookup path '%s'"), sSysPath.c_str()));		return false;	}	wxString sGdalDataDir = sSysPath + wxFileName::GetPathSeparator() + wxString(wxT("gdal")) + wxFileName::GetPathSeparator();	CPLSetConfigOption("GDAL_DATA", sGdalDataDir.mb_str(wxConvUTF8) );#ifdef HAVE_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    return true;}
开发者ID:GimpoByte,项目名称:nextgismanager,代码行数:20,


示例22: main

int main() {  CPLSetConfigOption("CPL_DEBUG", "ON");  simplet_map_t *map;  if (!(map = simplet_map_new())) exit(1);  simplet_map_set_slippy(map, 0, 0, 0);  simplet_map_set_size(map, 1000, 1000);  simplet_map_set_bgcolor(map, "#ddeeff");  simplet_vector_layer_t *layer =      simplet_map_add_vector_layer(map, "./data/ne_10m_admin_0_countries.shp");  simplet_query_t *query = simplet_vector_layer_add_query(      layer, "SELECT * from ne_10m_admin_0_countries");  simplet_query_add_style(query, "stroke", "#226688");  simplet_query_add_style(query, "line-join", "round");  simplet_query_add_style(query, "weight", "3");  simplet_query_t *query2 = simplet_vector_layer_add_query(      layer, "SELECT * from ne_10m_admin_0_countries");  simplet_query_add_style(query, "blend", "over");  simplet_query_add_style(query2, "weight", "0.5");  simplet_query_add_style(query2, "fill", "#d3e46f");  simplet_query_add_style(query2, "stroke", "#ffffff");  simplet_query_add_style(query2, "line-join", "round");  simplet_query_add_style(query2, "text-field", "NAME");  simplet_query_add_style(query2, "font", "Lucida Grande, Regular 8");  simplet_query_add_style(query2, "color", "#444444ff");  simplet_query_add_style(query2, "text-stroke-color", "#ffffffcc");  simplet_query_add_style(query2, "text-stroke-weight", "2");  simplet_query_add_style(query2, "letter-spacing", "1");  simplet_map_add_raster_layer(map, "./data/loss_1932_2010.tif");  if (simplet_map_is_valid(map)) simplet_map_render_to_png(map, "./out.png");  simplet_map_free(map);}
开发者ID:propublica,项目名称:simple-tiles,代码行数:40,


示例23: OGR2SQLITE_ogr_SetConfigOption

staticvoid OGR2SQLITE_ogr_SetConfigOption(sqlite3_context* pContext,                                    int argc, sqlite3_value** argv){    if( sqlite3_value_type (argv[0]) != SQLITE_TEXT )    {        sqlite3_result_null (pContext);        return;    }    if( sqlite3_value_type (argv[1]) != SQLITE_TEXT &&            sqlite3_value_type (argv[1]) != SQLITE_NULL )    {        sqlite3_result_null (pContext);        return;    }    const char* pszKey = (const char*)sqlite3_value_text(argv[0]);    const char* pszVal = (sqlite3_value_type (argv[1]) == SQLITE_TEXT) ?                         (const char*)sqlite3_value_text(argv[1]) : NULL;    CPLSetConfigOption(pszKey, pszVal);    sqlite3_result_null (pContext);}
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:22,


示例24: LLVMFuzzerInitialize

int LLVMFuzzerInitialize(int* /*argc*/, char*** argv){    const char* exe_path = (*argv)[0];    if( CPLGetConfigOption("GDAL_DATA", nullptr) == nullptr )    {        CPLSetConfigOption("GDAL_DATA", CPLGetPath(exe_path));    }    CPLSetConfigOption("CPL_TMPDIR", "/tmp");    CPLSetConfigOption("DISABLE_OPEN_REAL_NETCDF_FILES", "YES");    CPLSetConfigOption("GDAL_HTTP_TIMEOUT", "1");    CPLSetConfigOption("GDAL_HTTP_CONNECTTIMEOUT", "1");#ifdef OGR_SKIP    CPLSetConfigOption("OGR_SKIP", OGR_SKIP);#endif    REGISTER_FUNC();    return 0;}
开发者ID:hdfeos,项目名称:gdal,代码行数:17,


示例25: Create8BitImage

void Create8BitImage(const char *srcfile,const char *dstfile){	GDALAllRegister();	CPLSetConfigOption("GDAL_FILENAME_IS_UTF8","NO");	GDALDataset *pDataset=(GDALDataset *) GDALOpen( srcfile, GA_ReadOnly );	int bandNum=pDataset->GetRasterCount();	GDALDriver *pDriver=GetGDALDriverManager()->GetDriverByName("GTiff");	GDALDataset *dstDataset=pDriver->Create(dstfile,800,800,3,GDT_Byte,NULL);	GDALRasterBand *pBand;	GDALRasterBand *dstBand;	//写入光栅数据	ushort *sbuf= new ushort[800*800];	uchar *cbuf=new uchar[800*800];	for (int i=bandNum,j=1;i>=2;i--,j++)	{		pBand=pDataset->GetRasterBand(i);		pBand->RasterIO(GF_Read,0,0,800,800,sbuf,800,800,GDT_UInt16,0,0);		int bGotMin, bGotMax;		double adfMinMax[2];		adfMinMax[0] = pBand->GetMinimum( &bGotMin );		adfMinMax[1] = pBand->GetMaximum( &bGotMax );		if( ! (bGotMin && bGotMax) )			GDALComputeRasterMinMax((GDALRasterBandH)pBand, TRUE, adfMinMax);		MinMaxStretch(sbuf,cbuf,800,800,adfMinMax[0],adfMinMax[1]);		/*double min,max;		HistogramAccumlateMinMax16S(sbuf,800,800,&min,&max);		MinMaxStretchNew(sbuf,cbuf,800,800,min,max);*/		dstBand=dstDataset->GetRasterBand(j);		dstBand->RasterIO(GF_Write,0,0,800,800,cbuf,800,800,GDT_Byte,0,0);	}	delete []cbuf;	delete []sbuf;	GDALClose(pDataset);	GDALClose(dstDataset);}
开发者ID:Slipperboy,项目名称:ImageDisplay,代码行数:36,


示例26: main

//.........这里部分代码省略.........            {                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.");    if( nLevelCount == 0 && !bClean )        Usage("No overview level specified.");/* -------------------------------------------------------------------- *//*      Open data file.                                                 *//* -------------------------------------------------------------------- */    if (bReadOnly)        hDataset = NULL;    else    {        CPLPushErrorHandler( CPLQuietErrorHandler );        hDataset = GDALOpenEx( pszFilename, GDAL_OF_RASTER | GDAL_OF_UPDATE, NULL, papszOpenOptions, NULL );        CPLPopErrorHandler();    }    if( hDataset == NULL )        hDataset = GDALOpenEx( pszFilename, GDAL_OF_RASTER, NULL, papszOpenOptions, NULL );    CSLDestroy(papszOpenOptions);    papszOpenOptions = NULL;    if( hDataset == NULL )        exit( 2 );/* -------------------------------------------------------------------- *//*      Clean overviews.                                                *//* -------------------------------------------------------------------- */    if ( bClean &&        GDALBuildOverviews( hDataset,pszResampling, 0, 0,                              0, NULL, pfnProgress, NULL ) != CE_None )    {        printf( "Cleaning overviews failed./n" );        nResultStatus = 200;    }/* -------------------------------------------------------------------- *//*      Generate overviews.                                             *//* -------------------------------------------------------------------- */    //Only HFA support selected layers    if(nBandCount > 0)        CPLSetConfigOption( "USE_RRD", "YES" );    if (nLevelCount > 0 && nResultStatus == 0 &&        GDALBuildOverviews( hDataset,pszResampling, nLevelCount, anLevels,                             nBandCount, panBandList, pfnProgress, NULL ) != CE_None )    {        printf( "Overview building failed./n" );        nResultStatus = 100;    }/* -------------------------------------------------------------------- *//*      Cleanup                                                         *//* -------------------------------------------------------------------- */    GDALClose(hDataset);    CSLDestroy( papszArgv );    CPLFree(panBandList);    GDALDestroyDriverManager();    return nResultStatus;}
开发者ID:sameke,项目名称:node-gdal,代码行数:101,



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


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