I'm using a QGIS project as template for other projects. This template has got around 5000 rows. Because I do several updates to the file, it's getting larger and more complex by the time. I know, that some plugins leave there codes in the file, even if they are not installed to QGIS anymore. I would like to get rid of that residual codes because they slow down the project load time and could cause errors.

Is there a way to automatically clean up the QGIS-project-file? I'm looking for something similar to the "SVG-Cleaner" whit which you can clean up the XML-Code of a SVG.

Until now I was randomly recreating the project by copy and pasting the "good" stiles and codes from one QGIS window with the old project to another window with the new project.

  • 1
    I feel your pain. If there is an answer to this question I would be stoked! Also, you say "I know, that some plugins leave there codes in the file, even if they are not installed to QGIS anymore." ... is there a way of finding out which ones/what other settings etc./any remedies? P.S. do you know this plugin: "Copy layers and groups to clipboard"? ... works a treat for the layer and style copy and paste game!
    – guestagain
    Mar 7, 2017 at 6:47
  • 2
    Unless you can specify precisely what bits you want removed from the XML file that is a .qgs project, I don't see how we can answer this. Can you give us some XML examples and show us what needs removing? Otherwise this question is somewhat vague.
    – Spacedman
    Mar 7, 2017 at 7:57
  • 4
    The point is, that I don't know, what or where is residual or 'orphaned' code. But I know, that it exist. I'm looking for a "cleaner" or a method to clean it up like you can do for SVG-xml with the SVG-cleaner: github.com/RazrFalcon/SVGCleaner
    – MartinMap
    Mar 7, 2017 at 10:38
  • Perhaps you could mention which plugins you used which stored some code into your project?
    – Joseph
    Mar 7, 2017 at 13:35
  • @Joseph: the "Layer Combinations"-plugin for instance. It is deprecated since QGIS got the "Manage Layer Visibility"-Function.
    – MartinMap
    Mar 7, 2017 at 14:00

1 Answer 1


There is no such tool as far as I know. Since there is no schema for project files (Seeking detailed description of qgs file structure?), it would seem rather unsafe to run automatic cleaning.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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