0

Working under CentOS (Linux), we have run up against the 4GB shapefile (dbf) limitation in our Monte Carlo model. We've decided to switch to GeoPackage to output our point attributes. I cannot find a reference on what GDAL/OGR driver to ask for under C++.

If I specify"GKPG" as a driver name, I get a null value returned from GetGDALDriverManager()->GetDriverByName. I am linking with GDAL 2.3.2. Using the command: $ ogrinfo --formats |grep GPKG

I get:

GPKG -raster,vector- (rw+vs): GeoPackage. 

I assume this means that we linked with GEOPKG (and sqllite3) when we installed the package, but I am checking with IT to try to find out more. Apologies that I don't know how to make my code show with line feeds below:

My stripped down code below:

#include <ogr_feature.h>
#include "ogrsf_frmts.h"
GDALDriver  *Driver;
int main()
{
 const char *Seed_drv = "ESRI Shapefile"; //Results in valid Driver below. 
 OGRRegisterAll(); // Register Drivers
 Driver = GetGDALDriverManager()->GetDriverByName(Seed_drv); //Driver:Valid
}

However:...

 const char *Seed_drv = "GPKG"; // Results in NULL myDriver below.
 OGRRegisterAll(); // Register Drivers
 myDriver = GetGDALDriverManager()->GetDriverByName(Seed_drv); // Driver:NULL
  • How I'm linking:# Optimise: g++ -O3 -Wall -std=c++0x $1.cpp -o $1 -L/usr/local/lib -lgdal -L/usr/lib64 -I/usr/local/include/ # Debug: g++ -ggdb -Wall -std=c++0x -rdynamic -o $1 $1.cpp -L/usr/local/lib -lgdal -L/usr/lib64 -I/usr/local/include/ – Frederick Irani Feb 22 at 17:18
1

To check availability of GPKG execute following command in console:

ogrinfo --formats

It is expected the following line in output:

GPKG -raster,vector- (rw+vs): GeoPackage

The driver details, create and open options can be found at GPKG driver page

  • I received the expected result when I entered your command above. I've updated my question with the code I'm using for ESRI Raster vs GPKG. I need to know whether I need to rebuild GDAL Even though I got the correct response from the info query. – Frederick Irani Feb 22 at 17:27

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.