[Gdal-dev] Using mgrs.h in NITF

Frank Warmerdam warmerdam at pobox.com
Thu Jan 8 11:51:54 EST 2009


carlj88 wrote:
> I want to convert geodetic coordinates to MGRS using the code from
> frmts/nitf/mgrs.c in my QT-application. How do I access these functions from
> my c++ code? Tried to use 'include "mgrs.h"' but then I don't know how to
> reference to the function.
> 
> I would be most greatful since the web has about nothing to offer on this
> issue.
> 
> Carl Johansson

Carl,

First, the MGRS support code in gdal/frmts/nitf is intended primariliy for
use with the NITF driver internals, not for public use.  You *can* use
it publically, but it isn't supported and might be fragile.

The function you would apparently want to call is Convert_Geodetic_To_MGRS()
but it seems this function does not exist in mgrs.c.  I'm not sure if I removed
it to simplfy things - since I didn't need it, or what.

Well, on reflection, I guess you should go back to the original geotrans
source to get the MGRS conversion code.  If you can't find the GeoTrans
source via a google search let me know know and I'll provide a stashed copy
I must have somewhere.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the gdal-dev mailing list