Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

8
  • Hi. I tried the above and got this... Traceback (most recent call last): File "<input>", line 3, in <module> AttributeError: 'QgsRasterDataProvider' object has no attribute 'addAttributes' Commented Mar 13, 2015 at 16:52
  • Ok. My fault here. It was actually working. I had two layers of polygons loaded which arrested the script from running. Thanks alo. Commented Mar 13, 2015 at 17:05
  • As I told you in the answer, if you have other layers loaded in QGIS, you need to filter them out (e.g., via an if like: if layer.type() == 0: right below the for line). Commented Mar 13, 2015 at 17:08
  • Hi. I seem to have a problem with the above after all. I have split a vector shape file by features and have got several vector shape files. Running the script gives me the prefix of the original shape file that i split and not the prefix of the split files. I may have to include a "for each group" after all? Commented Mar 16, 2015 at 8:23
  • Much easier if you just tell us how your layer names look like now and how do you want your layer names to be after running the script. Otherwise, every time you change the original scenario, the solution won't apply anymore. Commented Mar 16, 2015 at 14:07