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?
-
1Just 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– Baltok2012年04月05日 16:51:28 +00:00Commented Apr 5, 2012 at 16:51
1 Answer 1
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.