New answers tagged

2

You need to include rows.updateRow(row) to save your changes to each row of your Update Cursor: row.setValue("LOCALITY", str(localityList[indexCounter])) rows.updateRow(row) # save the change to the row rows.next() However you should also take note of the comments above about using the arcpy.da.UpdateCursor and about how you've named both your ...


6

You can use the following code which connects the attributeValueChanged event to a function we can define which inserts the results of the $now expression. Highlight your layer and copy/paste the following into the Python Console: layer = qgis.utils.iface.activeLayer() def update(): field = layer.fieldNameIndex('mod') e = QgsExpression( " $now " ) ...


2

It's likely caused by the fact that the canvas renders a cached image instead of requesting a new one. This will cause the cache to be cleared. timer.timeout.connect(layer.triggerRepaint) To get a reference to your layer either create it from python or use the QgsMapLayerRegistry.


0

You can use field calculator with ArcMAP or QGIS. First you can do a join on the object ID's then do the field calculation on the old field and set the value to the full datafile field.


0

I would allways recommend to use the OSGeo4W installer (http://trac.osgeo.org/osgeo4w/) which cares for all dependencies. And I never had problems running more than one (major) version on the same machine, even using the standalone installers. I allways install the latest version and ltr version.


2

If these are true Null fields and not strings with the word "<Null>", then you need to use None in Python for Null. Try: if valueDictOfficialPipes_2[1] in [None, "", " "]: for nullNoMore in range (1,len(fieldsPipes15096)): updateRow2[nullNoMore] = valueDictOfficialPipes_2[keyValue2][nullNoMore-1] ...


1

If you select "table_1" for the Update existing field option, try using this expression: if( "table_2" = 'test', 'y', "table_1") Basically, you're using an IF THEN ELSE statement.


0

I figured it out- I used a da.updateCursor with an SQL query- import arcpy from arcpy import env env.overwriteOutput = True arcpy.env.workspace = "F:/EMILY/TEST/GET_TYPE_TEST/" infc = "SpJoinscript.shp" with arcpy.da.UpdateCursor(infc, "TYPE_1", "TYPE_1=''") as cursor: for row in cursor: row[0] = "OFF_ROAD" cursor.updateRow(row) ...


0

If the field is empty (or NULL), the thing to test is whether the field is None. Try changing the if row.TYPE_1 == "": to if row.TYPE_1 is None:



Top 50 recent answers are included