Skip to main content
10 events
when toggle format what by license comment
Jan 2, 2017 at 19:25 comment added Germán Carrillo @HannesLedegen, you should open a new question in GIS.SE.
Jan 2, 2017 at 15:02 comment added Hannes Ledegen I have a similar problem. I have about 50 shapefiles each with up to 20 attributes. I would like to batch-add to each of the shapefiles an attribute column containing the name of the respective shapefile (or even better if possible: of the group in which the layer is located). I am a noob with python.
Mar 17, 2015 at 7:18 comment added Nicolai Jørgensen True. I found that I had to split layers by field and move the added layers outside the groups, run the script. Worked fine then. I was just not aware of that running a batch using the split vector layer by attribute only made a virtual separation of the shape file and not physical layers.
Mar 16, 2015 at 14:07 comment added Germán Carrillo 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.
Mar 16, 2015 at 8:23 comment added Nicolai Jørgensen 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?
Mar 13, 2015 at 17:15 vote accept Nicolai Jørgensen
Mar 13, 2015 at 17:08 comment added Germán Carrillo 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).
Mar 13, 2015 at 17:05 comment added Nicolai Jørgensen Ok. My fault here. It was actually working. I had two layers of polygons loaded which arrested the script from running. Thanks alo.
Mar 13, 2015 at 16:52 comment added Nicolai Jørgensen 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'
Mar 13, 2015 at 15:30 history answered Germán Carrillo CC BY-SA 3.0