Projections are coordinate systems used to represent points on the Earth. EASI includes intrinsic functions for accessing projection information from database files and for translating points between projections.
Projection information is stored in EASI in a pre-defined structure named GeoInfo.
define structure GeoInfo char Units[24] ! Map Units string (16 characters maximum) double ULX ! Upper left X coordinate in georef units double ULY ! Upper left Y coordinate in georef units double LRX ! Lower right X coordinate in georef units double LRY ! Lower right Y coordinate in georef units double XOff ! X offset in georef units of upper left corner double YOff ! Y offset in georef units of upper left corner double XSize ! X size in georef units that each pixel represents double YSize ! Y size in georef units that each pixel represents double XRot ! X rotation for the georeference area double YRot ! Y rotation for the georeference area double DEarth1 ! Semi-major axis for the earth in meters double DEarth2 ! Semi-minor axis for the earth in meters double RefLong ! Reference Longitude double RefLat ! Reference Latitude double StdParallel1 ! First standard parallel double StdParallel2 ! Second standard parallel double FalseEasting ! False Easting in meters double FalseNorthing ! False Northing in meters double Scale ! Scale for some projections double Height ! If Units are “GVNP”, meters above the earth double Long1 ! If Units are “OM”, Longitude of first point on center line double Lat1 ! If Units are “OM”, Latitude of first point on center line double Long2 ! If Units are “OM”, Longitude of second point on center line double Lat2 ! If Units are “OM”, Latitude of second point on center line double Azimuth ! If Units is “OM”, azimuth east of north for center line integer LandsatNum ! If Units is “SOM”, the Landsat number integer LandsatPath ! If Units is “SOM”, the Landsat path enddefine
Database files often have projection information stored with them. The projection of a database file can be read into a GeoInfo structure using the DBReadGeoInfo() intrinsic and written to the file using the DBWriteGeoInfo()intrinsic.
For example, projection information is read into a GeoInfo structure called gi in the following form:
local GeoInfo gi local Integer fd fd = DBOpen( "irvine.pix", "r" ) call dbreadgeoinfo( fd, gi ) printf "Projection String: %s\n", gi.Units
The following example creates a new database file using the DBCreate() intrinsic, and writes to this file the projection information previously read into gi. The database created in this case will be a TIFF file:
local integer fdnew fdnew = DBCreate( "new.tif", "TIF", DBPixels( fd ), \ DBLines( fd ), 1, DBChanType( fd, 1 ) ) call DBWriteGeoInfo( fdnew, gi ) call DBClose( fdnew ) call DBClose( fd )
The Reproject() intrinsic function translates coordinates between projections. This function takes a list of coordinate pairs stored in an array and a pair of GeoInfo structures that define the input and output projections as input. On return, the array contains the corresponding coordinates in the output projection.
For example, the following translates the coordinates of the upper-left and lower-right corners of the input projection to Long/Lat:
local GeoInfo go go.units = "LONG" local double plist[4] plist[1] = gi.ULX plist[2] = gi.ULY plist[3] = gi.LRX plist[4] = gi.LRY printf "ulx: %g uly: %g\n", plist[1], plist[2] printf "llx: %g lly: %g\n", plist[3], plist[3] call Reproject( gi, go, 2, plist ) printf "ulx: %g uly: %g\n", plist[1], plist[2] printf "llx: %g lly: %g\n", plist[3], plist[3]
The Reproject() intrinsic may not be used to translate points from a projection to pixel/line coordinates. However, this transformation is simple enough to perform directly using the information stored in the GeoInfo structure. The following example converts the x and y coordinates in the first two elements of PLIST to pixel/line (assuming there is zero rotation in the file georeferencing):
local double xoffset, yoffset, xsize, ysize xoffset = gi.ulx yoffset = gi.uly xsize = ( gi.lrx-gi.ulx ) / DBPixels( fd ) ysize = (gi.lry-gi.uly ) / DBLines( fd ) plist[1] = ( plist[1]-xoff ) / xsize plist[2] = ( plist[2]-yoff ) / ysize
Similarly, a pixel/line coordinate can be transformed to a projection as follows:
plist[1] = plist[1]*xsize + xoff plist[2] = plist[2]*ysize + yoff
The ULX, ULY, LRX, and LRY fields have been down-graded and are now derived from the XOff, YOff, XSize, YSize, XRot, YRot fields and the raster layer dimensions in DBReadGeoInfo(). In DBWriteGeoInfo(), the ULX, ULY, LRX, and LRY will have no effect and it is XOff, YOff, XSize, YSize, XRot, and YRot that are written to the output file. When the GeoInfo is related to a vector layer, a meaningful value will not be set.
It is possible to read and write separate projection information to vector layers in a database file. For more information, refer to the help for the intrinsic functions VecReadGeoInfo() and VecWriteGeoInfo().
© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.