Saturday 19 September 2015

python - Multiple Conditional Reclassification - ArcGIS


This is a question out of curiosity rather than a problem as I am not the most experienced with raster datasets and I wonder if there is a better solution to my current approach. I am trying create a new raster dataset based off the conditions of two raster datasets. i.e. if population size <100 and mean age <10, reclassify to value 1. Now the issue is not creating a conditional statement but if there are several possible categories - say 49, that would require 49 multiple conditional statements. For example:


OutRas = Con((pop_ras < 100) & (age_ras < 10), 1, Con(pop_ras > 100) & ((pop_ras < 200) & (age_ras  < 10), 2, ..., 0))

At the moment I use the following procedure:


1) reclassify population into 7 categories



2) reclassify age into 7 categories


3) add age and population (to create 49 classes)


This approach would require 3 geoprocessing steps as opposed to one but require considerable less time scripting. I feel that there might be a simpler solution that I am not realization (perhaps a lookup table, SQL). Any thoughts? ideas? Which method is better - speed?



Answer



Use the actual COMBINE tool on your original rasters (which must be integer values): http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Combine/009z0000007r000000/. @whuber is correct in that you don't want to be performing multiple raster calculations when it is more efficient to apply SQLs to the combined raster attribute table. The beauty of this approach is that you can apply many different selections/queries (as well as categorical classification schemes to the population and age data) to the combine table (without having to wait for the raster calculations each time).


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...