[gdal-dev] GDALDatasetDriver->poDriver = NULL
Mateusz Loskot
mateusz at loskot.net
Thu Oct 8 08:40:57 PDT 2020
On Thu, 8 Oct 2020 at 17:17, Momtchil Momtchev <momtchil at momtchev.com> wrote:
>
> Is it normal that for this code
>
> int main() {
> GDALAllRegister();
> const char *pszFormat = "GTiff";
> GDALDriver *driver = GetGDALDriverManager()->GetDriverByName(pszFormat);
> if (driver == nullptr) {
> printf("driver is null\n");
> return 1;
> }
> std::string path = "sample.tif";
> GDALAccess access = GA_ReadOnly;
> GDALOpenInfo *open_info = new GDALOpenInfo(path.c_str(), access);
> GDALDataset *ds = driver->pfnOpen(open_info);
> printf("%p\n", ds->GetDriver());
> printf("%s\n", ds->GetDriver()->GetDescription());
> }
>
> I get ds->GetDriver = NULL (and a segfault on the following line)? Tried on 3.1.2 and 3.1.0
Try to open a dataset as presented here
https://gdal.org/tutorials/raster_api_tut.html
Best regards.
--
Mateusz Loskot, http://mateusz.loskot.net
More information about the gdal-dev
mailing list