Shared Samples

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

Job imageWriteGCP_withColor

by Technical Evangelist on ‎09-08-2015 10:50 AM - edited on ‎03-29-2016 11:31 AM by Anonymous (792 Views)

Example Type





Almost same as imageWriteGCP, but add RED color to each GCPs.

This job read a set of destination GCPs (Ground Control Points) from ASCII (*.dat) and stores them in a .gcc (Ground Control Coordinates) file.




imageWriteGCP.c         (C source code)

imageWriteGCP.eml     (EML script)

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

imageWriteGCP.dat      (Example ASCII File)






The imageWriteGCP example demonstrates how ground control points collected from outside of IMAGINE (i.e., ASCII text file) can be used to create a .gcc (Ground Control Coordinates) file that can be used in IMAGINE. During geometric correction, ERDAS IMAGINE works with two sets of coordinates:

source coordinates, which are measured in the file coordinate system (row, column) and are stored in the original image file, and reference (destination) coordinates, which are measured in a map coordinate system (such as lat/lon, UTM, etc.) and are stored in a .gcc file.

If the user has a collection of reference coordinates in a text file, this program can be used to create a valid ERDAS IMAGINE .gcc file.

This program scans the point coordinates from the text file and then adds this information to three places. First, "X" coordinates are stored in an Egda_BaseData buffer. "Y" coordinates are stored in a separate Egda_BaseData buffer. In this case each member of the Egda_BaseData structure can be accessed using the EGDA_VECTORPTR macro (see egda Macros in the online help). Each "X" and "Y" coordinate pair should have a name, so a name is created and stored in an Estr_StringList. (The text file in this example does not contain point name information, so we create it internally as PT_1, PT_2 , etc.)

Once the structures are populated, we write them to a .gcc file (HFA) using erec_GCCFileWrite().



Command Line Options


imagewritegcp -in[put] <inputfile> -out[put] <outputfile> [-m <0|1>]



 The input text file of coordinates used to create a GCC file.



 The output GCC file.



 Specifies whether or not to meter the process. 0 is no and 1 (default) is yes.








            This example outputs a .gcc file.



            gcc follows the Imagine hfa (Hierarchical File Architecture), HfaView (Tools->View Hfa structure) can display the content of gcc file.




Source Code: