Shared Samples

Try out source code samples stored in Bitbucket repositories.
Showing results for 
Search instead for 
Do you mean 

Job aoiFromText : how to read, create and write AOI

by Technical Evangelist on ‎09-08-2015 10:22 AM - edited on ‎03-29-2016 11:26 AM by Anonymous (807 Views)

Example Type





This example shows how to read, create and write AOI




aoiFromText.c              (C source code)

aoiFromText.eml          (EML script)

aoiFromText.dsp          (Visual C++ Project)(Windows Only)

aoiFromText_tmAtlanta.dat     (Example ASCII input for use with tmAtlanta.img)

aoiFromText_xs_truecolor_sub.dat     (Example ASCII input for use with XS_truecolor_sub.img)





The aoiFromText example is intended to read an ASCII file for coordinates and then write an annotation AOI consisting of these coordinates.

The general flow of the program is to create an Eant_AnnotationInfo structure (eant_AnnotationInfoCreate). Then we get the map information (Eprj_MapInfo) from the input raster and add this to the AnnotationInfo structure. Once we reach this point we get the coordinate information from the text file and add this information to AnnotationInfo structure as Eant_Elements. Then we create our Eaoi_AreaOfInterest (eaoi_AntAoiObjectCreate) and add the information to this structure as an Eaoi_AoiObject. The final step is to create an HFA file (ehfa_FileCreate) and write the AOI information to this file using eaoi_WriteAoiToHfaFile.



Command Line Options


aoifromtext -in[put] <rasterinputfile> -a[scii] <asciiinputfile> -out[put] <outputfile> -m <1|0>




 This is the necessary raster file from which the AOI will get it’s map information.


 This is the coordinate information file from which the AOI will be constructed.


 This is the resultant AOI made up of the coordinates from the ASCII text file and the map information from the raster.


 Specifies whether or not to meter the process. 0=no and 1=yes.



            From Imagine Command Line (no GUI)

aoifromtext -in "d:/work/data/tmatlanta.img" -a "d:/work/datat/aoiFromText_xs_truecolor_sub.dat" –out "d:/work/datat/tmatlanta1.aoi" –m 1


From Imagine Command Line (GUI)

load "aoifromtext.eml"


From DOS Batch

Add the following command in your template:

"IMAGINE INSTALL FOLDER\bin\ntx86debug\aoifromtext.exe" -in "d:/work/data/tmatlanta.img" -a "d:/work/datat/aoiFromText_xs_truecolor_sub.dat" -out "d:/work/datat/tmatlanta.aoi" -m 1





EML interface




tmatlant.img with tmatlant.aoi layer on the top.




The output of this program will be an Area Of Interest file (AOI) that contains the coordinates as specified in the Input ASCII coordinate file. (e.g. *.aoi)



The coordinates in the text file must be in the same geographical region and coordinate system as the raster input. The map and projection information from the input raster will be used to define the extents of the AOI file.


Source Code