diff --git a/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h b/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h index 1c4ac63e4b685b3fddcfdb2fedba65f07e55523f..6db10d56d416078d3ce0b626ef51213a3f23d11f 100644 --- a/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h +++ b/Modules/Adapters/GdalAdapters/include/otbOGRVersionProxy.h @@ -126,6 +126,9 @@ namespace version_proxy */ GDALDriverType * GetDriverByName(const char * name); + + std::string GetDriverNameFromDataSource(const GDALDatasetType * ds); + /** * Sync dataset to disk. * diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy1x.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy1x.cxx index f92ee6e1dfd4a1e1784421369a867b56c76441c3..1645bfe1525101482ea2d35aaec0e33944e3cfec 100644 --- a/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy1x.cxx +++ b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy1x.cxx @@ -119,6 +119,11 @@ std::vector<std::string> GetAvailableDriversAsStringVector() return ret; } +std::string GetDriverNameFromDataSource(const GDALDatasetType * ds) +{ + return std::string(const_cast<GDALDatasetType *>(ds)->GetDriver()->GetName()); +} + } } } // end namespace diff --git a/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy2x.cxx b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy2x.cxx index 725486f4b74758e60b880cf8d38906dff85a9ead..ebd3ecb8bd7f4eb831ce2c3224c0400aae5b013c 100644 --- a/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy2x.cxx +++ b/Modules/Adapters/GdalAdapters/src/otbOGRVersionProxy2x.cxx @@ -152,6 +152,11 @@ std::vector<std::string> GetAvailableDriversAsStringVector() return ret; } +std::string GetDriverNameFromDataSource(const GDALDatasetType * ds) +{ + return std::string(const_cast<GDALDatasetType *>(ds)->GetDriverName()); +} + } } } // end namespace diff --git a/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx b/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx index bce82fc34a0332c8085f4dcd29487df1cda0f69e..00515af1a604742dd12b5a9d2c8cdb7ee0c23759 100644 --- a/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx +++ b/Modules/Applications/AppSegmentation/app/otbSegmentation.cxx @@ -677,7 +677,7 @@ private: //Note : the GetDriver() Method has not been encapsulated in otb::ogr::DataSource, //so we must access the OGR pointer by using .ogr() - std::string driverName(ogrDS->ogr().GetDriver()->GetName()); + std::string driverName(otb::ogr::version_proxy::GetDriverNameFromDataSource(&ogrDS->ogr())); if ( driverName.find("ESRI Shapefile") != std::string::npos) { otbAppLogINFO(<<"REPACK the Shapefile ..."<<std::endl);