Cartographica 1.5: Formula Changes

TL;DR - if you're using formulas, read the Practical Changes section.

Background

Although it's been called out in our documentation for years, many people don't realize that the underlying system behind Cartographica's calculated columns is actually a full Python interpreter. This has allowed us to provide a full-featured function/method interpretation system, with sophisticated math and date calculation capabilities without having to build and maintain such a thing ourselves.

Along with the many internal changes in Cartographica 1.5, we are preparing for Apple's announced deprecation of the Python libraries in macOS by moving to using our own internal Python library. Mostly this is a drop-in replacement, as the libraries in use in macOS have been built basically from the main Python tree for years. However, Apple hasn't updated the built-in major version to beyond the 2.7 tree (for example, the Python shipping in 10.15.2 is currently 2.7.17).

In addition to Apple's warned removal from the system of scripting systems, such as Python, we're upgrading to a version of Python on the much more recent 3.8 tree. This will allow us to keep up with security updates, etc.

Practical Changes

As a part of this set of changes, we are dealing with some deprecations and incompatible changes between Python 3 and Python 2. The most noticeable of these is a change in the string libraries to move many string functions into methods on the string libraries. Practically, this means that if you were using these functions, you will need to make changes to your formulas for them to track correction in 1.5.

As an example, if you used upper(foo) to create an upper-case version of the column foo, you will need to change these to foo.upper(). Pretty straightforward.

Backward compatibility

Now for the good news, basically all of these methods are supported with recent 2.7 versions of Python and therefore, supported by the 1.4.x versions of Cartographica. Thus, changes that you make to move from the function-based approach to the method-based approach will in almost all cases be backward-compatible.

How Cartographica helps you find and fix these

Cartographica has always re-evaluated unlocked calculated columns when loading layers that contain them into an existing or new Map Set (locked columns are, by nature, not recalculated).

Prior to 1.5, Cartographica would ignore errors that occur when loading the layers, since we expected any errors in the formulas to be presented during the editing process. Now that it is clearly possible to have problems with a calculated column loaded from an older document, we have made the error handling more robust and are now presenting an error message via the Layer warning indicator in the layer stack. If you see one of these, you should click on it to understand the problem. If the problem is related to a calculated column, Cartographica will display the error message along with the column name(s) and a button to refresh the check status.

If you encounter this error, open the Layer Info Window using Windows > Show Layer Info, select the Fields tab, choose the affected column and click Set Formula.... From here you should be able to fix the formula and then re-check it if necessary from the Layer warning indicator.

← Cartographica 1.5: Improved format support | Cartographica 1.5b2 Available →
More in Cartographica
← Cartographica 1.5: Improved format support | Cartographica 1.5b2 Available →