7

pluginname/ top-level package __init__.py initialize the package luniPlugin.py dialogs/ sub module select_feature_dialog.py . . You have to specify explicitly sub module in the same package using .(dot). Use .dialogs.select_feature_dialog (Relative import): from .dialogs....


5

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 Press "Run" You will probably get more points than you want / need, so for next step select the ...


3

Solution 1: 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. self.dlg.Isochrones_RequestIsochrones.clicked.connect(lambda: self.Isochrones_RequestIsochrones(selectedLayer)) After doing that, you don't need three lines in Isochrones_RequestIsochrones method....


3

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)) self.dlg.show() def adjust_sliders(self, slider_num, moved_value): if self.dlg.checkBox.isChecked(): ...


3

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 ...


3

because the server is down http://osm.inasafe.org/ Error 520 Ray ID: 560fb1f7a99df981 • 2020-02-06 19:57:59 UTC Web server is returning an unknown error


3

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)


3

For anyone interested, here is an implementation of a CheckableComboBox. class CheckableComboBox(QComboBox): # Subclass Delegate to increase item height class Delegate(QStyledItemDelegate): def sizeHint(self, option, index): size = super().sizeHint(option, index) size.setHeight(20) return size def ...


3

As The Qt Resource System Documentation says, 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 ...


2

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. EDIT value() and valueAs***() returns tuple where first element is actual value and ...


2

You can use Qt.MatchContains flag as filter mode. from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QCompleter completer = QCompleter() completer.setFilterMode(Qt.MatchContains) For further information: Filter Modes for QCompleter.


2

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 class ...


2

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 self.dlg.overrideButton....


2

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: SELECT * FROM points JOIN ...


1

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 uri="crs='EPSG:28992' url='https://services2.arcgis.com/chCSiGO4ORzXeSGk/arcgis/rest/services/...


1

You could add the command line option --noplugins when starting QGIS, see this question: Is there a QGIS 3 setting to completely turn off plugins?


1

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, ...


1

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, ...


1

You could try something like: paths = [] selected = self.tableWidget.selectedItems() if selected: for item in selected: if item.column() == 3: paths.append(item.data(0)) 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 ...


1

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][0] self.dlg.Isochrones_WalkSpeed_Override.setVectorLayer(selectedLayer) Having ...


1

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 : class My_dlg(QMainWindow): def __init__(self, parent=None): super(My_dlg, self).__init__(parent) self.canvas = QgsMapCanvas() self.layers = [] self.canvas.setCanvasColor(Qt....


1

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.


1

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 ...


1

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. EDIT: As of today (7 February 2020), there has been an additional update (v0.7.0), which ...


1

For future reference: in May 2019 the "Make Valid" tool was added to the core QGIS 3 Processing toolbox, as "Fix Geometries" within the Vector Geometry group.


1

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 ...


Only top voted, non community-wiki answers of a minimum length are eligible