New answers tagged

0

You can very simply create a parallel line in your QGIS plugin based on QgsGeometry.offsetCurve method.


0

You can use a virtual layer with this query, where polygon is the name of your polygon layer, point the name of the point-layer and poly_id / pt_id the names of the respective unique id in the two layers: select pol.poly_id, poi.pt_id , pol.geometry from polygon as pol join point as poi on st_within(poi.geometry, pol.geometry) Red dots and red outline: ...


5

To create polygon from the lines, use Geometry by expression with this expression: make_polygon($geometry) To get the attribute value of overlapping points, use field calculator with this expression: array_first(overlay_contains('points', value)) Inputs are red points and red line; blue polygons created with step 1. Polygons are labeled with the expression ...


3

Try: Join attributes by location Takes an input vector layer and creates a new vector layer that is an extended version of the input one, with additional attributes in its attribute table.Takes an input vector layer and creates a new vector layer that is an extended version of the input one, with additional attributes in its attribute table.


3

It can't be a QGIS failure. Change the project CS to ESPG:4326 prior to the process. then it will be OK. If you desire the project CS to be ETRS89-extended, after the processing.


6

You can use "Vector General -> Save Vector Features to File" tool. In the tool window, you can set the coordinate precision using COORDINATE_PRECISION=NUMBER beneath "GDAL layer options".


2

not sure it is possible in a one-step scenario but u're able to test the following : selection by expression (select all with the ad-hoc expression) extract selected features


0

Most likely this is because feedback instance is terminated after postProcessAlgorithm method. The progress bar shows a busy indicator instead of a percentage of steps, since the first window does not know how long the second process opened by execAlgorithmDialog will take.


0

Answer from Greg Lee helped me, but we don't need to run within main, we do need to call initialize() though. from qgis.core import QgsApplication QgsApplication.setPrefixPath("C:/OSGeo4W/apps/qgis-ltr", True) # QgsApplication.prefixPath() app1 = QgsApplication([], False) app1.initQgis() from processing.core.Processing import Processing proc = ...


0

By seemingly dumb luck I figured out the problem. For anyone else who is struggling with this in the future: changing the reference system to EPSG:3785 solved the problem (perhaps others may work, or likely the one I had selected was not adequate.)


5

I would do a negative buffer and then a positive buffer something like 1.5 times larger than your negative buffer and then use that to clip your original layer. It's not perfect as you lose some of your "fingers" but it works pretty well. To figure out what the ideal buffer sizes are I use a buffer in a geometry generator to play with numbers.


3

The way I would approach this is to define a source raster and an output raster destination (which can be either a temporary or a file output, then copy the input raster using gdal translate, passing the output raster destination parameter as input. The output from the gdal translate algorithm is what you then pass as the input to the rasterize (overwrite ...


2

I'm not sure if this is the best approach, but I have used this method and it seems to work well. Basically, the idea is to declare an empty dictionary as a class attribute, use the QgsProcessingUtils.mapLayerFromString() method to construct QgsMapLayer objects from output layers and add them to the dict as values inside the processAlgorithm() method. Then ...


2

I'm not sure if these example scripts will work exactly the way you want but you are welcome to try them. The scripts are based on the template found here. One option is to use the materialize() method of QgsFeatureSource which returns a QgsVectorLayer. Example below: from qgis.PyQt.QtCore import QCoreApplication, QVariant from qgis.core import (...


0

UPDATE: The Help instructions given by processing.algorithmHelp("native:dissolve") suggest that the following INPUTS are acceptable: str: layer ID str: layer name str: layer source QgsProcessingFeatureSourceDefinition QgsProperty QgsVectorLayer Yet when I tried to pass a QgisVectorLayer directly, I encountered this error: results, ok = alg.run(...


5

You can change it in def initAlgorithm(). Just enter the name you wish in the specific parameter within self.tr(): self.addParameter( QgsProcessingParameterFeatureSink( self.OUTPUT, self.tr('Enter your desired Name here'))) To make the name dynamic, you need to follow this answer like this: def processAlgorithm(self, parameters, context, ...


Top 50 recent answers are included