EasyCalculate 5.0 was for a long time a very
popular set of expressions for the Field Calculator. The expressions
however were written in Visual Basic for Applications (VBA) which is not
supported in ArcGIS 10.
We are receiving on daily basis
messages from people asking whether we are intending to make
EasyCalculate 5.0 compatible with the ArcGIS 10 Field Calculator. After
considering this for some time, we decided that there is no point in
that.
- The main reason EasyCalculate 5.0 is used so
widely is that there are many ArcGIS users that are capable of
understanding and customizing existing scripts to suite their needs
and writing their own VBA scripts. From this point of view rewriting
the existing expressions in VB Script or Python will not help much.
- Debugging in the Field Calculator is a nightmare
which makes the creating complex expressions very difficult .
- The performance of Python scripts in the field
calculator is not good
While considering the above, several questions were
popping constantly up:
- The Field Calculator is an excellent tool, but do
we need it for complex expressions?
- Can we leave the simple expressions for the Field
Calculator and use something else for the complex ones?
- Having in mind that VBA will be completely out in
ArcGIS 10.1 - what environment will be the best for users that
already have experience with VBA used in ArcGIS for many years?
Lets start with the last question. VBA is
still available in ArcGIS 10, but it will go away sooner rather than
later. So, can we utilize our VBA skills in the future, or we just need
to forget about them and start learning Python?
See this article
Now to the question 2 above - Can we replace
the field calculator for some complex expressions?
We need that in order to:
- be able to use language similar to VBA;
- be able to debug easier;
- make our calculations faster;
- be able to use ArcObjects in the calculations.
What the Field Calculator actually does?
- It is as simple as going trough the records of the attribute table
and populates the field values of a field based on an expression entered
by the user. So it will not be that difficult to emulate the behavior of
the Field Calculator with a simple code like
|
We are passing to our calculator:
- the input (in the case above a feature layer);
- the expression that needs to be calculated;
- the field that we want to populate with the results
The expressions can be small functions that will perform the
operation we need.
|
As a conclusion we'll go back to the question
1 above - Do we need the Field Calculator for complex expressions?
What is better:
See the code of EasyCalculate
10 for an implementation of the above idea.
|