HOW TO
In ArcGIS Pro, field values can be subtracted from a specified value and return negative results, as shown in the image below. However, it is necessary to prevent negative results as it may lead to errors or unexpected results in certain geospatial operations. Negative distances can be more challenging to interpret in proximity analyses or buffer zone calculations. For instance, if a buffer is created around a feature and results in a negative distance, it might indicate an error in the analysis or data.
This article provides the workflow to subtract field values and exclude negative results using Python in ArcGIS Pro.
fancy_subtract(!<fieldName>!)
def fancy_subtract(subtract_from):
value = <subtractionValue>
if subtract_from < value:
return 0
else:
diff = subtract_from - value
return diff
The image below shows non-negative values when the subtraction results in a negative number.
Article ID: 000031888
Get help from ArcGIS experts
Download the Esri Support App