How can I efficiently subdivide one raster into multiple rasters using the arcpy.SearchCursor?

For example if I have a slope and I was to subdivide into 3 rasters:

slope1 with values between 0 and 25degress

slope2 with values between 25 and 50degress

slope3 with values > 50degress

Here I should easily solve the problem with arcpy.AddFieldDelimiters

If for example i have one categorical file and I also want to do the same thing? If the file I have has only one field with the identification of the category and it's a string.

Value    Count    Type
    1    1023     Protected Area 2000
    2    1000     Protected Area 2001
    3    9555     Protected Area 2002
    4    9500     Protected Area 2003
    5    200     Construction Site
    6    (...)    (...)

Should I use arcpy.AddFieldDelimiters?

Furthermore, if I want to aggregate certain categories in only one raster, other groups of categories in other rasters?

When using the Search Cursor we are doing the changes directly to the source file ?should I create a copy for each raster I want to produce?

  • 1
    Just for clarification, SearchCursor by itself doesn't modify your original attribute table. InsertCursor and UpdateCursor do. SearchCursor is basically a read-only data access object. – Baltok Apr 5 '12 at 16:51

If you have the Spatial Analyst extension, you can use ExtractByAttributes or Raster Calculator to create your three rasters. Both of these tools can be called up in Python and are simpler (IMHO) solutions to using cursors.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.