pluginname/ top-level package
__init__.py initialize the package
dialogs/ sub module
You have to specify explicitly sub module in the same package using .(dot).
Use .dialogs.select_feature_dialog (Relative import):
It is possible and you do not need a plugin for it (Assuming you are using QGIS3)
Zoom to an area covering where you want the points
Then, Go to Vector -> Research tools -> Regular points
Set input extent to Use Canvas extent and set point spacing to 1
You will probably get more points than you want / need, so for next step select the ...
When connecting a method to an object event (in this case click event) in PyQt, for passing an argument to that method, you can use lambda function.
After doing that, you don't need three lines in Isochrones_RequestIsochrones method....
Test-it in another method like that :
def run (self):
self.dlg = Dialog()
self.dlg.horizontalSlider.sliderMoved.connect(lambda v: self.adjust_sliders(1, v))
self.dlg.horizontalSlider_2.sliderMoved.connect(lambda v: self.adjust_sliders(2, v))
def adjust_sliders(self, slider_num, moved_value):
Try specifying the CRS when you construct your QgsVectorLayer object e.g.
v_layer = QgsVectorLayer('LineString?crs=epsg:4326', 'line', 'memory')
Unfortunately, you don't show us what objects you are passing to your drawLine() function as the line_start and line_end arguments, however running the code below which directly creates QgsPoint() objects for the ...
I encountered this problem. Some processing tools worked in QGIS 3.8, but doesn't work in QGIS 3.4.
I don't know the reason, but changing native word into qgis in all processing.run ("native:tool_name", ...) solved the problem. (native:intersection -> qgis:intersection)
For anyone interested, here is an implementation of a CheckableComboBox.
# Subclass Delegate to increase item height
def sizeHint(self, option, index):
size = super().sizeHint(option, index)
As The Qt Resource System
the main reason of using resource file is to avoid the risk of losing the files.
pyrcc5 generates all in one binary-like string which contains all resource files defined in .qrc file, and adds that string to .py file (in this case, resources.py), then you import that module (from .resources import * or from ...
I think, you should use toProperty() method, which returns QgsProperty. Then you can use value() or valueAs***() methods of QgsProperty to get value of defined expression. Or you can get raw expression string with expressionString() method. See docs for QgsProperty.
value() and valueAs***() returns tuple where first element is actual value and ...
You can use Qt.MatchContains flag as filter mode.
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QCompleter
completer = QCompleter()
For further information: Filter Modes for QCompleter.
You're right. QComboBox objects allow only single selection because they don't have ExtendedSelection option (as QListWidget objects) for activating multiple selection. However, you can also use a QTableWidget object whose ExtendedSelection option is already activated by default. In following code you have an example.
from PyQt5.QtCore import Qt
You need several things to correctly use your QgsPropertyOverrideButton.
Initializing the button
First, you may want to register an expression context generator, which will allow the use of global, project, and layer variables. QgsVectorLayer is a QgsExpressionContextGenerator, so you just have to call
One way to do this would be using a virtual layer.
Create X and Y fields in your point layer containing the x and y coordinates
Create a constant field with the same value
Save a copy of the point layer
Add a virtual layer joining by the constant value of both layers (original and copy) using the following expression:
To find the correct uri you can load the layer manually in QGIS 3 in the browser window / ArcGISFeatureServer and than look at the layer properties on information tab, there is the source written.
In your example you have to set the layernumber
Just create metadata for the services that can be accessed through an OGC CSW interface, for example you could use GeoNetwork for this. Then users of QGIS can access the list of services using the MetaSearch tool.
In this example we have a CSW catalogue of OneGeology services (and layers), and searching for all services/layers that have a minerals theme, ...
In QGIS you can make use of the virtual layers.
Go to Layer/ Add layer/ add-edit virtual layer and enter the following query. Feel free to add as many field as you want. The trick is to do a cross-join on the same table, generating every combination between the two layers.
select a.id, b.id, makeline(a.geometry, b.geometry) as geometry
from myLayer a, ...
You could try something like:
paths = 
selected = self.tableWidget.selectedItems()
for item in selected:
if item.column() == 3:
Assuming that the cells containing the file paths are in the 4th column (index 3) of your table widget. With this method, you can either select the entire row or ...
You could use the currentText() method to fetch the selected layer in the combo box.
layers = project.layerTreeRoot().children()
selectedLayerName = self.dlg.Isochrones_SelectInputLayer.currentText()
selectedLayer = [l.layer() for l in layers if l.name() == selectedLayerName]
The problem, I think is that you lost the reference to the QgsVectorLayer outside the function, the solution is to define self.layers, see below :
def __init__(self, parent=None):
self.canvas = QgsMapCanvas()
self.layers = 
Move self.pushButton_2.clicked.connect(self.OpenQgis) outside the loop otherwise you are attaching to the button multiple events.
It causes your "only" click to emit multiple calls and hence add multiple layers.
While building a plugin for QGIS using Plugin Builder, if you get ModuleNotFoundError: No module named '... .resources' error after running Makefile, you should first check if resources.py exists in the folder (source folder) created by Plugin Builder. If it does, copy that file into your plugin folder in QGIS plugin folder (target folder).
If there is no ...
The Resource Sharing plugin version 0.6.0 (available since 4 December 2018) was the first version to support QGIS 3. Some issues (https://github.com/akbargumbira/qgis_resources_sharing/issues), but it is still quite useful for sharing your resources with the community.
As of today (7 February 2020), there has been an additional update (v0.7.0), which ...
QGIS support for blobs is currently limited to disk-based layers like gpkg and memory layers, not databases. (See Load PostGIS Layer with BLOB and use the form widget for binary fields (QGIS 3.6) not working )
If you can live with this limitation, or if blob support is later expanded to additional providers, see my question and answer here: Display photo ...