1
0
Fork 0

Bump minimum GDAL version to 2.0.0. Adapt code to API changes for now.

Porting of OGR to GDAL classes can happen later.
This commit is contained in:
Christian Schmitt 2015-07-16 21:05:37 +02:00
parent 082ee9b82f
commit 227cdeab42
4 changed files with 11 additions and 9 deletions

View file

@ -93,7 +93,7 @@ find_package(Boost COMPONENTS system thread REQUIRED)
find_package(ZLIB REQUIRED)
find_package(Threads REQUIRED)
find_package(SimGear 3.1.0 REQUIRED)
find_package(GDAL 1.6.0 REQUIRED)
find_package(GDAL 2.0.0 REQUIRED)
find_package(TIFF REQUIRED) # needed for SRTM
set (CGAL_MINIMUM 4.0)

View file

@ -18,7 +18,8 @@ void* tgShapefile::OpenDatasource( const char* datasource_name )
tgShapefile::initialized = true;
}
ogrdriver = OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName( format_name );
ogrdriver = (OGRSFDriver*) OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName( format_name );
if ( !ogrdriver ) {
SG_LOG( SG_GENERAL, SG_ALERT, "Unknown datasource format driver: " << format_name );
exit(1);

View file

@ -27,6 +27,7 @@
#include <boost/thread.hpp>
#include <ogrsf_frmts.h>
#include <gdal_priv.h>
#include <simgear/compiler.h>
#include <simgear/threads/SGThread.hxx>
@ -648,10 +649,10 @@ int main( int argc, char **argv ) {
SG_LOG( SG_GENERAL, SG_DEBUG, "Opening datasource " << datasource << " for reading." );
OGRRegisterAll();
OGRDataSource *poDS;
GDALAllRegister();
GDALDataset *poDS;
poDS = OGRSFDriverRegistrar::Open( datasource.c_str(), FALSE );
poDS = (GDALDataset*) GDALOpen( datasource.c_str(), GA_ReadOnly );
if( poDS == NULL )
{
SG_LOG( SG_GENERAL, SG_ALERT, "Failed opening datasource " << datasource );
@ -682,7 +683,7 @@ int main( int argc, char **argv ) {
}
}
OGRDataSource::DestroyDataSource( poDS );
GDALClose(poDS);
SG_LOG(SG_GENERAL, SG_ALERT, "Saving to buckets");
results.Save( save_shapefiles );

View file

@ -459,7 +459,7 @@ void usage(const char* progname, const std::string& msg) {
SG_LOG(SG_GENERAL, SG_INFO, "\t\tAvailable formats:");
OGRSFDriverRegistrar* registrar=OGRSFDriverRegistrar::GetRegistrar();
for (int i=0;i<registrar->GetDriverCount();i++) {
SG_LOG(SG_GENERAL, SG_INFO, "\t\t\t-f \"" << registrar->GetDriver(i)->GetName() << "\"");
SG_LOG(SG_GENERAL, SG_INFO, "\t\t\t-f \"" << registrar->GetDriver(i)->GetDescription() << "\"");
}
SG_LOG(SG_GENERAL, SG_INFO, "\t\tDefault: ESRI Shapefile");
SG_LOG(SG_GENERAL, SG_INFO, "");
@ -519,7 +519,7 @@ int main(int argc, char** argv) {
const char* dst_datasource=argv[optind++];
OGRSFDriver *ogrdriver;
ogrdriver = OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(format_name);
ogrdriver = (OGRSFDriver*) OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(format_name);
if (!ogrdriver) {
usage(argv[0],std::string("Unknown datasource format driver:")+format_name);
exit(1);