Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
allows you to perform calculations on the basis of existing attribute values or defined functions in QGIS, ArcGIS, etc.
8
votes
Using Python to Calculate a field
At least four things needed correction:
You need to use return rather than print
You need to use == rather than = on your if and elif statements (thanks @DanPatterson)
Take care with your indentatio …
6
votes
Accepted
What is expression for finding perimeter in ArcPy and Field Calculator?
Try using the word "Length" (i.e. length of polylines, perimeter of polygons) instead of "Perimeter":
arcpy.CalculateField_management("Iceberg","Area","!shape.geodesicLength@KILOMETERS!","PYTHON_9.3" …
2
votes
Auto populate field with text using field calculator if/then
To avoid the need to use Python you can use Select By Attribute first. This is available as a tool, from the Selection pulldown or from Table Options. Then use Field Calculator or the Calculate Field …
1
vote
Using ArcGIS field calculator?
It is hard to be sure without seeing your error message but I suspect this will work:
def Reclass(A):
if ( A>= 0.208113 and A <= 0.261517):
return "Low"
elif (A > 0.261517 and A < 0.301951):
…
3
votes
Accepted
Updating many attributes at once in ArcGIS Field Calculator?
The Field Calculator will only update one field at a time when run through its tool dialog.
To update multiple fields you could create a tool in ModelBuilder or ArcPy that runs the Calculate Field t …
2
votes
Using arcpy.CalculateField_management
I think this may be what you are after - the syntax is not one that I try to remember.
I simply ran the Calculate Field tool once interactively using the Expression and Code Block from your questio …
1
vote
Calculating multiple text fields based on other fields in ArcGIS Pro?
@FelixIP has offered a ...
Coding free approach: remove long fields. Bring what remains to excel.
Replace r to whatever, same with d. Change column names to include
lng. Join to parent using r …
1
vote
Undo field calculation in ArcGIS Pro?
I just tested this at ArcGIS Pro 1.3 and can confirm what you are saying.
I think the reason that field calculations cannot be undone is that they are not being done within an edit session, but rat …
2
votes
Calculating Mean for Multiple Rows in ArcGIS for Desktop?
I think you should use the Summary Statistics tool to calculate the mean:
Calculates summary statistics for field(s) in a table.
...
The following statistical operations are available wi …
1
vote
ArcGIS Python Field Calculation says failure during processing?
I think the cause of this, and the reason you are also having trouble formatting this correctly in the question, is that there is a colon missing after else.
Try this:
def reclass(a):
if (a <= 5 …
1
vote
Accepted
Field calculation based on the field name by using arcpy
You seem to know how to do this in the ArcGIS Field Calculator.
Instead, do exactly the same thing using the Calculate Field tool, taking care to set your parser to Python.
Once you have run the too …
4
votes
Accepted
Using if else statement in Python Parser of Field Calculator in ArcGIS for Desktop?
The problem is in your code block.
Instead of:
def Reclass( !CODE! , !COMPLEX! ):
if ( !CODE! == 1.1.7 and !COMPLEX! == 4):
return 1.3
elif ( !CODE! == 3.2.0 and !COMPLEX! == 4):
…
2
votes
Calculate Field based on two fields using python
Taking account of the comments by @nmpeterson and myself against your question, I would try the following:
Pre-logic Script Code:
def a(Riesgo,Direccion):
if (Riesgo == "Alto" and Direccion == " …
1
vote
Accepted
ArcGIS Pro field calculator if - else - string error
I would try this:
import math
def muh(bedingung, wert, Shape_Area):
if (bedingung == "hallo"):
value = (4.3 * math.log(wert)) * Shape_Area
elif (bedingung == "echo"):
value = (2. …
0
votes
Python split expression to Python code
The split method you are using is from Python, and in the Field Calculator you are applying that method to the string returned from each row in the PROPR_NAME field.
I think the easiest way to get the …