[gdal-dev] gdal-1.11.3 to gdal-2.3.1 compatibility

Julian Zeidler gdal at zeidlers.de
Tue Jul 17 07:06:23 PDT 2018


Hi Gane,

it requires only minor modifications. In my Code I have a FLAG 
(HAVE_GDAL2) which makes it compile against both versions.
The changes are along the lines of:

#ifdef HAVE_GDAL2
      GDALDataset *ogrDataset;
#else
      OGRDataSource* ogrDataset;
#endif

#ifdef HAVE_GDAL2
         GDALAllRegister();
         unsigned int  nOpenFlags=GDAL_OF_VECTOR;
        GDALDriver 
*poDriver=GetGDALDriverManager()->GetDriverByName(driver);
         ogrDataset=(GDALDataset*) GDALOpenEx(filename,nOpenFlags, NULL, 
NULL, NULL);
  #else
         OGRRegisterAll();
          ogrDataset=OGRSFDriverRegistrar::Open(filename, FALSE );
  #endif


#ifdef HAVE_GDAL2
                 GDALClose(ogrDataset);
  #else
                 OGRDataSource::DestroyDataSource(ogrDataset);
   #endif


Cheers Julian

Am 17.07.2018 um 14:34 schrieb Gane R:
> Hi all,
>
> Is gdal-1.11.3, opening vector data set, reading OGR features code 
> compatible with gdal-2.3.1 code or any major changes in accessing OGR 
> features ?
>
> Thanks
> Gane
>
>
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20180717/35a8f3a8/attachment.html>


More information about the gdal-dev mailing list