• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ CPLSetConfigOption函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例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,代码来源:commonutils.cpp


示例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,代码来源:init.c


示例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,代码来源:gdal_manager.cpp


示例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,代码来源:applicationex.cpp


示例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,代码来源:qgsshapefile.cpp


示例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,代码来源:mapobject.c


示例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,代码来源:SieveFilter.cpp


示例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,代码来源:ImageDisplay.cpp


示例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,代码来源:cde.cpp


示例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,代码来源:qgsapplication.cpp


示例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,代码来源:cache_tiff.c


示例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,代码来源:QPDLevel1Process.cpp


示例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,代码来源:applicationbase.cpp


示例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,代码来源:OGRBasic.cpp


示例16: rtpg_assignHookGDALDataPath

/* postgis.gdal_datapath */
static void
rtpg_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,代码来源:rtpostgis.c


示例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,代码来源:gdal_translate_fuzzer.cpp


示例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,代码来源:RemoveHaze.cpp


示例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,代码来源:osmium_to_postgis.cpp


示例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,代码来源:testdata-multipolygon.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CPLStrdup函数代码示例发布时间:2022-05-30
下一篇:
C++ CPLResetExtension函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap