Skip to main content

Timeline for answer to QgsFeatures fail to add to QgsVectorLayer by Taras

Current License: CC BY-SA 4.0

Post Revisions

7 events
when toggle format what by license comment
17 hours ago comment added Neph Thanks for the additional explanations! If I want to add attributes to the connecting line too, then I need a "real" layer (not a virtual one or Geometry Generator), correct? (This probably has the additional benefit of being able to export the line too.)
19 hours ago history edited Taras CC BY-SA 4.0
added 3322 characters in body
19 hours ago comment added Neph The points are pretty much in a straight line (with a little bit of offset). I was thinking about doing two layers, which is easy enough to do, as I already read the file, but it requires managing two layers and you have to switch. Can you also add attributes to the connections while using a Geometry Generator?
19 hours ago comment added Neph I found an earlier version of Joseph's answer (see link in my question) with with edit. So: Only access the QgsVectorDataProvider to set the layer attribute fields, without keeping a reference, then use with edit on the layer (no extra startEditing and commitChanges needed) to add the features? What's the difference between QgsMemoryProviderUtils.createMemoryLayer() and using QgsVectorLayer directly? Only that it creates a memory layer automatically?
20 hours ago vote accept Neph
20 hours ago comment added Neph I changed it to LineStringZ and now it's working, thanks! Is it true that you should not use DataProviders anymore and should instead set the features on the layer directly? Is there any kind of collection (or line) that connects the points but still makes it possibe to interact with them separately and to set attributes?
22 hours ago history answered Taras CC BY-SA 4.0