QgsApplication.setPrefixPath("/usr", True) # Load providers QgsApplication.initQgis() # Base directory to the data. The scripts assumes that the Shapefile and all # CSV files are within the same directory basedir = "/home/adrian/Documents/LandObservatory/Matrix/Data" countriesMap = createMap('countries.csv') maincropsMap = createMap('maincrops.csv') mainanimalsMap = createMap('mainanimals.csv') mineralsMap = createMap('minerals.csv') otherlandusesMap = createMap('otherlanduses.csv') identifierColumn, transformMap, groups = getTagGroupsConfiguration("landmatrix.activity.ini") vlayer = QgsVectorLayer("%s/deals_with_geom.shp" % basedir, "landmatrix", "ogr") if not vlayer.isValid(): print "Layer failed to load!" provider = vlayer.dataProvider() feature = QgsFeature() # List of attribute indexes to select attributeIndexes = [] # Dict that maps the field index to the fields defined in the global YAML fieldIndexMap = {} for (i, field) in provider.fields().iteritems(): if str(field.name()) in transformMap: