2

I have a raster on my map and I would like to display the high, low, and mean values in a text box in layout view. Is there a way to dynamically do this? I have my legend set up so only the visible layers have legends, is there a way to do something similar with the raster statistics? If not, can I use data driven text somehow to display the data instead of going into raster properties and copy/pasting the info?

2 Answers 2

2

I used this label expression for polygon feature:

def FindLabel ( ):
  r = arcpy.Raster("DEM")
  mini = r.minimum
  mean = r.mean
  maxi = r.maximum
  return '{:.2f}\n{:.2f}\n{:.2f}'.format(maxi,mean,mini)

enter image description here

so just use dummy layer and labeling engine to show any info on raster.

2
  • Thank you, not as elegant as I had hoped from ArcGIS, but very useful.
    – Zac Just
    Jun 17, 2021 at 23:56
  • You can create many dummies and associate them with data driven pages (via definition query) and individual rasters.
    – FelixIP
    Jun 18, 2021 at 1:04
0

One way to achieve this is to display the statistics as table in the layout. Although it requires some steps and you have kinda little control over the arrangement, the cool thing about it is you can add many statistics and many raster at once. To do that: 1- Build Raster Attribute Table tool to get the raster attributes

2- Summary Statistic tool to get the desired statistics (you can enter statistic fields from many different raster at once)

3- Open the resulted table and customize it as you want it to appear (turn off the fields that you don't want like object id and rename the rest as you want. You can use Appearance from Table Options to customize the text)

4- Click on Table Options >> Add table to Layout

2
  • This won't work with floating point raster.
    – FelixIP
    Jun 17, 2021 at 5:26
  • Sure, to make it work on floating point raster, one needs to convert to Int then to float in the table(Raster calculator * multiplies of 10 as needed, convert to int, then return the values as they were in the final table by dividing by the used multiplies of 10). Anyway, seeing @FelixIP answer below, there is no need for on spot scattered solution any more :)
    – Es_a
    Jun 17, 2021 at 6:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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