Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am writing a script that has to subtract one raster from another.

The rasters I have represent 1) Parking Lots (1 = Parking Lot, 0 = not Parking Lot) and 2) a buffer around the Parking Lot (1 = Parking Lot or 20ft Buffer around Parking Lot, 0 = not Parking Lot or Buffer).

What I need is a single raster representing just the buffer area without the actual Parking Lot, basically a ring around each Parking Lot (1 = ring around Parking Lot, 0 = not ring around Parking Lot).

When I perform this task manually in ArcMap (v10.1) using the Minus tool in the Spatial Analyst Extension, it works appropriately. When I try the same thing in Python (testing from the command window in ArcMap), the subtraction does not occur and the buffer with Parking Lot raster is returned unchanged. The same result occurs whether I use, parkinglots) or buffer - parkinglots.

This particular workflow is part of a larger script so doing it manually in ArcMap is just not an option. Any suggestons?


I tested this a slightly different way. I create a new model that performed the Minus operation the same way I did it manually in ArcMap. It worked.

According to the documentation, there are 2 ways to accomplish a subtraction. You can either use the - operator or the equivalent Minus GP tool within the Math toolset of the Spatial Analyst Tools toolbox (

So, I tried something else, I exported that model to script. What I found was fairly interesting. In the script that was exported from my model, the Python code was I haven't found any documentation about this, but it worked.

share|improve this question
Make sure you specify the output extent and resolution in the same way in both cases. – whuber May 15 '13 at 18:05
output extent and resolution are the same. The output is identical to the first input raster (the one being subtracted from) – Brian May 15 '13 at 18:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.