0
我跟着這裏的指令QgsVectorLayer:如何創建QGIS在CentOS的(也許缺少插件包?)
https://gis.stackexchange.com/questions/37111/how-to-install-qgis-on-centos-6
如果我運行:
QgsVectorLayer * vpoly = new QgsVectorLayer("Polygon", "pointbuffer", "memory");
QgsVectorDataProvider * provider = vpoly->dataProvider();
然後供應商是一個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中工作。我想也許它缺少所有的插件。我錯過了什麼?
請幫忙。