Shared Samples

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

Job annotationFromText: create annotation (.ovr) from ascii file

by Technical Evangelist on ‎09-08-2015 10:14 AM - edited on ‎03-29-2016 11:28 AM by Anonymous (1,022 Views)

Example Type





            The purpose of this example is to create annotation (text and polygon) at coordinates specified in the supplied text file.



annotationFromText.c  (C source code)

            resource.h                               (Resource header)(windows only)

            Eml.ico                                     (ERDAS Icon)(windows only)

annotationFromText.vcproj      (Visual Stuido 2005 Project)

annotationFromText.dsp          (Visual Stuido 6 Project)

            readme.txt                               (Where to copy, how to run)




The annotationFromText example is intended to provide users with the steps necessary to create an annotation file that can contain polygon and text annotation. The coordinates and entity type are read from an ASCII text file and the corresponding annotations are written to an IMAGINE annotation file.

The general flow of the program is to create an Eant_AnnotationInfo structure (eant_AnnotationInfoCreate) and create an annotation (.ovr) file using eant_LayerNew. Then get the map information (Eprj_MapInformation) 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. The final step is to write the annotation file to the disk using eant_AnnotationWrite.



Actually eant_LayerNew() will call ehfa_FileCreate () to create *.ovr, because *.ovr follow Imagine EFHA standard.



Command Line Options

annotationfromtext -in[put] <inputfilename> –text[file] <textfile> -out[put[ovr]] <annotation file>



 This is the coordinate information file from which the annotation will be constructed. For this example, this will be lanier.img.


 This is the necessary text file from which the annotation will get its type and coordinate information.


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



Suggested input files


Input Image File: lanier.img

ASCII Coordinate File: annotation.txt









The output of this program will be an Annotation file (.ovr) that contains the coordinates as specified in the Input ASCII coordinate file.



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 annotation file.


Source Code: