Graduated symbology of raster. How to round maximum value (automated)

2025
4
Jump to solution
12-21-2013 07:17 AM
by Anonymous User
Not applicable
Original User: colinmurray

Hello
I'd like to know if there's a way to automate rounding the maximum value for a raster when rendered in Stretched values along the colour ramp.

The value default is to 3 decimal places but I'd like it rounded to a whole number for aesthetic reasons.

I know how to do this manually. However the number of rasters I have to do this to is rather large and so I'd like to automate the process. Please see below images of before and after for what I want.

[ATTACH=CONFIG]30061[/ATTACH]
[ATTACH=CONFIG]30062[/ATTACH]

Thank you
Colin
0 Kudos
1 Solution

Accepted Solutions
JeffBarrette
Esri Regular Contributor
Stretched is currently not supported via arcpy.mapping.

Jeff

View solution in original post

0 Kudos
4 Replies
JeffBarrette
Esri Regular Contributor
Have you tried using arcpy.mapping.  Here is an example from the help that demonstrates how to set the values and labels.

import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Census")[0]
lyr = arcpy.mapping.ListLayers(mxd, "StatePopulation", df)[0]
lyrFile = arcpy.mapping.Layer(r"C:\Project\LYRs\Population.lyr")
arcpy.mapping.UpdateLayer(df, lyr, lyrFile, True)
if lyr.symbologyType == "GRADUATED_SYMBOLS":
  lyr.symbology.valueField = "POP2000"
  lyr.symbology.classBreakValues = [250000, 999999, 4999999, 9999999, 35000000]
  lyr.symbology.classBreakLabels = ["250,000 to 999,999", "1,000,000 to 4,999,999", 
                                    "5,000,000 to 9,999,999", "10,000,000 to 35,000,000"]
arcpy.mapping.ExportToPDF(mxd, r"C:\Project\Output\StatePopulation.pdf")
del mxd, lyrFile


Jeff
0 Kudos
by Anonymous User
Not applicable
Original User: colinmurray

Arc.py.mapping is what I'm using. And I must say it's pretty sweet once I broke the code.

What you've suggested seems to work when creating class breaks but I don't see a similar function to apply to stretched values as I have decided to use. You can see from the screen clip (showing the layer properties box) that I can manually change the Label to round off to 4915 from 4915.29. How to do this via automation?
Thank you for the response.

[ATTACH=CONFIG]30133[/ATTACH]
0 Kudos
JeffBarrette
Esri Regular Contributor
Stretched is currently not supported via arcpy.mapping.

Jeff
0 Kudos
by Anonymous User
Not applicable
Original User: colinmurray

Thank you for letting me know.
Cheers
Colin
0 Kudos