Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++编写一个standalone的代码,无法加载plugins的问题。 #4

Open
yz271544 opened this issue Dec 14, 2024 · 1 comment
Open

Comments

@yz271544
Copy link

yz271544 commented Dec 14, 2024

我想写一个关于qgis的standalone的服务,开始使用pyqgis编写,后期才发现使用python无法将3d map view 加入到layout中,好像是因为PyQt3D的License问题,无法暴露这样的API。所以我想要用C++尝试编写,是不是就没有这个问题了。我使用C++不久,遇到一些问题,看到您的博客,对这块相当熟悉。

https://github.com/yz271544/qgis_demo1,这个地址是我的代码。我从QGIS下载源码,此刻我使用了master分支,应该是3.40.1之后的版本,在Ubuntu24.04环境进行了编译。这个项目我计划采用CMake搭建开发环境。但是我在运行的时候,发现好像无法加载wms的plugins,导致运行报错。

想要尝试用如下的代码打印一下加载的plugins,也失败了。摸不着头脑,无奈之下冒昧的联系了您。可否帮我解答一下,万分感谢。

    QgsPluginLayerRegistry* plugin_layer_registry = QgsApplication::pluginLayerRegistry();
    QStringList plugin_layer_types = plugin_layer_registry->pluginLayerTypes();
    qDebug() << "plugin type:" << plugin_layer_types;
    QgsPluginLayerType* wms_plugin_layer = plugin_layer_registry->pluginLayerType("wms");
    qDebug() << "wms plugin type:" << wms_plugin_layer;

我的email: yz271544@163.com

@yz271544
Copy link
Author

main.cpp的控制台输出如下:

/lyndon/iProject/cpath/qgis_demo1/cmake-build-debug/qgis_demo1
qgis_source: ""
qgis_provider_file: "wfs;wcs;arcgisvectortileservice;cesiumtiles;copc;ept;gdal;mbtilesvectortiles;memory;mesh_memory;ogr;quantizedmesh;sensorthings;tiledscene;vectortile;vpc;vtpkvectortiles;xyzvectortiles;wms"
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
plugin type: ""
Failed to load WMS plugin type
wms plugin type: 0x0
project instance:  QgsProject(0x57dc8cc82c00)
set title:  "My QGIS Project"
set crs:  "EPSG:3857"
baseTileUrl:  "http://47.94.145.6/map/lx/{z}/{x}/{y}.png"
baseTileName:  "BaseTile"
qCritical: "<p><b>Raster layer:</b> Cannot instantiate the 'wms' data provider"
qCritical: "Cannot instantiate the 'wms' data provider"
Error adding XYZ layer
save qgs file: "/lyndon/iProject/cpath/qgis_demo1/common/project/temp_project.qgs"
save qgz file: "/lyndon/iProject/cpath/qgis_demo1/common/project/project.qgz"

目录结构,插件目录下的文件权限是chmod 666的,用户和组都是root root,我用的账户为非root账户。

plugins

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant