I am trying to reprogram some scripts from ArcPy to QGIS (1.8 or 2.0) and there are some simple functions that I want to be able to redo but unfortunately documentation in QGIS is lacking in certain areas.
Namely the three most important for me are:
Add Field - Add field
arcpy.AddField_management(Feature, "ID", "SHORT")
Calculate Field Management - Update that field
Update/Delete Rows - Update/Delete rows based on condition (without copying the shapefile)
keep = ["Bob","Janet","John","Mike"] Counter = 0 rows = arcpy.UpdateCursor(Feature) for row in rows: if row.Name in keep: row.ID = Counter rows.updateRow(row) else: rows.deleteRow(row) Counter += 1
Now I can iterate through each feature in QGIS using SEXTANTE and obtain its geometry which I should be able to rewrite into a new shapefile and thereby update/delete a row or field. Starting with something along the lines of...
layer = st.getobject(Polygon) features = st.getfeatures(layer) for f in features: f.geometry().asPolygon()
but I can't find a simple solution for those functions mentioned above?