Writting a BIL in ASCII format

Frank Warmerdam warmerdam at POBOX.COM
Thu Oct 12 15:53:27 EDT 2006


Trimble, Beheen wrote:
> Frank,
> 
> I can see you are all over the net helping and answering people’s 
> questions. I really thank you for what you are doing. I wish I could be 
> you! Right now I am doing my master and working full time and don’t have 
> much time to devote. I promise after I graduate (next april) I will help 
> you guys.

Beheen,

Whew, doing a masters and holding down a full time job.  I couldn't
hack that!  I look forward to your graduating and having a bit of
breathing room to relax, and even help out some.

> This is my problem/question:
> 
>  
> 
> I was surfing the web to use gdal libs to read an ESRI BIL file and 
> write it out in ascii format. I think the gdal_translate will do but I 
> am not sure which option is which! Below is the header info. If you 
> please fill the blank for me, if that is the way!
> 
>  
> 
> 1) I am using header information to translate to ascii grid, is this 
> gives me an ascii file?

If you translate to AAIGRID format, you will get an ascii raster file.

> 2) Not sure what to put in place of ‘?’ below
> 
>  
> 
> gdal_translate –ot Byte –of AAIGrid –b 3 –outsize ? ? –srcwin ? ? ? ? 
> –projwin 510724.036 106267.487 531636.641 83405.401 –a_srs ? –a_ullr 
> 510724.036 106267.487 531636.641 83405.401 –a_nodata -9999 –mo ? –co ? 
>  dq0512ne.bil dq0512ne.asc

If you want the data at full resolution for the -projwin area, then
just omit -srcwin and -outsize and you will get the data at full resolution.
Likewise you shouldn't need -a_ullr, -mo or -co.  If you use:

gdal_translate –of AAIGrid –b 3 \
   –projwin 510724.036 106267.487 531636.641 83405.401 \
   dq0512ne.bil dq0512ne.asc

you will get an ascii grid file cut from the indicated region of the
source file, only taking band 3 but otherwise with the original values,
data type, and resolution.

> 3) Give me a hint on how to associate a color file with the resulting 
> ascii file.

What application do you want the color table to work with?  Generally
speaking the GDAL commandline utilities do not allow adding a color table
to a raster file.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org



More information about the mapserver-users mailing list