Hot answers tagged

3

Good question!,you can find the provider in the "about" dialog. or if you want use python, you can obtain the initial providers list. @germán-carrillo suggestion QgsProviderRegistry.instance().providerList() which returns for the above list from the "about" diolog the following values: ['DB2', 'WFS', 'arcgisfeatureserver', 'arcgismapserver', '...


3

You have another function for doing this: from processing import execAlgorithmDialog params = {} # A dictionary to load some default value in the dialog execAlgorithmDialog('qgis:extractbyattribute', params)


2

If you use itertools python module and print all possibilities for intersections, you will have 2 points (0 as type geometry) and 4 MultiLineString geometries (1 as type geometry). You are only interested in MultiLineString geometries and target polygon id (in my case it was 0) for determining features indices of your "blue" polygons. So, with following ...


2

That's no how you call processing.run. You should check out the official QGIS documentation Basicaly, processing.run expects the algorithm identifier, and a dictionnary containing the processing parameters. This should work: processing.run( "qgis:mergevectorlayers", { "LAYERS": filelist, "OUTPUT": "P:/GIS/Basemapping/Topographic ...


2

You can directly produce features of concentric buffers as polygons by using linspace method from numpy python module. As you have in your attributes table 1440 features, I know that, in your case, polygon sides number is 360 for each one of your concentric buffers. Algorithm for extracting points for each polygon features is easily inferred; as it can be ...


2

The following script writes all fields from vector layers into a CSV file. Perhaps you have to make some changes, it is just a quick idea how to start: import csv group = QgsProject.instance().layerTreeRoot().children() layers = [ item.layer() for item in group ] #list of all layers for layer in layers: if layer.type()==0: #check if layertype is vector ...


2

I've found a solution based on this answer It's possible to specify the geometry type by adding |layername=my_geometry_type to the file path. So for example instead of using: iface.addVectorLayer(r'C:/myfile.osm', "mylines", "ogr") I can use iface.addVectorLayer(r'C:/myfile.osm'+'|layername=lines', "mylines", "ogr") To only load the lines.


1

With researches, i made this acceptable answer, without any loop. I assign QgsProcessingFeedback() to QProgressBar() and get a dynamic progression bar when processing is running : # Progression bar qgis.utils.iface.messageBar().clearWidgets() progressMessageBar = qgis.utils.iface.messageBar() progressbar = QProgressBar() progressMessageBar.pushWidget(...


1

In this case I found that I can use setTransformOriginPoint before my setRotation line to specify the point of rotation. self.rubberband.setTransformOriginPoint((self.rect.width()),(self.rect.height())) self.rubberband.setRotation(mapRotation) I thought it should be half hight, width bit that spun it off centre (code below) self....


1

# Your layer named dimensioning layer_dimensioning = QgsProject.instance().mapLayersByName("dimensioning")[0] # Provider in order to access your layer features provider_layer_dimensioning = layer_dimensioning.dataProvider() result = processing.run("qgis:explodelines", {'INPUT':temp_lines,'OUTPUT':'memory:'})["OUTPUT"] # Start edition layer_dimensioning....


1

The error is not in the scripts themselves but in the structure created. Having a folder called myplugin and a file also called myplugin. QGIS cannot distinguish between them when reloading. When changing the script name, the reload worked correctly. myplugin ├── _init__.py ├── myplugin_main.py ├── myplugin_algorithm.py └── ...


1

As @KadirSahbaz suggested I added import processing at the beginning. The code below works. from qgis import processing from qgis.processing import alg from qgis.core import QgsFeature, QgsWkbTypes, QgsField, QgsFields, QgsPointXY, QgsGeometry, \ QgsCoordinateReferenceSystem, QgsProcessingMultiStepFeedback, QgsVectorFileWriter, QgsVectorLayer, \ ...


1

This is my answer: layer = iface.activeLayer() feature = layer.getFeatures() d = QgsDistanceArea() d.setSourceCrs(layer.crs(), QgsProject.instance().transformContext()) d.setEllipsoid(QgsProject.instance().ellipsoid()) for feat in feature: print((d.convertLengthMeasurement(d.measureLength(feat.geometry()),1))*1000)


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