Digital Geography

15. October 2015

Adding projection data to ENVI headers (GIMMS 3g example)

Once in a while you may need to take an unprojected file and add coordinate parameters to the header. Assuming you use ENVI, the hard way is to perform a reprojection via Image to Map registration in ENVI Classic. The easy way is to add the coordinate information to the header file. Here we assume you do not need to warp the file to an ellipsoid or datum. Here we use the example of GIMMS 3g data from the University of Maryland and NASA.

Start by importing the data as a Binary file.

 

It is important to realize that the samples and lines are 2160 and 4320 respectively (not the other way around). The Byte order is Big Endian or IEEE. Next you will need to transpose the data using the “rotate” tool.

Now we will edit the ENVI header file to add a coordinate system to our image data. ENVI headers are quite versatile when used correctly: they are compatible with the Open  Geospatial Consortium Well-known Text standard. Here is an example of a header without projection information:

ENVI
description = {Transposed GIMMS Image}
samples = 4320
lines   = 2160
bands   = 1
header offset = 0
file type = ENVI Standard
data type = 2
interleave = bsq
sensor type = AVHRR
byte order = 0
wavelength units = NDVI
band names = {GIMMS 3g}

This metadata explains the file structure and can be used to provide some information about the products’ origins. I added the details for the parameters: description, band names, sensor type and units myself.

To implement a coordinate system I need to add two further information strings: the “map info” and “coordinate system string”.

Excelis tells us what we need to provide for the “map info” string:

Lists geographic information in the following order:

  • Projection name
  • Reference (tie point) pixel x location (in file coordinates)
  • Reference (tie point) pixel y location (in file coordinates)
  • Pixel easting
  • Pixel northing
  • x pixel size
  • y pixel size
  • Projection zone (UTM only)
  • North or South (UTM only)
  • Datum
  • Units

Our example file is in geographic (lat/long) coordinates and the information we need to provide is thus:

map info = {Geographic Lat/Lon, 1.0000, 1.0000, -180, 90, 0.0833, 0.0833, WGS-84, units=Degrees}

Note we do not need to add Project Zone or the North or South parameters.

Turning to the coordinate system string we see that we need the following information:

  • Geographic coordinate system
  • Datum
  • Spheroid
  • Prime meridian
  • Unit

Other parameters may be needed to describe the coordinate system if you are using something other than geographic coordinates.

For us the information needed is in this form:

coordinate system string = {GEOGCS[“GCS_WGS_1984”,DATUM[“D_WGS_1984”,SPHEROID[“WGS_1984”,6378137.0,298.257223563]],PRIMEM[“Greenwich”,0.0],UNIT[“Degree”,0.0174532925199433]]}

So our final GIMMS Header will look like this:

ENVI
description = {Transposed GIMMS Image}
samples = 4320
lines   = 2160
bands   = 1
header offset = 0
file type = ENVI Standard
data type = 2
interleave = bsq
sensor type = AVHRR
byte order = 0
wavelength units = NDVI
band names = {GIMMS 3g}
map info = {Geographic Lat/Lon, 1.0000, 1.0000, -180, 90, 0.0833, 0.0833, WGS-84, units=Degrees}
coordinate system string = {GEOGCS[“GCS_WGS_1984”,DATUM[“D_WGS_1984”,SPHEROID[“WGS_1984”,6378137.0,298.257223563]],PRIMEM[“Greenwich”,0.0],UNIT[“Degree”,0.0174532925199433]]}

 

 

 

 

  • Florian Detsch

    As you point out correctly, the byte order is Big Endian (or IEEE). Therefore, the ‘byte order’ argument in the ENVI header file should be ‘1’ instead of ‘0’. For instance, have a look at http://www.exelisvis.com/docs/ENVIHeaderFiles.html.