3

I develop a plugin for QGIS. Before to integreted it in the QGIS I developped it with GIS library (Fiona, shapely, geopandas, ...) and it work well. Now I try to build it with plugin_builder of QGIS. The problem is I try to use my functions that I created with the previous libraries, but it seems like PyQGIS (QGIS) didn't recongnize them.

Is it possible to work with the GIS libraries to open, write a vector and make some processes in QGIS environment?

3

Yes, you can use those librairies in a qgis plugin as long as you install them on the folder sites-packages of the python called by qgis.

use OsGeo4W Shell to install them ( I use pip for that ) then you can call them from your plugin, also make sure that PYTHONHOME and PYTHONPATH environment variables are well set.

  • Doesn't that (using other library) make it harder to share the plugin ? – J.R Apr 17 at 14:36
  • @J.R I don't see the problem if the dependencies of the plugin are present in a requirements.txt file – Hicham Zouarhi Apr 17 at 14:39
  • If it's possible to use only PyQGIS then other don't have to install other library to use the plugin, not a big deal but easier for novice – J.R Apr 17 at 14:55
  • yes, indeed it would be easier, it depends if OP wants to share his plugin online or not – Hicham Zouarhi Apr 17 at 15:01
  • Thanks @HichamZouarhi for your answers. Yeah, J.R you are right, using only PyQGIS will make easier to install use the plugin, but for the moment i already finished it and i have use other libraries, and also i think Fiona and shapely are more easialy to use than PyQGIS. This is my opinion ;) – Elite Apr 17 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.