Skip to main content

All Questions

Tagged with or
Filter by
Sorted by
Tagged with
14 votes
3 answers
8k views

Adding layer to group using PyQGIS

I am trying to add new layers into a specific group which I can get to work if I know the index, but how can I get Python to find the index of a group so it can load the new layer into the group ...
Seth Loader's user avatar
23 votes
3 answers
12k views

Adding new group layer with ArcPy?

Does anyone now how to add a group layer with Python in ArcGIS Desktop 10? I can use arcpy.mapping.AddLayer but surely this is only for an actual layer as opposed to a group layer. so far I have ...
Ian Torr's user avatar
  • 321
12 votes
4 answers
9k views

Moving layers in the Layer Order Panel using PyQGIS

The following is a simple setup containing a group with three layers. The code I use adds a new layer at the end of this group: root = QgsProject.instance().layerTreeRoot() group = root.findGroup('...
Joseph's user avatar
  • 76.3k
13 votes
2 answers
9k views

Adding layer group using PyQGIS? [closed]

How can I create a new group in the layer manager using python code?
malagueff's user avatar
  • 159
5 votes
2 answers
5k views

Creating empty group layer within existing group layer using arcpy.mapping?

Referencing this question, Adding new group layer with ArcPy?, I'm trying to use python to add a empty group within a group layer. So far I'm able to add a empty group within the map document, ...
artwork21's user avatar
  • 35.2k
4 votes
2 answers
2k views

Adding output layers of QGIS processing scripts to group using PyQGIS

I have a QGIS Python processing scripts that return multiple rasters. I want to return them to a group named 'Aligned'. There is nothing in the context.addLayerToLoadOnCompletion() function to specify ...
ar-siddiqui's user avatar
  • 1,830
4 votes
2 answers
7k views

Creating sub sections (groups) of layers in QGIS?

I am working on a project regarding Fish species and fishing methods with many layers. This creates confusion. I would like to create layer sub sections (groups) like the following: Fish Species ...
kwai's user avatar
  • 645
8 votes
3 answers
8k views

Adding layer to group in layers panel using PyQGIS? [duplicate]

I am trying to add a group to the layer panel, then place a vector layer (vectorLayer) into this group from a python script. The code I am using is: groupName="test group" root = QgsProject.instance()...
the-jfry's user avatar
  • 125
5 votes
2 answers
1k views

PyQGIS toggle group visibility (and recursively subsub...group visibility)

I would like to set visibility of a layer group and all of its children (and grand-children and so on...) using PyQGIS (QGIS 2.14.1). Assume the groups name is g0 with subgroups g0[1...n] and subsub.....
Jochen Schwarze's user avatar
4 votes
3 answers
3k views

Adding group layer, renaming it from folder name, then adding layers to it from that folder, using ArcPy/Python?

I am trying to use os.walk to go through a directory tree, pull out all the .shp files in it, create a grouplayer in the mxd, rename the grouplayer the folder name, then add the layers from that ...
SStreisel's user avatar
1 vote
1 answer
2k views

Importing file geodatabase (GDB) to table of contents (TOC) of ArcMap?

I have a geodatabase with several feature dataset and feature classes associated with it respectively. I would like to create a .mxd where the Table of contents consist of group layer and each group ...
user avatar
1 vote
2 answers
4k views

Count number of group layers or Layers inside group layer using ArcPy? [closed]

I am looking for a way of counting the amount of layers within a group layer I have an empty group layer inside my map and I am looking for a way of initiating a process if there are 0 layers inside ...
Jack Walker's user avatar
34 votes
0 answers
3k views

Leaflet v1 plugin: layer control for ungrouped, grouped, and nested-grouped layers

I need a Leaflet plugin which extends L.Control.Layers. I have the following requirements: works with Leaflet 1.x handles ungrouped layers alongside grouped ones handles nested layer groups does not ...
Tom Chadwin's user avatar
  • 5,968
18 votes
2 answers
904 views

Showing the number of currently selected layers in QGIS

Although this should seem to be very straightforward, I cannot find out how to see the number of layers I have currently selected in QGIS. For example, in the example below I want to see somewhere in ...
Sytze's user avatar
  • 792
10 votes
3 answers
4k views

Removing all layers from group using PyQGIS

I want to remove all layers from a distinct group. root = QgsProject.instance().layerTreeRoot() the_group = root.findGroup("my_group") parentGroup = the_group.parent() I think I have to ...
Stefan's user avatar
  • 4,474
10 votes
1 answer
3k views

Selecting subgroup in Layers panel using PyQGIS

I can select a group layer (for example C) using the following script. But I can only select groups in root level (A or C). I am struggling to select subgroups. I play with the script, but no success. ...
Kadir Şahbaz's user avatar
8 votes
2 answers
2k views

Sorting layers by name in one specific group of QGIS layer tree

I'd like to reorder the layers within ONE specific group of the TOC alphabetically by layer name, but without reordering the top level layers or the layers of other groups. I found the following ...
jaysigg's user avatar
  • 507
7 votes
4 answers
17k views

Dynamically add layer(s) to Layer Group

I have an Openlayers 3 app and users can retrieve stored routes from a web service and display them on a map. Currently each route is added to the top of the index but I'd like them to be inserted ...
dvmac01's user avatar
  • 1,065
5 votes
2 answers
6k views

Mapbox GLJS - group layers

I'm trying to build an interactive map, without any knowledge in javascript, and i found myself a bit lost in this large world. I've already designed my style in mapbox studio. And now, trying to ...
Cdrice's user avatar
  • 63
2 votes
1 answer
355 views

Copy styles from many layers

I am working with QGIS 3.4 Is there a way to easily copy the styles from one group of layers to another group of layers with the same names? The outcome should be that layers that share the same name,...
GeofA's user avatar
  • 21
2 votes
0 answers
368 views

Creating layer in group-layer in QGIS Graphical Modeler

I want the layers created during a graphic modeler process be stored in a specific layer group. I tried a bunch of stuff, based on clone-move-delete, node_root, layertreelayer... Maybe in alg_params ...
Festisat's user avatar
1 vote
1 answer
254 views

How to programmatically access Trace network layer results when using NETWORK_LAYERS result type in a stand-alone Python script?

I have a stand-alone Python script that runs a Connected Trace on a Trace Network. This is a re-write of an existing script that runs a trace on a Geometric Network. The script will be published as ...
Dan's user avatar
  • 1,100
1 vote
1 answer
3k views

How to create a text file containing layer names in QGIS?

My QGIS ToC contains layer groups and some layers that do not belong to any group. I would like to create a text file containing the name of those layers that do not belong to any group. Is there an ...
kwai's user avatar
  • 645
1 vote
1 answer
215 views

bgcolor problem on cascaded WMS grouplayer

On GeoServer I have two layers, both cascading a remote WMS. Both layers work fine in the layer preview. Now I am putting both into one group layer and open the preview, which shows an empty response....
ulrich's user avatar
  • 1,170
0 votes
0 answers
80 views

Deleting the old layer set automatically - after sorting layers of one specific group within the table of contents alphabetically

I'd like to reorder the layers within ONE specific group of the TOC alphabetically by layer name, but without reordering the top level layers or the layers of other groups. @GérmanCarillo helped me to ...
jaysigg's user avatar
  • 507