2

The migration guide for GDAL 2.0 says:

C++ API:

  • OGRSFDriverRegistrar and OGRSFDriver are now deprecated. Use GDALDriverManager and GDALDriver instead.

I have only ever used GDAL Python bindings, so I'm not sure how or if this affects any code I write. I used to create ESRI Shapefiles like this:

driver = ogr.GetDriverByName('ESRI Shapefile')

Is this related to an OGRSFDriver? I tried to do

driver = gdal.GetDriverByName('ESRI Shapefile')

Which returns a driver but does not have any CreateDataSource binding in it.

Is it correct to continue to use the ogr.GetDriverByName('ESRI Shapefile') convention for GDAL 2.0+? If not, what should I use?

3

GDAL and OGR are still separate packages after the migration so it is standard to use ogr.GetDriverByName() when creating/opening vector data.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.