31

I'm working on bulk data. I have a few hundred GeoTIFF images imported into a QGIS project, and I'd like to modify their layer properties - things like the no-data-value, transparency of certain pixel values, colour map assignments...

But I can't seem to find a way to apply these changes to several layers at once, short of editing the XML file with a global search-and-replace. Is there a way to do this using the GUI?

46

In current versions of QGIS, you can use Copy Style and then Paste Style from the Layers top dropdown menu (if you have one or more layers selected in the layers list).


For some older versions: You can select multiple layers in the layers list, right-click and use Paste Style from the context menu.

For other older versions:

The MultiQML plugin lets you apply one QGIS layer style to multiple layers at once. I think that's as close to what you are looking for as currently possible.

7

If you save the style options for the one vector layer as a .qml file, you can apply it onto multiple layers at once with the MultiQML-plugin. Basically, it's an interface window that lets you select which layers you want the style to apply to (by hand, or 'select all'), the 'apply style' button lets you select the qml with the style info.

Info to be found here: MultiQML

7

This works for QGIS 3.4 =>

  1. Create a group of all the layers you want to have the same style
  2. Edit the style of one of the layers in the group to your liking
  3. Right-click the correctly styled layer; 'Styles' -> 'Copy Style' -> 'Symbology'
  4. Select the group you created before
  5. Right-click the group; 'Paste Style'
  • This needs to be the accepted answer, it's quick and it's easy and it just works... without any complicated plug in madness. – shawty Nov 28 '19 at 19:07
2

You can save your project, close QGIS, find the style definition in the .qgs file of your project then paste it for every layers.

1

I wrote a python script that could be useful if you want to apply style to all layers in a group or more. All you need to have is a saved .qml file with the properties you want to apply for each type of layer.

from qgis.core import *
import os
#copy line 9-21 and change file names and group names if you have more groups

QML_file = ('yourqmlfile.qml')#insert path to qml file 
#add other qml files if you want to change style for more groups


def applystyle_group(name):
    root = QgsProject.instance().layerTreeRoot()
    point = root.findGroup(name) #Find Group
    for child in point.children():
        if isinstance(child, QgsLayerTreeLayer):
            if child.layer().type()==0:
                child.layer().loadNamedStyle(QML_file)#change the file name accordingly
                #you can add styles for other types of layers in the same group (line, point and polygon)

try: #If group is not present this will keep script running if you want to add more
    applystyle_group("*")#insert name of QGIS group
except Exception:
    pass

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.