I'm running QGIS 2.14.9 on Windows 7 SP1. I have a project that contains PostGIS layers from a remote server, as well as some (local) shapefiles that I've been doing some development on in the Python Console. I have reached a point, however, where when I try to open this project the entire computer freezes, requiring a hard reboot. My colleague tried opening the project on their computer and suffered a BSOD.

I can open other projects OK. So would like to try removing layers from this project to see if that fixes loading issues, but how can I do that without opening it in QGIS?

  • 2
    Don't you have the .qgs~ file?
    – mgri
    Dec 15, 2016 at 22:00
  • Ah. Relevant gis.stackexchange.com/a/216193
    – raphael
    Dec 15, 2016 at 22:05
  • Exactly that. =)
    – mgri
    Dec 15, 2016 at 22:13
  • So using the backup file... Project was able to load successfully then computer crashed :/
    – raphael
    Dec 15, 2016 at 22:20
  • 1
    Hmm, that's weird: I never had this kind of problem. Try to create a copy and then, using a text editor, to eliminate any reference to the files you don't need. I don't know if I'm saying something stupid, but I haven't any other idea by now.
    – mgri
    Dec 15, 2016 at 22:34

2 Answers 2


This isn't an answer as such, but it might help you find out if the file is genuinely corrupt. The file could be truncated, there might be encoding errors etc.

(Having said that, I can't remember the last time this happened to me - if at all...)

The .QGS file for your project is an XML file. This means it is human readable, and can be opened with other applications - including Web Browsers ;-)

  • First, back up your .qgs and .qgs~ files.
  • Next, create a copy of your .qgs project file.
  • Rename the copy to have an .xml extension e.g. myproject.xml
  • Open this XML file in your browser (probably right click the file, not sure about Windows). Or you can open your browser and use File > Open File

I deliberately corrupted a QGIS project file by removing parts of a tag, so it's no longer valid XML. If I open it up in the browser (Chrome in this case) I see an error message...

enter image description here

You might get better results with different browsers.

The reason for renaming the copy of the file to .xml is to stop the browser from treating the file as if it was a download. (Browsers don't understand what .qgs files are)

That's probably the easiest way to check that the file is genuinely corrupt (without writing code).

If the file opens and displays correctly, it's something else. If you do get an error, edit and update your question with any message you get.

  • excellent suggestion. I am sad to report that the xml rendered fine. I will attempt to selectively delete stuff from the file, but I feel like we're in bug-reporting territory
    – raphael
    Dec 16, 2016 at 15:43
  • Deleting the layer worked, see my procedure below. Thanks for your suggestion!
    – raphael
    Dec 16, 2016 at 16:20

So I opened the .qgs file in a text editor and decided to delete the most recently added layer to see if that changed anything. First I identified the layer in the <layer-tree-group ...> tag. It was something like

<layer-tree-layer expanded="1" checked="Qt::Unchecked" id="2015_am_reliable20161123173120092" name="2015_am_reliable">

I selected the id part 2015_am_reliable20161123173120092 and searched for that in the rest of the document. This id appeared 5 times:

  • In the <layer-tree-group ...> mentioned above
  • In the <layer_coordinate_transform_info> list
  • In the <layer-tree-canvas> list
  • In the <legend> list as a <legendlayer>
  • In a <maplayer> tag. This one is tricky since it was about 300 lines long, so it was helpful to be able to select the entire tag in an xml editor.

After deleting each of these I was able to open the project successfully in QGIS!

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.