Timeline for Convex hull for selected features - PyQGIS
Current License: CC BY-SA 4.0
19 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 1, 2022 at 15:36 | comment | added | nerdsconsider |
@ThomasG77 thanks!! I used your code to write a version for a buffer result = processing.run("native:buffer", {'INPUT':QgsProcessingFeatureSourceDefinition(layer.id(), True), 'DISTANCE':2.5, 'SEGMENTS':5, 'END_CAP_STYLE':1, 'JOIN_STYLE':1, 'MITER_LIMIT':2, 'DISSOLVE':True, 'OUTPUT':'memory:'}) QgsProject.instance().addMapLayer(result['OUTPUT'])
|
|
Feb 22, 2020 at 17:04 | vote | accept | Lorenzo | ||
Feb 22, 2020 at 17:04 | comment | added | Lorenzo | Now it really works! Sorry about my being noob and thanks | |
Feb 22, 2020 at 16:55 | comment | added | ThomasG77 |
Did you change the path '/data/convexhull.shp' to adapt to your own system? I've made some changes to use "in memory" layer to avoid the issue and another last line to add layer to the current QGIS project
|
|
Feb 22, 2020 at 16:53 | history | edited | ThomasG77 | CC BY-SA 4.0 |
added 75 characters in body
|
Feb 22, 2020 at 16:47 | comment | added | Lorenzo |
It says _core.QgsProcessingException: There were errors executing the algorithm. Probably there's some error in the layer. Thanks anyway for helping me!
|
|
Feb 22, 2020 at 16:39 | comment | added | ThomasG77 | Done an alternative calling script from processing toolbox to do the job. Hope this one works for you | |
Feb 22, 2020 at 16:38 | history | edited | ThomasG77 | CC BY-SA 4.0 |
added 419 characters in body
|
Feb 22, 2020 at 16:16 | comment | added | Lorenzo | Sorry, in my case this code produces nothing. I have no idea what the problem is. | |
Feb 22, 2020 at 16:08 | comment | added | ThomasG77 | Made change to merge all selected geometries. Should do what you expect due to your changes in edited answer | |
Feb 22, 2020 at 16:06 | history | edited | ThomasG77 | CC BY-SA 4.0 |
deleted 75 characters in body
|
Feb 22, 2020 at 16:00 | comment | added | Lorenzo | I edited my question, probably I was not clear enough. | |
Feb 22, 2020 at 15:57 | comment | added | ThomasG77 |
It works and only produce one convex hull polygon (normal with feat = layer.selectedFeatures()[0] part)
|
|
Feb 22, 2020 at 15:53 | comment | added | Lorenzo | What happens if you select multiple polygons? | |
Feb 22, 2020 at 15:47 | comment | added | ThomasG77 | I've added a GIF to explain my exact process to run the code | |
Feb 22, 2020 at 15:45 | history | edited | ThomasG77 | CC BY-SA 4.0 |
added 75 characters in body
|
Feb 22, 2020 at 15:40 | comment | added | ThomasG77 | I also use a polygon layer... Did you really select a feature in the original layer? | |
Feb 22, 2020 at 15:39 | comment | added | Lorenzo | Hi thanks for your answer. But also this solution does not work. Maybe the reason is that I'm using a polygon layer? | |
Feb 22, 2020 at 15:23 | history | answered | ThomasG77 | CC BY-SA 4.0 |