Hot answers tagged

3

Nice question! Say that you have a vector layer referenced: lyr = iface.activeLayer() At this point, I assume you start an edit session and digitize some features. Now you can use the QgsVectorLayerEditBuffer class, in this way: if lyr.editBuffer(): print len( lyr.editBuffer().addedFeatures() ), "features to add!" addedFeatures gives you a ...


2

After some search I finally found a working solution: As I saw that layer.maximumValue(idx) always kept the same value until I commited changes, I added the number of new elements and that are pending to be commited to this variable. This way I always get serial (autonumeric) number. Idea taken from here: def openProject(): from qgis.core import ...


1

The row object can't be used in the manner that you're attempting: arcpy.FeatureClassToFeatureClass_conversion(row1[1],outSup... Because it's a row and not a feature class, to split your feature class to a single feature per output: desc = arcpy.Describe(catch10) OID_Field = desc.OIDFieldName # the name of the OID field, could be OID, OBJECTID, FID or ...


1

To fix the error: NameError: global name 'QgsMapLayerRegistry' is not defined Just add the following at the top of your script: from qgis.core import QgsMapLayerRegistry Tip: What I do normally when I receive similar errors is to type the class into the Python Console. It will then provide you with a list of classes and libraries in which they ...



Only top voted, non community-wiki answers of a minimum length are eligible