[gdal-dev] Formats question (was Re: JPEG2000 question/issue)

Frank Warmerdam warmerdam at pobox.com
Tue Oct 28 11:31:28 EDT 2008


Nidel, Mike wrote:
> That was what I was looking for, thank you.
> 
> Now a new question, is there a way to remove formats from the
> build entirely? Obviously there is for formats that require
> external libraries, they just don't get uncommented in the
> nmake.opt. But what about, for example, disabling NITF at
> compile time? I would actually like to disable ALL gdal formats
> except MrSID, but NITF causes a particular problem for me
> because I already have an NITF reader and there is a conflict
> in the way I'm loading the readers.

Mike,

On windows you can remove the -DFRMT_<format> declarations from
EXTRAFLAGS in gdal/frmts/makefile.vc to drop particular standard formats.
On unix/linux you can remove formats from the GDAL_FORMATS macro in
GDALmake.opt after configuring.

Note that some formats depend on others and so some combinations of
removals will not work.

In applications you can also deregister drivers after calling
GDALAllRegister() or you can just register selective drivers using
their corresponding register calls.

To deregister a driver do something like:

   GDALDriverManager *poDM = GetGDALDriverManager();

   GDALAllRegister();
   poDM->DeregisterDriver( poDM->GetDriverByName( "NITF" ) );

To register only selective drivers skip GDALAllRegister() and call
the desired registration functions.

#include "gdal_frmts.h"

...
   GDALRegister_MrSID();
   GDALRegister_JPEG();

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