我按照这里的说明进行操作:
https://gis.stackexchange.com/questions/37111/how-to-install-qgis-on-centos-6
如果我运行:
QgsVectorLayer * vpoly = new QgsVectorLayer("Polygon", "pointbuffer", "memory");
QgsVectorDataProvider * provider = vpoly->dataProvider();
那么provider是一个NULL指针
另外,如果我这样做:
QString myPluginsDir = "/usr/lib64/qgis";
QgsProviderRegistry * preg = QgsProviderRegistry::instance(myPluginsDir);
QString pluglist=preg->pluginList();
printf("plugins: %s\n",pluglist.toStdString().c_str());
然后打印:
plugins: No data provider plugins are available. No vector layers can be loaded
此外,当我尝试使用以下内容加载 QgsVectorLayer 时:
QgsVectorLayer * mypLayer = new QgsVectorLayer(myLayerPath, myLayerBaseName, myProviderName);
if (mypLayer->isValid()){
qDebug("Layer is valid");
} else {
qDebug("Layer is NOT valid");
return;
}
然后它说该层无效。
这一切在 Ubuntu 中运行良好,但我无法在 centos 中运行。我想也许它缺少所有的插件。我错过了什么?
请帮忙。