[Gdal-dev] Creating NITF file from raw SAR data

Hugh Shane hughs at ll.mit.edu
Fri Jun 18 11:41:26 EDT 2004


Hello,

I'm attempting to use GDAL to export data from a radar system currently
under development to a NITF 2.1-compatible display system. Our data
consists of gray scale encoded SAR imagery projected onto the WGS-84
spheroid. The images are bulk geocoded in the sense that the lat/lon
coordinates of each of the four corners of the image are given. (I could
get the coordinates of every pixel, but it seems as if this would be
overkill for our application.) The images are arbitrarily rotated with
respect to local north.  

The NITF format allows geolocation and timestamping of imagery. My
problem is that I don't know how to make GDAL package my lat/lon and
timestamp data into the NITF file. Can anyone shed some light on this? 

Have mercy on this poor GIS newbie :))

I'm writing my application in C and building it as a Matlab MEX-file.
(C++ MEX-files are not officially supported by Mathworks.) Here's a code
snippet of what I've managed to implement thus far:

/******************************************************/
void
WriteNTIF(double timestamp,    /* image acquisition time in seconds
since midnight UTC */
          coord  *corners,     /* lat/lon, WGS-84, corners of the image
array */ 
          double image[],      /* NxM pixel array */
          int N, int M,
          char *filename)
{
  GDALDriverH hDriver, hDstDS;
  char **papszOptions = NULL;
  GDALRasterBandH hBand;

  GDALAllRegister();
  hDriver = GDALGetDriverByName("NITF");
  hDstDS = GDALCreate(hDriver, filename, N, M, 1, GDT_Float64,
papszOptions);
  hBand = GDALGetRasterBand( hDstDS, 1 );
  GDALRasterIO( hBand, GF_Write, 0, 0, N, M, image, N, M, GDT_Float64,
0, 0 );    
  GDALFlushCache( hDstDS );
  GDALClose( hDstDS );
  return;
}

/******************************************************/


Thanks,
Hugh

+------------------------------------------------+
| Hugh A. Shane       EMail: hughs at ll.mit.edu    |
| Massachusetts Institute of Technology          |
| Lincoln Laboratory                             |
| 244 Wood Street.                               |
| Lexington, MA 02420-9108                       |
| Attn: S2-265                                   |
| Phone +1.781.981.1837    Fax +1.781.981.5255   |
+------------------------------------------------+




More information about the Gdal-dev mailing list