1

I have a raster layer in arcgis which covers a large surface area. I would like to be able to zoom into specific areas of this raster and have it display only the range of values in the area I have zoomed to. Is this possible?

For example if the range of values for the entire raster is 0-255 but the range of values at the current extent is only 25-100 I would like the symbology to represent only those values between 25-100, until I zoom to a different scale.

  • That would be a dynamic symbology and I'm not aware of any way to do it. As you mention, symbology and statistics are generated based on the entire raster extent. You can query specific areas, and with certain stretch renderers you can alter the appearance based on just the visible pixels, but you can't change the symbology. – Chris W Apr 16 '15 at 19:44
  • 2
    Like when you use stretched symbology type: 'min/max' and set the statistics to 'From Current Display Extent'? (you need to scroll down to see that option) If the layer is expanded the min/max on screen is shown next to the colour ramp. – Michael Stimson Apr 16 '15 at 23:20
  • @MichaelMiles-Stimson That is exactly what I was looking for! Thank you. Now I just wish there was a way to do this on a classified color ramp. – rgmrtn Apr 17 '15 at 19:06
  • @MichaelMiles-Stimson yep, that's what I was referring to. Use that all the time when digitizing from b&w imagery. – Chris W Apr 18 '15 at 0:33
1

You can accomplish this with multiple layers pointing to the same raster source. Give each layer its own separate scale range and symbology.

If you wanted to have a particular symbology between 1:25 and 1:100, you'd set those values on the General tab as shown below. Then choose the appropriate symbology on the Symbology tab.

Then you might have, say, two additional layers: one covering 1:1 - 1:24, and one covering 1:101 - 1:255.

enter image description here

  • 2
    This doesn't really work for what the asker is trying to do. If you're looking for different symbology at different scales, this is the way to go. But what they want is a symbology that's based on a classification of values visible in the window at any given scale (so the symbology is actually dependent on visible data values/range, not the scale). – Chris W Apr 18 '15 at 0:35
  • Ah yes. That was not clear to me. I will suggest an edit to the question. – Andy Apr 21 '15 at 11:50
1

Try this out:

import arcpy, os, traceback, sys
from arcpy import env
env.workspace="in_memory"
env.overwriteOutput = True

try:
    def showPyMessage():
        arcpy.AddMessage(str(time.ctime()) + " - " + message)
    mxd = arcpy.mapping.MapDocument("CURRENT")
    color_layer=arcpy.mapping.ListLayers(mxd,"silver.tif")[0]
    wholeRaster=arcpy.Raster(color_layer.dataSource)
    df = arcpy.mapping.ListDataFrames(mxd)[0]
    ext=df.extent
    ext='%s %s %s %s' %(ext.XMin, ext.YMin,ext.XMax,ext.YMax)
    arcpy.Clip_management (wholeRaster, ext, "victim")
    desc = arcpy.GetRasterProperties_management("victim", "MINIMUM")
    minV = int(desc.getOutput(0))
    desc = arcpy.GetRasterProperties_management("victim", "MAXIMUM")
    maxV = int(desc.getOutput(0))
    arcpy.AddMessage('%s %s' %(minV,maxV))
    intervals=5; valueList=[]
    dV=(maxV-minV)/intervals
    for i in range(intervals+1):
        valueList.append(minV+int(dV*i))
    color_layer.symbology.valueField="Value"
    color_layer.symbology.classBreakValues =valueList
    arcpy.RefreshActiveView()
    arcpy.RefreshTOC()
except:
    message = "\n*** PYTHON ERRORS *** "; showPyMessage()
    message = "Python Traceback Info: " + traceback.format_tb(sys.exc_info()[2])[0]; showPyMessage()
    message = "Python Error Info: " +  str(sys.exc_type)+ ": " + str(sys.exc_value) + "\n"; showPyMessage()
  • Could you edit your question to include what the code does? It will help folks who aren't as code-savvy decide whether to try to decipher it. Thanks :) – Nova Jan 12 '18 at 14:47

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.