[Qgis-user] Adding points as seperate layers

ERT - Mike Breiding epicroadtrips at gmail.com
Mon Feb 9 17:48:59 PST 2026


Greetings, Ludwig.
Thanks for your offer of help.
However, I have no idea how to use the script.
I have only used Qgis a few times.
WV-Mike
=============
On 2/9/2026 3:18 PM, Ludwig Kniprath via QGIS-User wrote:
> Hi Mike,
>
> there are probably several solutions for your problem. Below a script, 
> which uses the imported csv-layer and creates a memory layer for each 
> feature.
>
> # active-layer = csv-import-layer
> vl = iface.activeLayer()
>
> # the group for the single-point layers in Layer-Panel
> target_group = QgsProject.instance().layerTreeRoot().addGroup('group_1')
>
> # iterate through the csv-import-layer
> for f in vl.getFeatures():
>     # create a clone of this layer with only one feature
>     vl_clone = 
> vl.materialize(QgsFeatureRequest().setFilterFids([f.id()]))
>     # set the name for the new layer, here using the attribute 'name' 
> of the csv-import-layer
>     # adapt if necessary or create another name
>     vl_clone.setName(f['name'])
>     # parameter 2 False => dont't add to layerTreeRoot...
>     QgsProject.instance().addMapLayer(vl_clone,False)
>     # ...but to the above created group
>     target_group.insertLayer(-1, vl_clone)
>
>
> Note: the script creates temporary memory-layers, which you must 
> convert to permanent layers (context-menu > Make Permament)
>
>
> hth
>
> Ludwig
>
> Am 09.02.26 um 21:37 schrieb ERT - Mike Breiding via QGIS-User:
>> Greetings,
>> I was successful in adding lat/long points to my project from a .cvs 
>> file:
>> Lat,Long,Mile
>> -79.924454,39.709589,M 1
>> -79.936296,39.698546,M 2
>> -79.939802,39.68499,M 3
>> etc.
>>
>> When the points are added to my project all the of them are in one 
>> layer that contains all the points.
>> I wish to have all the points as separate layers contained in a Group.
>> How can I accomplish this?
>>
>> Thanks,
>> WV-Mike
>> _______________________________________________
>> QGIS-User mailing list
>> QGIS-User at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
> _______________________________________________
> QGIS-User mailing list
> QGIS-User at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20260209/889c1ca1/attachment-0001.htm>


More information about the QGIS-User mailing list