laptop and a wrench

Bug

Unable to apply the Mask environment setting when running the Raster Calculator tool using ArcPy.

ArcGIS Pro
Bug-ID-Nummer BUG-000160654
EingereichtAugust 15, 2023
Zuletzt geändertJune 5, 2024
Gilt fürArcGIS Pro
Gefunden in Version2.9
BetriebssystemN/A
BetriebssystemversionN/A
StatusWill Not Be Addressed

Zusätzliche Informationen

The Raster Calculator tool is not intended for use in Python. The Raster Calculator tool is used to perform Map Algebra using Python in the User Interface, ie ModelBuilder. Map Algebra in Python can be performed natively. Map Algebra does not need to be wrapped inside a geoprocessing tool like the Raster Calculator tool. Perform Map Algebra like this: from arcpy.sa import * arcpy.env.mask ="C:\\temp\\BUG-000160654\\repro\\ManalData\\blkgrp.shp" ras1 = arcpy.Raster('usgsdem') ras2 = arcpy.Raster('gfchot') myras = ras1*ras2

Workaround

The Raster Calculator tool is not intended for use in Python. The Raster Calculator tool is used to perform Map Algebra using Python in the User Interface, ie ModelBuilder. Map Algebra in Python can be performed natively. Map Algebra does not need to be wrapped inside a geoprocessing tool like the Raster Calculator tool.

Perform Map Algebra like this:

from arcpy.sa import *

arcpy.env.mask ="C:\\temp\\BUG-000160654\\repro\\ManalData\\blkgrp.shp"

ras1 = arcpy.Raster('usgsdem')

ras2 = arcpy.Raster('gfchot')

myras = ras1*ras2

Schritte zur Reproduzierung

Bug-ID: BUG-000160654

Software:

  • ArcGIS Pro

Benachrichtigung erhalten, wenn sich der Status eines Bugs ändert

Esri Support App herunterladen

Weitere Informationen zu diesem Thema erkunden

Unterstützung durch ArcGIS-Experten anfordern

An den technischen Support wenden

Esri Support App herunterladen

Zu Download-Optionen wechseln