TimothyHales
Esri Notable Contributor
since ‎04-10-2014
50 Badges Earned
Pathfinder Pathfinder
View All Badges Earned
‎01-15-2026
2859 Posts created
965 Kudos given
226 Solutions
2130 Kudos received
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

My Ideas

(3 Idea Submissions)

Latest Contributions by TimothyHales

POST
0
1
1165
POST
2
1
3126
DOC
0
0
12855
POST
1
0
4330
POST
0
0
4209
POST
0
0
1705
POST
0
0
3946
POST
0
0
1538
POST
0
0
3149
POST
1
0
3253
POST
0
0
814
BLOG
RasterProperties.jpg

For example, you are working on a project that requires an elevation image service to be created.  The image service foundation is a mosaic dataset that references source rasters for each county in the state.  You create the mosaic dataset, add the rasters, build the overviews, and add it to the map document.  The mosaic dataset looks great until you begin zooming into the source data.  In one spot you find that the elevation appears very dark instead of a consistent grayscale.ElevationDark.jpg

After investigating the source raster you find that the dataset is an 4-bit integer instead of the normal 32-bit float.  This makes you wonder if there are other datasets that were created incorrectly.  To find those datasets you can either zoom into small scale areas across the entire state, or you can open the properties for each individual raster.  Either way the process would be very time consuming as each raster would need to be reviewed individually.

Another option is to access the raster properties through a Python loop.  This process presents a more efficient and simplified solution.  The information can be queried through the python Raster object and the Get Raster Properties geoprocessing tool.

[python]
import arcpy
arcpy.env.workspace = r"C:\temp"

rasterList = arcpy.ListRasters()

for raster in rasterList:
rasterObj = arcpy.Raster(raster)
print raster

bands = arcpy.GetRasterProperties_management(raster, "BandCount")
print "Band count: %s" %bands

noData = rasterObj.noDataValue
print "NoData Value: %s \n" %noData
[/python]RasterPropertiesExample.jpg

The returned values can be written to a table to easily identify which datasets are incorrect.RasterPropertiesTable-1024x279.jpg

Additional Resources


A Python script tool example of getting the raster properties can be download from ArcGIS.com: Write Raster Properties to Table.Timothy H. – Senior Support Analyst
-->
0
0
3689
POST
0
0
2385
POST
0
0
1563
POST
0
0
721
Activity Feed