Hello, <div>I am fairly new to GDAL but impressed w/ its functionality. I have an ERDAS img file that has categorical data in it (data type). I am attempting to read out the categorical data for the purposes of eventually classifying it in a map server file. I have found one example of this but am not sure if this is the best way to go about it. Any feedback would be appreciated. Here is what I have so far:</div>
<div><br></div><div><div>#! /usr/bin/python</div><div>from osgeo import gdal, gdalconst</div><div>from gdalconst import *</div><div><br></div><div>ds = gdal.Open('/flood/fsdata-internal/efetac_nasa/AncillaryData/foresttype.img', gdal.GA_ReadOnly)</div>
<div># get image size</div><div>rows = ds.RasterYSize</div><div>cols = ds.RasterXSize</div><div>bands = ds.RasterCount</div><div><br></div><div># create a list to store band data in</div><div>bandList = []</div><div># read in bands and store all the data in bandList</div>
<div>for i in range(bands):</div><div> band = ds.GetRasterBand(i+1)</div><div> data = band.ReadAsArray(0, 0, cols, rows)</div><div> bandList.append(data)</div></div><div><br></div>