I'm making a plugin that converts vector .shp to raster .tif. This is the UI of the plugin. The ComboBox is the custom mMapLayerComboBox widget.
- After selecting a loaded shapefile in QGIS, what is the type of the
layer
object that I'll use in the python code as a shapefile? This is the code:
Also, OSGEO/OGR/GDAL needs a string as an argument (the pathfile of the shapefile to be exact) as input. So ogr.Open(layer)
gives an error.
This is the error:
But running ogr.Open(layer)
in Jupyter, where layer = 'datasets/input/Agriculture.shp'
gives no error and runs the code properly.
So, 2. How do I get the pathfile of the shapefile from the ComboBox? (if not ComboBox, what other widgets can I use)?